From 39274d88f67d795cae7bdb776d6c60b3aaa9b61a Mon Sep 17 00:00:00 2001 From: jj Date: Sat, 29 Mar 2025 10:23:38 +0000 Subject: [PATCH] api/youtube-session: bypass proxy for requests usually the session server is hosted locally, which means the proxy tries to access the wrong url --- api/src/processing/helpers/youtube-session.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/processing/helpers/youtube-session.js b/api/src/processing/helpers/youtube-session.js index 5235c42a..85f1a6e1 100644 --- a/api/src/processing/helpers/youtube-session.js +++ b/api/src/processing/helpers/youtube-session.js @@ -1,8 +1,11 @@ import * as cluster from "../../misc/cluster.js"; +import { Agent } from "undici"; import { env } from "../../config.js"; import { Green, Yellow } from "../../misc/console-text.js"; +const defaultAgent = new Agent(); + let session; const validateSession = (sessionResponse) => { @@ -32,7 +35,11 @@ const loadSession = async () => { const sessionServerUrl = new URL(env.ytSessionServer); sessionServerUrl.pathname = "/token"; - const newSession = await fetch(sessionServerUrl).then(a => a.json()); + const newSession = await fetch( + sessionServerUrl, + { dispatcher: defaultAgent } + ).then(a => a.json()); + validateSession(newSession); if (!session || session.updated < newSession?.updated) {