All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m16s
71 lines
3 KiB
Diff
71 lines
3 KiB
Diff
From aa4a7282934a6f23dbcb055435f0fac114c3abba Mon Sep 17 00:00:00 2001
|
|
From: Fijxu <fijxu@nadeko.net>
|
|
Date: Mon, 24 Mar 2025 18:44:10 -0300
|
|
Subject: [PATCH 01/14] 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 | 5 +++--
|
|
src/routes/invidious_routes/latestVersion.ts | 3 ++-
|
|
4 files changed, 9 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/config/config.example.toml b/config/config.example.toml
|
|
index c56b95b..e173e06 100644
|
|
--- a/config/config.example.toml
|
|
+++ b/config/config.example.toml
|
|
@@ -26,6 +26,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 edba9da..5ff4a2d 100644
|
|
--- a/src/lib/helpers/config.ts
|
|
+++ b/src/lib/helpers/config.ts
|
|
@@ -26,6 +26,9 @@ 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 2b796ba..46756cd 100644
|
|
--- a/src/routes/invidious_routes/dashManifest.ts
|
|
+++ b/src/routes/invidious_routes/dashManifest.ts
|
|
@@ -85,8 +85,9 @@ dashManifest.get("/:videoId", async (c) => {
|
|
let dashUrl = url;
|
|
if (local) {
|
|
// Can't create URL type without host part
|
|
- dashUrl = (dashUrl.pathname + dashUrl.search + "&host=" +
|
|
- dashUrl.host) as unknown as URL;
|
|
+ dashUrl = config.networking.external_videoplayback_proxy +
|
|
+ (dashUrl.pathname + dashUrl.search + "&host=" +
|
|
+ dashUrl.host) as unknown as URL;
|
|
if (config.networking.ump) {
|
|
dashUrl = dashUrl + "&ump=1" as unknown as URL;
|
|
}
|
|
diff --git a/src/routes/invidious_routes/latestVersion.ts b/src/routes/invidious_routes/latestVersion.ts
|
|
index 191c0a4..a8ead67 100644
|
|
--- a/src/routes/invidious_routes/latestVersion.ts
|
|
+++ b/src/routes/invidious_routes/latestVersion.ts
|
|
@@ -64,7 +64,8 @@ latestVersion.get("/", async (c) => {
|
|
const itagUrlParsed = new URL(itagUrl);
|
|
let urlToRedirect = itagUrlParsed.toString();
|
|
if (local) {
|
|
- urlToRedirect = itagUrlParsed.pathname + itagUrlParsed.search +
|
|
+ urlToRedirect = config.networking.external_videoplayback_proxy +
|
|
+ itagUrlParsed.pathname + itagUrlParsed.search +
|
|
"&host=" + itagUrlParsed.host;
|
|
}
|
|
|
|
--
|
|
2.49.0
|
|
|