1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-21 14:47:41 +01:00

Merge branch 'extension' of https://github.com/movie-web/movie-web into extension

This commit is contained in:
mrjvs 2024-01-20 22:54:23 +01:00
commit faa58f9ce6
3 changed files with 23 additions and 17 deletions

View file

@ -277,6 +277,17 @@
"homeButton": "Back to home", "homeButton": "Back to home",
"text": "We couldn't find the media you requested. Either it's been removed or you tampered with the URL.", "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." "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": { "nextEpisode": {

View file

@ -67,5 +67,5 @@ export async function isExtensionActive(): Promise<boolean> {
if (!info?.success) return false; if (!info?.success) return false;
const allowedVersion = isAllowedExtensionVersion(info.version); const allowedVersion = isAllowedExtensionVersion(info.version);
if (!allowedVersion) return false; if (!allowedVersion) return false;
return true; return info.allowed && info.hasPermission;
} }

View file

@ -46,11 +46,10 @@ export function MetaPart(props: MetaPartProps) {
const { error, value, loading } = useAsync(async () => { const { error, value, loading } = useAsync(async () => {
const info = await extensionInfo(); const info = await extensionInfo();
const isValidExtension = const isValidExtension =
info?.success && isAllowedExtensionVersion(info.version); info?.success && isAllowedExtensionVersion(info.version) && info.allowed;
if (isValidExtension) { if (isValidExtension) {
if (!info.allowed || !info.hasPermission) if (!info.hasPermission) throw new Error("extension-no-permission");
throw new Error("extension-no-permission");
} }
// use api metadata or providers metadata // use api metadata or providers metadata
@ -117,13 +116,10 @@ export function MetaPart(props: MetaPartProps) {
<ErrorLayout> <ErrorLayout>
<ErrorContainer> <ErrorContainer>
<IconPill icon={Icons.WAND}> <IconPill icon={Icons.WAND}>
{t("player.metadata.failed.badge")} {t("player.metadata.extensionPermission.badge")}
</IconPill> </IconPill>
<Title>Configure the extension</Title> <Title>{t("player.metadata.extensionPermission.title")}</Title>
<Paragraph> <Paragraph>{t("player.metadata.extensionPermission.text")}</Paragraph>
You have the browser extension, but we need your permission to get
started using the extension.
</Paragraph>
<Button <Button
onClick={() => { onClick={() => {
sendPage({ sendPage({
@ -135,7 +131,7 @@ export function MetaPart(props: MetaPartProps) {
padding="md:px-12 p-2.5" padding="md:px-12 p-2.5"
className="mt-6" className="mt-6"
> >
Use extension {t("player.metadata.extensionPermission.button")}
</Button> </Button>
</ErrorContainer> </ErrorContainer>
</ErrorLayout> </ErrorLayout>
@ -146,12 +142,11 @@ export function MetaPart(props: MetaPartProps) {
return ( return (
<ErrorLayout> <ErrorLayout>
<ErrorContainer> <ErrorContainer>
<IconPill icon={Icons.DRAGON}>Removed</IconPill> <IconPill icon={Icons.DRAGON}>
<Title>Media has been removed</Title> {t("player.metadata.dmca.badge")}
<Paragraph> </IconPill>
This media is no longer available due to a takedown notice or <Title>{t("player.metadata.dmca.title")}</Title>
copyright claim. <Paragraph>{t("player.metadata.dmca.text")}</Paragraph>
</Paragraph>
<Button <Button
href="/" href="/"
theme="purple" theme="purple"