invidious-companion-patches/patches/0018-return-immediately-if-403-is-received-on-HEAD-reques.patch
Fijxu a5b522acf2
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m0s
add 0020
2025-04-22 17:01:06 -04:00

44 lines
1.7 KiB
Diff

From 08dcb9c48af0453d0a89c07654aff7b458a3bfb9 Mon Sep 17 00:00:00 2001
From: Fijxu <fijxu@nadeko.net>
Date: Tue, 22 Apr 2025 15:41:48 -0400
Subject: [PATCH 18/20] 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