From 43d1e290fcc1d0ff40fd54a0668adc03ba447d8d Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Fri, 1 Dec 2023 14:34:52 +0100 Subject: [PATCH 1/5] Add DISALLOWED_IDS to conf --- src/setup/config.ts | 6 ++++++ src/views/media/MediaView.tsx | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/setup/config.ts b/src/setup/config.ts index a7d9067b..534dcce2 100644 --- a/src/setup/config.ts +++ b/src/setup/config.ts @@ -7,6 +7,7 @@ interface Config { TMDB_READ_API_KEY: string; CORS_PROXY_URL: string; NORMAL_ROUTER: boolean; + DISALLOWED_IDS: string; } export interface RuntimeConfig { @@ -16,6 +17,7 @@ export interface RuntimeConfig { TMDB_READ_API_KEY: string; NORMAL_ROUTER: boolean; PROXY_URLS: string[]; + DISALLOWED_IDS: string[]; } const env: Record = { @@ -25,6 +27,7 @@ const env: Record = { DISCORD_LINK: undefined, CORS_PROXY_URL: import.meta.env.VITE_CORS_PROXY_URL, NORMAL_ROUTER: import.meta.env.VITE_NORMAL_ROUTER, + DISALLOWED_IDS: import.meta.env.VITE_DISALLOWED_IDS, }; // loads from different locations, in order: environment (VITE_{KEY}), window (public/config.js) @@ -61,5 +64,8 @@ export function conf(): RuntimeConfig { .split(",") .map((v) => v.trim()), NORMAL_ROUTER: getKey("NORMAL_ROUTER", "false") === "true", + DISALLOWED_IDS: getKey("DISALLOWED_IDS", "") + .split(",") + .map((v) => v.trim()), }; } diff --git a/src/views/media/MediaView.tsx b/src/views/media/MediaView.tsx index 6e1659a6..5753ca28 100644 --- a/src/views/media/MediaView.tsx +++ b/src/views/media/MediaView.tsx @@ -15,10 +15,12 @@ import { } from "@/backend/metadata/types/mw"; import { IconPatch } from "@/components/buttons/IconPatch"; import { Icons } from "@/components/Icon"; +import { ErrorMessage } from "@/components/layout/ErrorBoundary"; import { Loading } from "@/components/layout/Loading"; import { useGoBack } from "@/hooks/useGoBack"; import { useLoading } from "@/hooks/useLoading"; import { SelectedMediaData, useScrape } from "@/hooks/useScrape"; +import { conf } from "@/setup/config"; import { useWatchedItem } from "@/state/watched"; import { MetaController } from "@/video/components/controllers/MetaController"; import { ProgressListenerController } from "@/video/components/controllers/ProgressListenerController"; @@ -53,6 +55,31 @@ function MediaViewLoading(props: { onGoBack(): void }) { ); } +function MediaVIewNotAllowed(props: { onGoBack(): void }) { + const { t } = useTranslation(); + + return ( +
+ + {t("videoPlayer.got")} + +
+ +
+
+ +
+
+ ); +} + interface MediaViewScrapingProps { onStream(stream: MWStream): void; onGoBack(): void; @@ -240,6 +267,14 @@ export function MediaView() { }); }, [exec, history, params]); + const disallowedEntries = conf().DISALLOWED_IDS.map((id) => id.split("-")); + if ( + disallowedEntries.find( + (entry) => meta?.tmdbId === entry[1] && meta?.meta?.type === entry[0] + ) + ) + return ; + if (loading) return ; if (error) return ; if (!meta || !selected) From b14a73378f16d7750c8756281c50204936f13a4a Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Fri, 1 Dec 2023 14:35:12 +0100 Subject: [PATCH 2/5] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 11e6eaea..2390656b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "movie-web", - "version": "3.2.4", + "version": "3.2.5", "private": true, "homepage": "https://movie-web.app", "dependencies": { From c39d61cf538a768bad150accf9c977320fb0c13b Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Fri, 1 Dec 2023 14:39:04 +0100 Subject: [PATCH 3/5] Change text --- src/views/media/MediaView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/media/MediaView.tsx b/src/views/media/MediaView.tsx index 5753ca28..82c6f594 100644 --- a/src/views/media/MediaView.tsx +++ b/src/views/media/MediaView.tsx @@ -71,7 +71,7 @@ function MediaVIewNotAllowed(props: { onGoBack(): void }) { error={{ name: "Media not allowed", description: - "this movie is disabled on movie-web and will not be added.", + "this media is no longer availabe due to a takedown notice or copyright claim", path: "", }} /> From e653c72d8787690cdc2425f77f6703eb94a46c03 Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Fri, 1 Dec 2023 14:41:25 +0100 Subject: [PATCH 4/5] Add comment --- src/setup/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setup/config.ts b/src/setup/config.ts index 534dcce2..b4fd63d5 100644 --- a/src/setup/config.ts +++ b/src/setup/config.ts @@ -66,6 +66,6 @@ export function conf(): RuntimeConfig { NORMAL_ROUTER: getKey("NORMAL_ROUTER", "false") === "true", DISALLOWED_IDS: getKey("DISALLOWED_IDS", "") .split(",") - .map((v) => v.trim()), + .map((v) => v.trim()), // Should be comma-seperated and contain the media type and ID, formatted like so: movie-753342,movie-753342,movie-753342 }; } From 1dc957b56a04f584ca573a1f7f790cd44c1626d6 Mon Sep 17 00:00:00 2001 From: Jip Fr Date: Fri, 1 Dec 2023 14:41:46 +0100 Subject: [PATCH 5/5] Fix typo --- src/views/media/MediaView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/media/MediaView.tsx b/src/views/media/MediaView.tsx index 82c6f594..1575ee73 100644 --- a/src/views/media/MediaView.tsx +++ b/src/views/media/MediaView.tsx @@ -71,7 +71,7 @@ function MediaVIewNotAllowed(props: { onGoBack(): void }) { error={{ name: "Media not allowed", description: - "this media is no longer availabe due to a takedown notice or copyright claim", + "this media is no longer available due to a takedown notice or copyright claim", path: "", }} />