diff --git a/config/default.toml b/config/default.toml index a4f09aa..2460629 100644 --- a/config/default.toml +++ b/config/default.toml @@ -5,6 +5,7 @@ host = "127.0.0.1" secret_key = "CHANGE_ME" base_url = "http://localhost:8282" verify_requests = false +# max_dash_resolution = 1080 [cache] enabled = true diff --git a/src/routes/invidious_routes/dashManifest.ts b/src/routes/invidious_routes/dashManifest.ts index 86a7583..6099c59 100644 --- a/src/routes/invidious_routes/dashManifest.ts +++ b/src/routes/invidious_routes/dashManifest.ts @@ -24,6 +24,8 @@ dashManifest.get("/:videoId", async (c) => { Record >; + const maxDashResolution = Deno.env.get("SERVER_MAX_DASH_RESOLUTION") || konfigStore.get("server.max_dash_resolution") as number; + if (konfigStore.get("server.verify_requests") && check == undefined) { throw new HTTPException(400, { res: new Response("No check ID."), @@ -67,7 +69,12 @@ dashManifest.get("/:videoId", async (c) => { ).includes("av01") ) { if (i.mime_type.includes("av01")) { - return true; + // @ts-ignore 'i.height' is possibly 'undefined'. + if (i.height > maxDashResolution) { + return false; + } else { + return true; + } } else { return false; }