From 1918aa6d9b66e274a76bbee4613340c54102d2a1 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Sat, 20 Jan 2024 17:59:18 +0000 Subject: [PATCH 1/2] Extension should only be classed as active/valid when it's allowed on the domain --- src/backend/extension/messaging.ts | 2 +- src/pages/parts/player/MetaPart.tsx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backend/extension/messaging.ts b/src/backend/extension/messaging.ts index b738184a..1f2a2b00 100644 --- a/src/backend/extension/messaging.ts +++ b/src/backend/extension/messaging.ts @@ -67,5 +67,5 @@ export async function isExtensionActive(): Promise { if (!info?.success) return false; const allowedVersion = isAllowedExtensionVersion(info.version); if (!allowedVersion) return false; - return true; + return info.allowed && info.hasPermission; } diff --git a/src/pages/parts/player/MetaPart.tsx b/src/pages/parts/player/MetaPart.tsx index 1e18b6d1..17803219 100644 --- a/src/pages/parts/player/MetaPart.tsx +++ b/src/pages/parts/player/MetaPart.tsx @@ -46,11 +46,10 @@ export function MetaPart(props: MetaPartProps) { const { error, value, loading } = useAsync(async () => { const info = await extensionInfo(); const isValidExtension = - info?.success && isAllowedExtensionVersion(info.version); + info?.success && isAllowedExtensionVersion(info.version) && info.allowed; if (isValidExtension) { - if (!info.allowed || !info.hasPermission) - throw new Error("extension-no-permission"); + if (!info.hasPermission) throw new Error("extension-no-permission"); } // use api metadata or providers metadata From 9157220317ffe1baed51f4573274eaaad83fd579 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Sat, 20 Jan 2024 18:13:40 +0000 Subject: [PATCH 2/2] Add i81n strings for MetaPart --- src/assets/locales/en.json | 11 +++++++++++ src/pages/parts/player/MetaPart.tsx | 22 +++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 4db7eeaa..20ece967 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -277,6 +277,17 @@ "homeButton": "Back to home", "text": "We couldn't find the media you requested. Either it's been removed or you tampered with the URL.", "title": "Couldn't find that media." + }, + "extensionPermission": { + "badge": "Permission Missing", + "title": "Configure the extension", + "text": "You have the browser extension, but we need your permission to get started using the extension.", + "button": "Use extension" + }, + "dmca": { + "badge": "Removed", + "title": "Media has been removed", + "text": "This media is no longer available due to a takedown notice or copyright claim." } }, "nextEpisode": { diff --git a/src/pages/parts/player/MetaPart.tsx b/src/pages/parts/player/MetaPart.tsx index 17803219..1b84b7bf 100644 --- a/src/pages/parts/player/MetaPart.tsx +++ b/src/pages/parts/player/MetaPart.tsx @@ -116,13 +116,10 @@ export function MetaPart(props: MetaPartProps) { - {t("player.metadata.failed.badge")} + {t("player.metadata.extensionPermission.badge")} - Configure the extension - - You have the browser extension, but we need your permission to get - started using the extension. - + {t("player.metadata.extensionPermission.title")} + {t("player.metadata.extensionPermission.text")} @@ -145,12 +142,11 @@ export function MetaPart(props: MetaPartProps) { return ( - Removed - Media has been removed - - This media is no longer available due to a takedown notice or - copyright claim. - + + {t("player.metadata.dmca.badge")} + + {t("player.metadata.dmca.title")} + {t("player.metadata.dmca.text")}