mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-14 09:45:06 +01:00
Merge pull request #504 from movie-web/add-disallowed-ids
Add disallowed ids
This commit is contained in:
commit
47eba8caa4
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "movie-web",
|
"name": "movie-web",
|
||||||
"version": "3.2.4",
|
"version": "3.2.5",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://movie-web.app",
|
"homepage": "https://movie-web.app",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -7,6 +7,7 @@ interface Config {
|
|||||||
TMDB_READ_API_KEY: string;
|
TMDB_READ_API_KEY: string;
|
||||||
CORS_PROXY_URL: string;
|
CORS_PROXY_URL: string;
|
||||||
NORMAL_ROUTER: boolean;
|
NORMAL_ROUTER: boolean;
|
||||||
|
DISALLOWED_IDS: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RuntimeConfig {
|
export interface RuntimeConfig {
|
||||||
@ -16,6 +17,7 @@ export interface RuntimeConfig {
|
|||||||
TMDB_READ_API_KEY: string;
|
TMDB_READ_API_KEY: string;
|
||||||
NORMAL_ROUTER: boolean;
|
NORMAL_ROUTER: boolean;
|
||||||
PROXY_URLS: string[];
|
PROXY_URLS: string[];
|
||||||
|
DISALLOWED_IDS: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const env: Record<keyof Config, undefined | string> = {
|
const env: Record<keyof Config, undefined | string> = {
|
||||||
@ -25,6 +27,7 @@ const env: Record<keyof Config, undefined | string> = {
|
|||||||
DISCORD_LINK: undefined,
|
DISCORD_LINK: undefined,
|
||||||
CORS_PROXY_URL: import.meta.env.VITE_CORS_PROXY_URL,
|
CORS_PROXY_URL: import.meta.env.VITE_CORS_PROXY_URL,
|
||||||
NORMAL_ROUTER: import.meta.env.VITE_NORMAL_ROUTER,
|
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)
|
// loads from different locations, in order: environment (VITE_{KEY}), window (public/config.js)
|
||||||
@ -61,5 +64,8 @@ export function conf(): RuntimeConfig {
|
|||||||
.split(",")
|
.split(",")
|
||||||
.map((v) => v.trim()),
|
.map((v) => v.trim()),
|
||||||
NORMAL_ROUTER: getKey("NORMAL_ROUTER", "false") === "true",
|
NORMAL_ROUTER: getKey("NORMAL_ROUTER", "false") === "true",
|
||||||
|
DISALLOWED_IDS: getKey("DISALLOWED_IDS", "")
|
||||||
|
.split(",")
|
||||||
|
.map((v) => v.trim()), // Should be comma-seperated and contain the media type and ID, formatted like so: movie-753342,movie-753342,movie-753342
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,12 @@ import {
|
|||||||
} from "@/backend/metadata/types/mw";
|
} from "@/backend/metadata/types/mw";
|
||||||
import { IconPatch } from "@/components/buttons/IconPatch";
|
import { IconPatch } from "@/components/buttons/IconPatch";
|
||||||
import { Icons } from "@/components/Icon";
|
import { Icons } from "@/components/Icon";
|
||||||
|
import { ErrorMessage } from "@/components/layout/ErrorBoundary";
|
||||||
import { Loading } from "@/components/layout/Loading";
|
import { Loading } from "@/components/layout/Loading";
|
||||||
import { useGoBack } from "@/hooks/useGoBack";
|
import { useGoBack } from "@/hooks/useGoBack";
|
||||||
import { useLoading } from "@/hooks/useLoading";
|
import { useLoading } from "@/hooks/useLoading";
|
||||||
import { SelectedMediaData, useScrape } from "@/hooks/useScrape";
|
import { SelectedMediaData, useScrape } from "@/hooks/useScrape";
|
||||||
|
import { conf } from "@/setup/config";
|
||||||
import { useWatchedItem } from "@/state/watched";
|
import { useWatchedItem } from "@/state/watched";
|
||||||
import { MetaController } from "@/video/components/controllers/MetaController";
|
import { MetaController } from "@/video/components/controllers/MetaController";
|
||||||
import { ProgressListenerController } from "@/video/components/controllers/ProgressListenerController";
|
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 (
|
||||||
|
<div className="relative flex flex-1 items-center justify-center">
|
||||||
|
<Helmet>
|
||||||
|
<title>{t("videoPlayer.got")}</title>
|
||||||
|
</Helmet>
|
||||||
|
<div className="absolute inset-x-0 top-0 px-8 py-6">
|
||||||
|
<VideoPlayerHeader onClick={props.onGoBack} />
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col items-center">
|
||||||
|
<ErrorMessage
|
||||||
|
error={{
|
||||||
|
name: "Media not allowed",
|
||||||
|
description:
|
||||||
|
"this media is no longer available due to a takedown notice or copyright claim",
|
||||||
|
path: "",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
interface MediaViewScrapingProps {
|
interface MediaViewScrapingProps {
|
||||||
onStream(stream: MWStream): void;
|
onStream(stream: MWStream): void;
|
||||||
onGoBack(): void;
|
onGoBack(): void;
|
||||||
@ -240,6 +267,14 @@ export function MediaView() {
|
|||||||
});
|
});
|
||||||
}, [exec, history, params]);
|
}, [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 <MediaVIewNotAllowed onGoBack={goBack} />;
|
||||||
|
|
||||||
if (loading) return <MediaViewLoading onGoBack={goBack} />;
|
if (loading) return <MediaViewLoading onGoBack={goBack} />;
|
||||||
if (error) return <MediaFetchErrorView />;
|
if (error) return <MediaFetchErrorView />;
|
||||||
if (!meta || !selected)
|
if (!meta || !selected)
|
||||||
|
Loading…
Reference in New Issue
Block a user