mirror of
https://git.nerdvpn.de/NerdVPN.de/invidious
synced 2026-02-14 22:51:42 +01:00
55 lines
2.1 KiB
Diff
55 lines
2.1 KiB
Diff
From 64e188d353d06356c3d198f1ac117ec84b52244b Mon Sep 17 00:00:00 2001
|
|
From: weidenwiesel <webmaster@nerdvpn.de>
|
|
Date: Mon, 13 Oct 2025 10:26:02 +0200
|
|
Subject: [PATCH 2/4] [Patch] 002 - limit DASH resolution
|
|
|
|
---
|
|
config/config.example.toml | 1 +
|
|
src/lib/helpers/config.ts | 4 ++++
|
|
src/routes/invidious_routes/dashManifest.ts | 4 +++-
|
|
3 files changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/config/config.example.toml b/config/config.example.toml
|
|
index 35ccd2d..20b6e4f 100644
|
|
--- a/config/config.example.toml
|
|
+++ b/config/config.example.toml
|
|
@@ -22,6 +22,7 @@
|
|
# verify_requests = false # env variable: SERVER_VERIFY_REQUESTS
|
|
# encrypt_query_params = false # env variable: SERVER_ENCRYPT_QUERY_PARAMS
|
|
# enable_metrics = false # env variable: SERVER_ENABLE_METRICS
|
|
+# max_dash_resolution = 1080
|
|
|
|
# [cache]
|
|
# enabled = true # env variable: CACHE_ENABLED
|
|
diff --git a/src/lib/helpers/config.ts b/src/lib/helpers/config.ts
|
|
index 1519ebf..ee3e0c3 100644
|
|
--- a/src/lib/helpers/config.ts
|
|
+++ b/src/lib/helpers/config.ts
|
|
@@ -57,6 +57,10 @@ export const ConfigSchema = z.object({
|
|
enable_metrics: z.boolean().default(
|
|
Deno.env.get("SERVER_ENABLE_METRICS") === "true" || false,
|
|
),
|
|
+ max_dash_resolution: z.number().default(
|
|
+ Number(Deno.env.get("SERVER_MAX_DASH_RESOLUTION")),
|
|
+ ),
|
|
+
|
|
}).strict().default({}),
|
|
cache: z.object({
|
|
enabled: z.boolean().default(
|
|
diff --git a/src/routes/invidious_routes/dashManifest.ts b/src/routes/invidious_routes/dashManifest.ts
|
|
index b582b40..b4ed64c 100644
|
|
--- a/src/routes/invidious_routes/dashManifest.ts
|
|
+++ b/src/routes/invidious_routes/dashManifest.ts
|
|
@@ -71,7 +71,7 @@ dashManifest.get("/:videoId", async (c) => {
|
|
videoInfo.streaming_data.adaptive_formats = videoInfo
|
|
.streaming_data.adaptive_formats
|
|
.filter((i) =>
|
|
- i.mime_type.includes("mp4")
|
|
+ i.mime_type.includes("mp4") && i.height <= config.server.max_dash_resolution
|
|
);
|
|
|
|
const player_response = videoInfo.page[0];
|
|
--
|
|
2.39.5
|
|
|