diff --git a/CHANGELOG.md b/CHANGELOG.md
index 98f79f61..d641e714 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
-- Attempt to fix `No valid bitrates` error by adding PoToken generation in web app
+- Attempt to fix `No valid bitrates` error by adding PoToken generation in server and web app
### Removed
diff --git a/playlet-lib/src/components/Screens/SettingsScreen/ClearPoTokensControl.bs b/playlet-lib/src/components/Screens/SettingsScreen/ClearPoTokensControl.bs
deleted file mode 100644
index 15fb8ac2..00000000
--- a/playlet-lib/src/components/Screens/SettingsScreen/ClearPoTokensControl.bs
+++ /dev/null
@@ -1,30 +0,0 @@
-import "pkg:/components/Dialog/DialogUtils.bs"
-import "pkg:/components/Services/Innertube/PoTokens.bs"
-import "pkg:/source/utils/FocusManagement.bs"
-import "pkg:/source/utils/Locale.bs"
-
-function Init()
- m.top.focusable = true
- m.top.itemSpacings = [8]
- m.button = m.top.findNode("Button")
- m.button.observeField("buttonSelected", FuncName(OnButtonSelected))
-end function
-
-function OnFocusChange() as void
- if not m.top.focus
- return
- end if
- NodeSetFocus(m.button, true)
-end function
-
-function BindPreference(_preferences as object, _key as string)
- ' Do nothing
-end function
-
-function OnButtonSelected()
- Innertube.PoTokens.ClearAllPoTokens()
- DialogUtils.ShowDialogEx({
- message: Tr(Locale.Settings.PoTokensCleared)
- title: Tr(Locale.Generic.Success)
- })
-end function
diff --git a/playlet-lib/src/components/Screens/SettingsScreen/ClearPoTokensControl.xml b/playlet-lib/src/components/Screens/SettingsScreen/ClearPoTokensControl.xml
deleted file mode 100644
index 01c4dce9..00000000
--- a/playlet-lib/src/components/Screens/SettingsScreen/ClearPoTokensControl.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/playlet-lib/src/components/Services/Innertube/PlayerEndpoint.bs b/playlet-lib/src/components/Services/Innertube/PlayerEndpoint.bs
index 62c82d18..8d826dd7 100644
--- a/playlet-lib/src/components/Services/Innertube/PlayerEndpoint.bs
+++ b/playlet-lib/src/components/Services/Innertube/PlayerEndpoint.bs
@@ -18,7 +18,8 @@ namespace Innertube
datasyncIdToken = OptionUtils.Get(options, "datasyncIdToken")
cpn = InnertubeService.CreateClientPlaybackNonce()
- useAccessToken = (client = Innertube.ClientType.Tv or client = Innertube.ClientType.TvDowngraded) and not StringUtils.IsNullOrEmpty(accessToken)
+ isTv = (client = Innertube.ClientType.Tv or client = Innertube.ClientType.TvDowngraded)
+ useAccessToken = isTv and not StringUtils.IsNullOrEmpty(accessToken)
deviceInfo = CreateObject("roDeviceInfo")
@@ -58,6 +59,10 @@ namespace Innertube
payload["playbackContext"]["contentPlaybackContext"]["signatureTimestamp"] = signatureTimestamp
end if
+ if isTv
+ payload["playbackContext"]["contentPlaybackContext"]["isLivingRoomDeeplink"] = true
+ end if
+
request = HttpClient.PostJson("https://www.youtube.com/youtubei/v1/player?prettyPrint=false&alt=json", payload)
request.Headers(Innertube.CreateHeaders(client))
diff --git a/playlet-lib/src/config/preferences.json5 b/playlet-lib/src/config/preferences.json5
index ce227212..6eb76632 100644
--- a/playlet-lib/src/config/preferences.json5
+++ b/playlet-lib/src/config/preferences.json5
@@ -314,7 +314,7 @@
{
displayText: "Mint PoToken",
key: "dev.mint_potoken",
- description: "Force-mint a PoToken for the current identity.",
+ description: "Mint a PoToken for the current identity.",
visibility: "web",
svelteComponent: "MintPoTokenControl",
},
@@ -325,13 +325,6 @@
visibility: "web",
svelteComponent: "ClearPoTokensControl",
},
- {
- displayText: "Clear PoTokens",
- key: "dev.clear_potokens",
- description: "Clear all stored PoTokens.",
- visibility: "tv",
- rokuComponent: "ClearPoTokensControl",
- },
{
displayText: "Enable Diagnostics",
key: "dev.diagnostics.enabled",
diff --git a/playlet-web/src/App.svelte b/playlet-web/src/App.svelte
index 33157762..786aedfd 100644
--- a/playlet-web/src/App.svelte
+++ b/playlet-web/src/App.svelte
@@ -24,19 +24,9 @@
import BookmarksScreen from "lib/Screens/BookmarksScreen.svelte";
import RemoteControlScreen from "lib/Screens/RemoteControlScreen.svelte";
import { fetchLocale } from "lib/Api/Locale";
- import { ensureDevicePoTokenWithToast } from "lib/ensureDevicePoToken";
import Toast from "lib/Toast.svelte";
- // Mint on load, then refresh hourly while the page is open.
- const POTOKEN_REFRESH_INTERVAL_MS = 60 * 60 * 1000;
-
onMount(() => {
- ensureDevicePoTokenWithToast();
- const poTokenRefreshInterval = setInterval(
- ensureDevicePoTokenWithToast,
- POTOKEN_REFRESH_INTERVAL_MS,
- );
-
PlayletApi.getState().then((value) => {
playletStateStore.set(value);
fetchLocale(value.device?.current_locale);
@@ -73,8 +63,6 @@
PlayletApi.getBookmarkFeeds().then((value) => {
bookmarksStore.set(value);
});
-
- return () => clearInterval(poTokenRefreshInterval);
});
let currentScreen: AppState["screen"];
diff --git a/playlet-web/src/lib/Api/PoTokenMinter.ts b/playlet-web/src/lib/Api/PoTokenMinter.ts
index ced9c5a9..cd8cb6f0 100644
--- a/playlet-web/src/lib/Api/PoTokenMinter.ts
+++ b/playlet-web/src/lib/Api/PoTokenMinter.ts
@@ -180,8 +180,8 @@ export class PoTokenMinter {
return now - device.mintedAt >= REFRESH_AGE_SECONDS;
}
- // Mints + uploads a poToken when the device's token needs refreshing, or always when forced.
- static async ensureDevicePoToken(force = false): Promise {
+ // Mints + uploads a poToken when the device's token needs refreshing.
+ static async ensureDevicePoToken(): Promise {
let device: DevicePoToken;
try {
device = await PlayletApi.getDevicePoToken();
@@ -194,7 +194,7 @@ export class PoTokenMinter {
if (!identity) {
return { status: "no-session" };
}
- if (!force && !PoTokenMinter.shouldRefresh(device)) {
+ if (!PoTokenMinter.shouldRefresh(device)) {
return { status: "current" };
}
diff --git a/playlet-web/src/lib/Screens/Settings/SettingControls/MintPoTokenControl.svelte b/playlet-web/src/lib/Screens/Settings/SettingControls/MintPoTokenControl.svelte
index 9046ae38..a7cb7903 100644
--- a/playlet-web/src/lib/Screens/Settings/SettingControls/MintPoTokenControl.svelte
+++ b/playlet-web/src/lib/Screens/Settings/SettingControls/MintPoTokenControl.svelte
@@ -14,7 +14,7 @@
{$translate(displayText)}
{@html $translate(description)}
-
diff --git a/playlet-web/src/lib/ensureDevicePoToken.ts b/playlet-web/src/lib/ensureDevicePoToken.ts
index 2eb837c5..f74d4f74 100644
--- a/playlet-web/src/lib/ensureDevicePoToken.ts
+++ b/playlet-web/src/lib/ensureDevicePoToken.ts
@@ -2,8 +2,8 @@ import { PoTokenMinter } from "lib/Api/PoTokenMinter";
import { addToast } from "lib/Toast";
// Mints for the current identity if needed, surfacing the outcome as a toast.
-export async function ensureDevicePoTokenWithToast(force = false) {
- const result = await PoTokenMinter.ensureDevicePoToken(force);
+export async function ensureDevicePoTokenWithToast() {
+ const result = await PoTokenMinter.ensureDevicePoToken();
switch (result.status) {
case "minted":
addToast("PoToken minted on device", "success");