mirror of
https://github.com/sussy-code/smov.git
synced 2025-01-01 16:37:39 +01:00
Fix vidsrc support and other providers (merge fix#309)
This commit is contained in:
commit
ed1d7418d0
8 changed files with 96 additions and 4 deletions
32
Dockerfile
32
Dockerfile
|
@ -8,6 +8,38 @@ COPY package.json ./
|
||||||
COPY pnpm-lock.yaml ./
|
COPY pnpm-lock.yaml ./
|
||||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
ARG PWA_ENABLED="false"
|
||||||
|
ARG GA_ID
|
||||||
|
ARG APP_DOMAIN
|
||||||
|
ARG OPENSEARCH_ENABLED="false"
|
||||||
|
ARG TMDB_READ_API_KEY
|
||||||
|
ARG CORS_PROXY_URL
|
||||||
|
ARG DMCA_EMAIL
|
||||||
|
ARG NORMAL_ROUTER="false"
|
||||||
|
ARG BACKEND_URL
|
||||||
|
ARG HAS_ONBOARDING="false"
|
||||||
|
ARG ONBOARDING_CHROME_EXTENSION_INSTALL_LINK
|
||||||
|
ARG ONBOARDING_PROXY_INSTALL_LINK
|
||||||
|
ARG DISALLOWED_IDS
|
||||||
|
ARG CDN_REPLACEMENTS
|
||||||
|
ARG TURNSTILE_KEY
|
||||||
|
|
||||||
|
ENV VITE_PWA_ENABLED=${PWA_ENABLED}
|
||||||
|
ENV VITE_GA_ID=${GA_ID}
|
||||||
|
ENV VITE_APP_DOMAIN=${APP_DOMAIN}
|
||||||
|
ENV VITE_OPENSEARCH_ENABLED=${OPENSEARCH_ENABLED}
|
||||||
|
ENV VITE_TMDB_READ_API_KEY=${TMDB_READ_API_KEY}
|
||||||
|
ENV VITE_CORS_PROXY_URL=${CORS_PROXY_URL}
|
||||||
|
ENV VITE_DMCA_EMAIL=${DMCA_EMAIL}
|
||||||
|
ENV VITE_NORMAL_ROUTER=${NORMAL_ROUTER}
|
||||||
|
ENV VITE_BACKEND_URL=${BACKEND_URL}
|
||||||
|
ENV VITE_HAS_ONBOARDING=${HAS_ONBOARDING}
|
||||||
|
ENV VITE_ONBOARDING_CHROME_EXTENSION_INSTALL_LINK=${ONBOARDING_CHROME_EXTENSION_INSTALL_LINK}
|
||||||
|
ENV VITE_ONBOARDING_PROXY_INSTALL_LINK=${ONBOARDING_PROXY_INSTALL_LINK}
|
||||||
|
ENV VITE_DISALLOWED_IDS=${DISALLOWED_IDS}
|
||||||
|
ENV VITE_CDN_REPLACEMENTS=${CDN_REPLACEMENTS}
|
||||||
|
ENV VITE_TURNSTILE_KEY=${TURNSTILE_KEY}
|
||||||
|
|
||||||
COPY . ./
|
COPY . ./
|
||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
|
|
26
docker-compose.yaml
Normal file
26
docker-compose.yaml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
movieweb:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
# args:
|
||||||
|
# PWA_ENABLED: "false"
|
||||||
|
# GA_ID: ""
|
||||||
|
# APP_DOMAIN: ""
|
||||||
|
# OPENSEARCH_ENABLED: "false"
|
||||||
|
# TMDB_READ_API_KEY: ""
|
||||||
|
# CORS_PROXY_URL: ""
|
||||||
|
# DMCA_EMAIL: ""
|
||||||
|
# NORMAL_ROUTER: "false"
|
||||||
|
# BACKEND_URL: ""
|
||||||
|
# HAS_ONBOARDING: "false"
|
||||||
|
# ONBOARDING_CHROME_EXTENSION_INSTALL_LINK: ""
|
||||||
|
# ONBOARDING_PROXY_INSTALL_LINK: ""
|
||||||
|
# DISALLOWED_IDS: ""
|
||||||
|
# CDN_REPLACEMENTS: ""
|
||||||
|
# TURNSTILE_KEY: ""
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
restart: unless-stopped
|
|
@ -7378,6 +7378,7 @@ packages:
|
||||||
|
|
||||||
/workbox-google-analytics@7.0.0:
|
/workbox-google-analytics@7.0.0:
|
||||||
resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==}
|
resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==}
|
||||||
|
deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained
|
||||||
dependencies:
|
dependencies:
|
||||||
workbox-background-sync: 7.0.0
|
workbox-background-sync: 7.0.0
|
||||||
workbox-core: 7.0.0
|
workbox-core: 7.0.0
|
||||||
|
|
|
@ -6,6 +6,11 @@ import {
|
||||||
import { isAllowedExtensionVersion } from "@/backend/extension/compatibility";
|
import { isAllowedExtensionVersion } from "@/backend/extension/compatibility";
|
||||||
import { ExtensionMakeRequestResponse } from "@/backend/extension/plasmo";
|
import { ExtensionMakeRequestResponse } from "@/backend/extension/plasmo";
|
||||||
|
|
||||||
|
export const RULE_IDS = {
|
||||||
|
PREPARE_STREAM: 1,
|
||||||
|
SET_DOMAINS_HLS: 2,
|
||||||
|
};
|
||||||
|
|
||||||
// for some reason, about 500 ms is needed after
|
// for some reason, about 500 ms is needed after
|
||||||
// page load before the extension starts responding properly
|
// page load before the extension starts responding properly
|
||||||
const isExtensionReady = new Promise<void>((resolve) => {
|
const isExtensionReady = new Promise<void>((resolve) => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Stream } from "@movie-web/providers";
|
import { Stream } from "@movie-web/providers";
|
||||||
|
|
||||||
import { setDomainRule } from "@/backend/extension/messaging";
|
import { RULE_IDS, setDomainRule } from "@/backend/extension/messaging";
|
||||||
|
|
||||||
function extractDomain(url: string): string | null {
|
function extractDomain(url: string): string | null {
|
||||||
try {
|
try {
|
||||||
|
@ -36,7 +36,7 @@ function buildHeadersFromStream(stream: Stream): Record<string, string> {
|
||||||
|
|
||||||
export async function prepareStream(stream: Stream) {
|
export async function prepareStream(stream: Stream) {
|
||||||
await setDomainRule({
|
await setDomainRule({
|
||||||
ruleId: 1,
|
ruleId: RULE_IDS.PREPARE_STREAM,
|
||||||
targetDomains: extractDomainsFromStream(stream),
|
targetDomains: extractDomainsFromStream(stream),
|
||||||
requestHeaders: buildHeadersFromStream(stream),
|
requestHeaders: buildHeadersFromStream(stream),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
import fscreen from "fscreen";
|
import fscreen from "fscreen";
|
||||||
import Hls, { Level } from "hls.js";
|
import Hls, { Level } from "hls.js";
|
||||||
|
|
||||||
|
import {
|
||||||
|
RULE_IDS,
|
||||||
|
isExtensionActiveCached,
|
||||||
|
setDomainRule,
|
||||||
|
} from "@/backend/extension/messaging";
|
||||||
import {
|
import {
|
||||||
DisplayInterface,
|
DisplayInterface,
|
||||||
DisplayInterfaceEvents,
|
DisplayInterfaceEvents,
|
||||||
|
@ -31,8 +36,8 @@ const levelConversionMap: Record<number, SourceQuality> = {
|
||||||
480: "480",
|
480: "480",
|
||||||
};
|
};
|
||||||
|
|
||||||
function hlsLevelToQuality(level: Level): SourceQuality | null {
|
function hlsLevelToQuality(level?: Level): SourceQuality | null {
|
||||||
return levelConversionMap[level.height] ?? null;
|
return levelConversionMap[level?.height ?? 0] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function qualityToHlsLevel(quality: SourceQuality): number | null {
|
function qualityToHlsLevel(quality: SourceQuality): number | null {
|
||||||
|
@ -144,6 +149,24 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
||||||
if (!hls) return;
|
if (!hls) return;
|
||||||
reportLevels();
|
reportLevels();
|
||||||
setupQualityForHls();
|
setupQualityForHls();
|
||||||
|
|
||||||
|
if (isExtensionActiveCached()) {
|
||||||
|
hls.on(Hls.Events.LEVEL_LOADED, async (_, data) => {
|
||||||
|
const chunkUrlsDomains = data.details.fragments.map(
|
||||||
|
(v) => new URL(v.url).hostname,
|
||||||
|
);
|
||||||
|
const chunkUrls = [...new Set(chunkUrlsDomains)];
|
||||||
|
|
||||||
|
await setDomainRule({
|
||||||
|
ruleId: RULE_IDS.SET_DOMAINS_HLS,
|
||||||
|
targetDomains: chunkUrls,
|
||||||
|
requestHeaders: {
|
||||||
|
...src.preferredHeaders,
|
||||||
|
...src.headers,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
hls.on(Hls.Events.LEVEL_SWITCHED, () => {
|
hls.on(Hls.Events.LEVEL_SWITCHED, () => {
|
||||||
if (!hls) return;
|
if (!hls) return;
|
||||||
|
|
|
@ -28,6 +28,7 @@ export function convertRunoutputToSource(out: {
|
||||||
return {
|
return {
|
||||||
type: "hls",
|
type: "hls",
|
||||||
url: out.stream.playlist,
|
url: out.stream.playlist,
|
||||||
|
headers: out.stream.headers,
|
||||||
preferredHeaders: out.stream.preferredHeaders,
|
preferredHeaders: out.stream.preferredHeaders,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -50,6 +51,7 @@ export function convertRunoutputToSource(out: {
|
||||||
return {
|
return {
|
||||||
type: "file",
|
type: "file",
|
||||||
qualities,
|
qualities,
|
||||||
|
headers: out.stream.headers,
|
||||||
preferredHeaders: out.stream.preferredHeaders,
|
preferredHeaders: out.stream.preferredHeaders,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ export type SourceFileStream = {
|
||||||
export type LoadableSource = {
|
export type LoadableSource = {
|
||||||
type: StreamType;
|
type: StreamType;
|
||||||
url: string;
|
url: string;
|
||||||
|
headers?: Stream["headers"];
|
||||||
preferredHeaders?: Stream["preferredHeaders"];
|
preferredHeaders?: Stream["preferredHeaders"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,11 +22,13 @@ export type SourceSliceSource =
|
||||||
| {
|
| {
|
||||||
type: "file";
|
type: "file";
|
||||||
qualities: Partial<Record<SourceQuality, SourceFileStream>>;
|
qualities: Partial<Record<SourceQuality, SourceFileStream>>;
|
||||||
|
headers?: Stream["headers"];
|
||||||
preferredHeaders?: Stream["preferredHeaders"];
|
preferredHeaders?: Stream["preferredHeaders"];
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "hls";
|
type: "hls";
|
||||||
url: string;
|
url: string;
|
||||||
|
headers?: Stream["headers"];
|
||||||
preferredHeaders?: Stream["preferredHeaders"];
|
preferredHeaders?: Stream["preferredHeaders"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue