mirror of
https://github.com/movie-web/movie-web.git
synced 2025-09-13 15:43:24 +00:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
47eba8caa4 | ||
|
1dc957b56a | ||
|
e653c72d87 | ||
|
c39d61cf53 | ||
|
b14a73378f | ||
|
43d1e290fc | ||
|
1f6318360e | ||
|
791299dd43 | ||
|
2c92bbf94e | ||
|
e3569c7ed7 | ||
|
196a805d32 | ||
|
94d6d7b37e | ||
|
fde5f0c82e | ||
|
bb449d6dfb |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "movie-web",
|
||||
"version": "3.2.2",
|
||||
"version": "3.2.5",
|
||||
"private": true,
|
||||
"homepage": "https://movie-web.app",
|
||||
"dependencies": {
|
||||
|
@@ -29,6 +29,32 @@ function isJSON(json: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function extractKey(script: string): [number, number][] | null {
|
||||
const startOfSwitch = script.lastIndexOf("switch");
|
||||
const endOfCases = script.indexOf("partKeyStartPosition");
|
||||
const switchBody = script.slice(startOfSwitch, endOfCases);
|
||||
|
||||
const nums: [number, number][] = [];
|
||||
const matches = switchBody.matchAll(
|
||||
/:[a-zA-Z0-9]+=([a-zA-Z0-9]+),[a-zA-Z0-9]+=([a-zA-Z0-9]+);/g
|
||||
);
|
||||
for (const match of matches) {
|
||||
const innerNumbers: number[] = [];
|
||||
for (const varMatch of [match[1], match[2]]) {
|
||||
const regex = new RegExp(`${varMatch}=0x([a-zA-Z0-9]+)`, "g");
|
||||
const varMatches = [...script.matchAll(regex)];
|
||||
const lastMatch = varMatches[varMatches.length - 1];
|
||||
if (!lastMatch) return null;
|
||||
const number = parseInt(lastMatch[1], 16);
|
||||
innerNumbers.push(number);
|
||||
}
|
||||
|
||||
nums.push([innerNumbers[0], innerNumbers[1]]);
|
||||
}
|
||||
|
||||
return nums;
|
||||
}
|
||||
|
||||
registerEmbedScraper({
|
||||
id: "upcloud",
|
||||
displayName: "UpCloud",
|
||||
@@ -54,23 +80,31 @@ registerEmbedScraper({
|
||||
let sources: { file: string; type: string } | null = null;
|
||||
|
||||
if (!isJSON(streamRes.sources)) {
|
||||
const decryptionKey = JSON.parse(
|
||||
await proxiedFetch<string>(
|
||||
`https://raw.githubusercontent.com/enimax-anime/key/e4/key.txt`
|
||||
)
|
||||
) as [number, number][];
|
||||
const scriptJs = await proxiedFetch<string>(
|
||||
`https://rabbitstream.net/js/player/prod/e4-player.min.js`,
|
||||
{
|
||||
responseType: "text" as any,
|
||||
}
|
||||
);
|
||||
const decryptionKey = extractKey(scriptJs);
|
||||
if (!decryptionKey) throw new Error("Key extraction failed");
|
||||
|
||||
let extractedKey = "";
|
||||
const sourcesArray = streamRes.sources.split("");
|
||||
for (const index of decryptionKey) {
|
||||
for (let i: number = index[0]; i < index[1]; i += 1) {
|
||||
extractedKey += streamRes.sources[i];
|
||||
sourcesArray[i] = "";
|
||||
}
|
||||
}
|
||||
let strippedSources = streamRes.sources;
|
||||
let totalledOffset = 0;
|
||||
decryptionKey.forEach(([a, b]) => {
|
||||
const start = a + totalledOffset;
|
||||
const end = start + b;
|
||||
extractedKey += streamRes.sources.slice(start, end);
|
||||
strippedSources = strippedSources.replace(
|
||||
streamRes.sources.substring(start, end),
|
||||
""
|
||||
);
|
||||
totalledOffset += b;
|
||||
});
|
||||
|
||||
const decryptedStream = AES.decrypt(
|
||||
sourcesArray.join(""),
|
||||
strippedSources,
|
||||
extractedKey
|
||||
).toString(enc.Utf8);
|
||||
const parsedStream = JSON.parse(decryptedStream)[0];
|
||||
|
@@ -51,7 +51,7 @@ function MediaCardContent({
|
||||
>
|
||||
<div
|
||||
className={[
|
||||
"relative mb-4 aspect-[2/3] w-full overflow-hidden rounded-xl bg-denim-500 bg-cover bg-center transition-[border-radius] duration-100",
|
||||
"relative mb-4 w-full overflow-hidden rounded-xl bg-denim-500 bg-cover bg-center pb-[150%] transition-[border-radius] duration-100",
|
||||
closable ? "" : "group-hover:rounded-lg",
|
||||
].join(" ")}
|
||||
style={{
|
||||
|
@@ -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<keyof Config, undefined | string> = {
|
||||
@@ -25,6 +27,7 @@ const env: Record<keyof Config, undefined | string> = {
|
||||
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()), // 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";
|
||||
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 (
|
||||
<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 {
|
||||
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 <MediaVIewNotAllowed onGoBack={goBack} />;
|
||||
|
||||
if (loading) return <MediaViewLoading onGoBack={goBack} />;
|
||||
if (error) return <MediaFetchErrorView />;
|
||||
if (!meta || !selected)
|
||||
|
Reference in New Issue
Block a user