All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m45s
72 lines
2.9 KiB
Diff
72 lines
2.9 KiB
Diff
From 2bb84882f1b4ff22f9c7458ff74137fdc3505347 Mon Sep 17 00:00:00 2001
|
|
From: Fijxu <fijxu@nadeko.net>
|
|
Date: Mon, 24 Mar 2025 18:44:10 -0300
|
|
Subject: [PATCH 02/16] feat: add support for an external videoplayback proxy
|
|
|
|
---
|
|
config/config.example.toml | 1 +
|
|
src/lib/helpers/config.ts | 3 +++
|
|
src/routes/invidious_routes/dashManifest.ts | 6 ++++--
|
|
src/routes/invidious_routes/latestVersion.ts | 3 ++-
|
|
4 files changed, 10 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/config/config.example.toml b/config/config.example.toml
|
|
index cce4704..4aec8e9 100644
|
|
--- a/config/config.example.toml
|
|
+++ b/config/config.example.toml
|
|
@@ -28,6 +28,7 @@
|
|
# #proxy = "" # env variable: PROXY
|
|
# # Enable YouTube new video format UMP
|
|
# ump = false
|
|
+# external_videoplayback_proxy = ""
|
|
|
|
###
|
|
# Network call timeouts when talking to YouTube.
|
|
diff --git a/src/lib/helpers/config.ts b/src/lib/helpers/config.ts
|
|
index cd851d7..a233f83 100644
|
|
--- a/src/lib/helpers/config.ts
|
|
+++ b/src/lib/helpers/config.ts
|
|
@@ -32,6 +32,9 @@ export const ConfigSchema = z.object({
|
|
debounce_multiplier: z.number().optional(),
|
|
}).strict().optional(),
|
|
}).strict().optional(),
|
|
+ external_videoplayback_proxy: z.string().default(
|
|
+ Deno.env.get("EXTERNAL_VIDEOPLAYBACK_PROXY") || "",
|
|
+ ),
|
|
}).strict().default({}),
|
|
jobs: z.object({
|
|
youtube_session: z.object({
|
|
diff --git a/src/routes/invidious_routes/dashManifest.ts b/src/routes/invidious_routes/dashManifest.ts
|
|
index d241407..b4446b6 100644
|
|
--- a/src/routes/invidious_routes/dashManifest.ts
|
|
+++ b/src/routes/invidious_routes/dashManifest.ts
|
|
@@ -93,8 +93,10 @@ dashManifest.get("/:videoId", async (c) => {
|
|
queryParams.set("enc", "true");
|
|
queryParams.set("data", encryptedParams);
|
|
}
|
|
- dashUrl = (dashUrl.pathname + "?" +
|
|
- queryParams.toString()) as unknown as URL;
|
|
+ dashUrl =
|
|
+ (config.networking.external_videoplayback_proxy +
|
|
+ dashUrl.pathname + "?" +
|
|
+ queryParams.toString()) as unknown as URL;
|
|
return dashUrl;
|
|
} else {
|
|
return dashUrl;
|
|
diff --git a/src/routes/invidious_routes/latestVersion.ts b/src/routes/invidious_routes/latestVersion.ts
|
|
index 331be18..74dd090 100644
|
|
--- a/src/routes/invidious_routes/latestVersion.ts
|
|
+++ b/src/routes/invidious_routes/latestVersion.ts
|
|
@@ -85,7 +85,8 @@ latestVersion.get("/", async (c) => {
|
|
queryParams.set("enc", "true");
|
|
queryParams.set("data", encryptedParams);
|
|
}
|
|
- urlToRedirect = itagUrlParsed.pathname + "?" +
|
|
+ urlToRedirect = config.networking.external_videoplayback_proxy +
|
|
+ itagUrlParsed.pathname + "?" +
|
|
queryParams.toString();
|
|
}
|
|
|
|
--
|
|
2.49.0
|
|
|