Skip to content

Commit

Permalink
Content region and locale for playlet backend
Browse files Browse the repository at this point in the history
  • Loading branch information
iBicha committed Dec 23, 2024
1 parent 82e55d7 commit c6853cd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Region and locale support for Playlet backend

### Fixed

- Start up crash on older OS version (11.5)
Expand Down
20 changes: 14 additions & 6 deletions playlet-lib/src/components/Services/Innertube/Context.bs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ namespace Innertube

function CreateContextClientWeb(deviceInfo as object) as object
return {
"hl": "en"
"gl": "US"
"hl": deviceInfo.GetCurrentLocale()
"gl": GetContentRegion(deviceInfo)
"remoteHost": ""
"screenDensityFloat": 1
"screenHeightPoints": 1440
Expand Down Expand Up @@ -102,8 +102,8 @@ namespace Innertube

function CreateContextClientIOS(deviceInfo as object) as object
return {
"hl": "en"
"gl": "US"
"hl": deviceInfo.GetCurrentLocale()
"gl": GetContentRegion(deviceInfo)
"remoteHost": ""
"screenDensityFloat": 1
"screenHeightPoints": 1440
Expand All @@ -128,8 +128,8 @@ namespace Innertube

function CreateContextClientTv(deviceInfo as object) as object
return {
"hl": "en"
"gl": "US"
"hl": deviceInfo.GetCurrentLocale()
"gl": GetContentRegion(deviceInfo)
"remoteHost": ""
"deviceMake": INNERTUBE_TV_DEVICE_MAKE
"deviceModel": INNERTUBE_TV_DEVICE_MODEL
Expand Down Expand Up @@ -157,4 +157,12 @@ namespace Innertube
"utcOffsetMinutes": -300
}
end function

function GetContentRegion(deviceInfo as object) as string
region = deviceInfo.GetUserCountryCode()
if region.len() <> 2 or region = "OT"
region = "US"
end if
return region
end function
end namespace

0 comments on commit c6853cd

Please sign in to comment.