invidious-companion-patches/patches/0016-return-immediately-if-403-is-received-on-HEAD-reques.patch
Fijxu 5553757d97
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m3s
updated patches and invidious-companion
2025-04-24 18:10:53 -04:00

44 lines
1.7 KiB
Diff

From a24842896717fba919fed0ea1d81aa43288b8465 Mon Sep 17 00:00:00 2001
From: Fijxu <fijxu@nadeko.net>
Date: Tue, 22 Apr 2025 15:41:48 -0400
Subject: [PATCH 16/17] return immediately if 403 is received on HEAD request
---
src/routes/videoPlaybackProxy.ts | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/routes/videoPlaybackProxy.ts b/src/routes/videoPlaybackProxy.ts
index 2af343e..4976edb 100644
--- a/src/routes/videoPlaybackProxy.ts
+++ b/src/routes/videoPlaybackProxy.ts
@@ -124,6 +124,27 @@ videoPlaybackProxy.get("/", async (c) => {
redirect: "manual",
},
);
+
+ if (googlevideoResponse.status == 403) {
+ return new Response(googlevideoResponse.body, {
+ status: googlevideoResponse.status,
+ statusText: googlevideoResponse.statusText,
+ headers: {
+ "content-length":
+ googlevideoResponse.headers.get("content-length") ||
+ "",
+ "access-control-allow-origin": "*",
+ "accept-ranges":
+ googlevideoResponse.headers.get("accept-ranges") || "",
+ "content-type":
+ googlevideoResponse.headers.get("content-type") || "",
+ "expires": googlevideoResponse.headers.get("expires") || "",
+ "last-modified":
+ googlevideoResponse.headers.get("last-modified") || "",
+ },
+ });
+ }
+
if (googlevideoResponse.headers.has("Location")) {
location = googlevideoResponse.headers.get("Location") as string;
continue;
--
2.49.0