From 41b7de5f2fb9fb54a311d7329a08596eb40573fb Mon Sep 17 00:00:00 2001 From: weidenwiesel Date: Mon, 13 Oct 2025 10:37:35 +0200 Subject: [PATCH] Update companion patches --- .../0001-disable-logging-option.patch | 54 +++++++++++++++++++ ...patch => 0002-limit-DASH-resolution.patch} | 26 ++++++--- ...dd-retry-option-on-innertube-errors.patch} | 19 +++---- ...tch => 0004-fix-video-format-checks.patch} | 12 +++++ 4 files changed, 96 insertions(+), 15 deletions(-) create mode 100644 patches/companion/0001-disable-logging-option.patch rename patches/companion/{0001-feat-add-resolution-limit-on-DASH-streams-to-save-ba.patch => 0002-limit-DASH-resolution.patch} (70%) rename patches/companion/{0004-add-proxy-retries-on-innertube-error.patch => 0003-add-retry-option-on-innertube-errors.patch} (88%) rename patches/companion/{0009-fix-check-for-formats.url-since-most-videos-will-hav.patch => 0004-fix-video-format-checks.patch} (75%) diff --git a/patches/companion/0001-disable-logging-option.patch b/patches/companion/0001-disable-logging-option.patch new file mode 100644 index 0000000..ed7ede7 --- /dev/null +++ b/patches/companion/0001-disable-logging-option.patch @@ -0,0 +1,54 @@ +From 1240c0752c3d9c56fc7422a5a692244227a84a5e Mon Sep 17 00:00:00 2001 +From: weidenwiesel +Date: Mon, 13 Oct 2025 10:25:16 +0200 +Subject: [PATCH 1/4] [Patch] 001 - disable logging option + +--- + src/lib/helpers/config.ts | 3 +++ + src/routes/index.ts | 9 +++++++-- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/lib/helpers/config.ts b/src/lib/helpers/config.ts +index 77df3ee..1519ebf 100644 +--- a/src/lib/helpers/config.ts ++++ b/src/lib/helpers/config.ts +@@ -3,6 +3,9 @@ import { parse } from "@std/toml"; + + export const ConfigSchema = z.object({ + server: z.object({ ++ disable_logs: z.boolean().default( ++ Deno.env.get("SERVER_DISABLE_LOGS") === "true" || false, ++ ), + port: z.number().default(Number(Deno.env.get("PORT")) || 8282), + host: z.string().default(Deno.env.get("HOST") || "127.0.0.1"), + use_unix_socket: z.boolean().default( +diff --git a/src/routes/index.ts b/src/routes/index.ts +index 84a2ad6..a36421d 100644 +--- a/src/routes/index.ts ++++ b/src/routes/index.ts +@@ -12,6 +12,10 @@ import type { Config } from "../lib/helpers/config.ts"; + import metrics from "./metrics.ts"; + import health from "./health.ts"; + ++export const customLogger = () => { ++ return; ++}; ++ + export const companionRoutes = ( + app: Hono, + config: Config, +@@ -20,8 +24,9 @@ export const companionRoutes = ( + message = message.replace("//localhost/", "/"); + console.log(message, ...rest); + }; +- +- if (config.server.use_unix_socket) { ++ if (config.server.disable_logs) { ++ app.use("*", logger(customLogger)); ++ } else if (config.server.use_unix_socket) { + app.use("*", logger(loggerUnixSocket)); + } else { + app.use("*", logger()); +-- +2.39.5 + diff --git a/patches/companion/0001-feat-add-resolution-limit-on-DASH-streams-to-save-ba.patch b/patches/companion/0002-limit-DASH-resolution.patch similarity index 70% rename from patches/companion/0001-feat-add-resolution-limit-on-DASH-streams-to-save-ba.patch rename to patches/companion/0002-limit-DASH-resolution.patch index 4d6976e..5476795 100644 --- a/patches/companion/0001-feat-add-resolution-limit-on-DASH-streams-to-save-ba.patch +++ b/patches/companion/0002-limit-DASH-resolution.patch @@ -1,8 +1,19 @@ +From 64e188d353d06356c3d198f1ac117ec84b52244b Mon Sep 17 00:00:00 2001 +From: weidenwiesel +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 2a49d0f..d711ca0 100644 +index 35ccd2d..20b6e4f 100644 --- a/config/config.example.toml +++ b/config/config.example.toml -@@ -17,6 +17,7 @@ +@@ -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 @@ -11,10 +22,10 @@ index 2a49d0f..d711ca0 100644 # [cache] # enabled = true # env variable: CACHE_ENABLED diff --git a/src/lib/helpers/config.ts b/src/lib/helpers/config.ts -index 6ec7112..8dcbe10 100644 +index 1519ebf..ee3e0c3 100644 --- a/src/lib/helpers/config.ts +++ b/src/lib/helpers/config.ts -@@ -17,6 +17,10 @@ export const ConfigSchema = z.object({ +@@ -57,6 +57,10 @@ export const ConfigSchema = z.object({ enable_metrics: z.boolean().default( Deno.env.get("SERVER_ENABLE_METRICS") === "true" || false, ), @@ -26,10 +37,10 @@ index 6ec7112..8dcbe10 100644 cache: z.object({ enabled: z.boolean().default( diff --git a/src/routes/invidious_routes/dashManifest.ts b/src/routes/invidious_routes/dashManifest.ts -index 059b4ed..4e10eb8 100644 +index b582b40..b4ed64c 100644 --- a/src/routes/invidious_routes/dashManifest.ts +++ b/src/routes/invidious_routes/dashManifest.ts -@@ -55,7 +55,9 @@ dashManifest.get("/:videoId", async (c) => { +@@ -62,7 +62,9 @@ dashManifest.get("/:videoId", async (c) => { videoInfo.streaming_data.adaptive_formats = videoInfo .streaming_data.adaptive_formats .filter((i) => @@ -40,3 +51,6 @@ index 059b4ed..4e10eb8 100644 ); const player_response = videoInfo.page[0]; +-- +2.39.5 + diff --git a/patches/companion/0004-add-proxy-retries-on-innertube-error.patch b/patches/companion/0003-add-retry-option-on-innertube-errors.patch similarity index 88% rename from patches/companion/0004-add-proxy-retries-on-innertube-error.patch rename to patches/companion/0003-add-retry-option-on-innertube-errors.patch index 1bea111..49b10d2 100644 --- a/patches/companion/0004-add-proxy-retries-on-innertube-error.patch +++ b/patches/companion/0003-add-retry-option-on-innertube-errors.patch @@ -1,7 +1,7 @@ -From 8d35596d51350b959d724638fb703661992e1cc4 Mon Sep 17 00:00:00 2001 -From: Fijxu -Date: Tue, 25 Mar 2025 00:04:47 -0300 -Subject: [PATCH 04/12] add proxy retries on innertube error +From 6953eed8bd7dfb68244947dbdd274a23ad501743 Mon Sep 17 00:00:00 2001 +From: weidenwiesel +Date: Mon, 13 Oct 2025 10:26:32 +0200 +Subject: [PATCH 3/4] [Patch] 003 - add retry option on innertube errors --- config/config.example.toml | 1 + @@ -10,10 +10,10 @@ Subject: [PATCH 04/12] add proxy retries on innertube error 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/config/config.example.toml b/config/config.example.toml -index 84c4f02..2112564 100644 +index 20b6e4f..8965132 100644 --- a/config/config.example.toml +++ b/config/config.example.toml -@@ -33,6 +33,7 @@ +@@ -38,6 +38,7 @@ # ump = false # env variable: NETWORKING_VIDEOPLAYBACK_UMP # # size of chunks to request from google servers for rate limiting reductions # video_fetch_chunk_size_mb = 5 # env variable: NETWORKING_VIDEOPLAYBACK_VIDEO_FETCH_CHUNK_SIZE_MB @@ -22,10 +22,10 @@ index 84c4f02..2112564 100644 ### # Network call timeouts when talking to YouTube. diff --git a/src/lib/helpers/config.ts b/src/lib/helpers/config.ts -index 3990214..01dda24 100644 +index ee3e0c3..2b28cfc 100644 --- a/src/lib/helpers/config.ts +++ b/src/lib/helpers/config.ts -@@ -70,6 +70,9 @@ export const ConfigSchema = z.object({ +@@ -111,6 +111,9 @@ export const ConfigSchema = z.object({ ) || 5, ), }).strict().default({}), @@ -75,4 +75,5 @@ index 6565d06..d809c09 100644 if (videoData.playabilityStatus.status === "ERROR") { -- -2.49.0 +2.39.5 + diff --git a/patches/companion/0009-fix-check-for-formats.url-since-most-videos-will-hav.patch b/patches/companion/0004-fix-video-format-checks.patch similarity index 75% rename from patches/companion/0009-fix-check-for-formats.url-since-most-videos-will-hav.patch rename to patches/companion/0004-fix-video-format-checks.patch index d4c5211..14f8805 100644 --- a/patches/companion/0009-fix-check-for-formats.url-since-most-videos-will-hav.patch +++ b/patches/companion/0004-fix-video-format-checks.patch @@ -1,3 +1,12 @@ +From 338fa57cf6ecad816a0b5143055f724788b814ec Mon Sep 17 00:00:00 2001 +From: weidenwiesel +Date: Mon, 13 Oct 2025 10:27:08 +0200 +Subject: [PATCH 4/4] [Patch] 004 - fix video format checks + +--- + src/lib/jobs/potoken.ts | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + diff --git a/src/lib/jobs/potoken.ts b/src/lib/jobs/potoken.ts index 5673c78..bbac16b 100644 --- a/src/lib/jobs/potoken.ts @@ -19,3 +28,6 @@ index 5673c78..bbac16b 100644 method: "HEAD", }); if (result.status !== 200) { +-- +2.39.5 +