Fix trending and search for OT region (#374)
This commit is contained in:
1 parent
37bce62b14
commit
1f67b307f1
2 files changed
+13
-6
No files matched your search
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- a bug where public Invidious instances all showed `N/A` in the health column
|
- a bug where public Invidious instances all showed `N/A` in the health column
|
||||||
|
- a bug where trending and search wouldn't work in certain countries
|
||||||
|
|
||||||
## [0.23.3] - 2024-04-28
|
## [0.23.3] - 2024-04-28
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,17 @@ namespace Invidious
|
|||||||
m.invidiousNode = invidiousNode
|
m.invidiousNode = invidiousNode
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetUserRegion() as string
|
function GetUserCountryCode() as string
|
||||||
if m._userRegion = invalid
|
if m._userCountryCode = invalid
|
||||||
m._userRegion = m.invidiousNode.applicationInfo@.GetUserCountryCode()
|
m._userCountryCode = m.invidiousNode.applicationInfo@.GetUserCountryCode()
|
||||||
|
|
||||||
|
' GetUserCountryCode() can return OT, which is not a valid country code.
|
||||||
|
' https://github.com/iBicha/playlet/issues/372
|
||||||
|
if ValidString(m._userCountryCode) = "OT"
|
||||||
|
m._userCountryCode = "US"
|
||||||
end if
|
end if
|
||||||
return m._userRegion
|
end if
|
||||||
|
return m._userCountryCode
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetAuthenticationHeaders(token as string) as object
|
function GetAuthenticationHeaders(token as string) as object
|
||||||
@@ -89,7 +95,7 @@ namespace Invidious
|
|||||||
url = `${instance}${Invidious.SEARCH_SUGGEST_ENDPOINT}`
|
url = `${instance}${Invidious.SEARCH_SUGGEST_ENDPOINT}`
|
||||||
|
|
||||||
request = HttpClient.Get(url)
|
request = HttpClient.Get(url)
|
||||||
request.QueryParam("region", m.GetUserRegion())
|
request.QueryParam("region", m.GetUserCountryCode())
|
||||||
request.QueryParam("q", q)
|
request.QueryParam("q", q)
|
||||||
request.CacheSeconds(60 * 60 * 24)
|
request.CacheSeconds(60 * 60 * 24)
|
||||||
|
|
||||||
@@ -266,7 +272,7 @@ namespace Invidious
|
|||||||
if queryParam.default <> invalid
|
if queryParam.default <> invalid
|
||||||
if IsString(queryParam.type) and queryParam.type = "#ISO3166"
|
if IsString(queryParam.type) and queryParam.type = "#ISO3166"
|
||||||
if queryParam.default = "GetUserCountryCode"
|
if queryParam.default = "GetUserCountryCode"
|
||||||
request.QueryParam(queryParamKey, m.GetUserRegion())
|
request.QueryParam(queryParamKey, m.GetUserCountryCode())
|
||||||
else
|
else
|
||||||
request.QueryParam(queryParamKey, queryParam.default)
|
request.QueryParam(queryParamKey, queryParam.default)
|
||||||
end if
|
end if
|
||||||
|
|||||||
Reference in new issue
Block a user