All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m10s
61 lines
2.3 KiB
Diff
61 lines
2.3 KiB
Diff
From 600734d4b7731ad70605770cf99060d5af382647 Mon Sep 17 00:00:00 2001
|
|
From: Fijxu <fijxu@nadeko.net>
|
|
Date: Mon, 24 Mar 2025 20:34:33 -0300
|
|
Subject: [PATCH 07/13] feat: add option to disable potoken generation check
|
|
|
|
---
|
|
config/config.example.toml | 1 +
|
|
src/lib/helpers/config.ts | 9 +++++++++
|
|
src/lib/jobs/potoken.ts | 4 +++-
|
|
3 files changed, 13 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/config/config.example.toml b/config/config.example.toml
|
|
index 6d342bb..969c768 100644
|
|
--- a/config/config.example.toml
|
|
+++ b/config/config.example.toml
|
|
@@ -52,6 +52,7 @@
|
|
# [jobs.youtube_session]
|
|
# po_token_enabled = true # whether to generate PO tokens
|
|
# frequency = "*/5 * * * *" # frequency of PO token refresh in cron format
|
|
+# po_token_check = false # whether to check if the PO token is valid or not
|
|
|
|
# [youtube_session]
|
|
# oauth_enabled = false
|
|
diff --git a/src/lib/helpers/config.ts b/src/lib/helpers/config.ts
|
|
index a5221c9..e6b1070 100644
|
|
--- a/src/lib/helpers/config.ts
|
|
+++ b/src/lib/helpers/config.ts
|
|
@@ -42,6 +42,15 @@ const ConfigSchema = z.object({
|
|
youtube_session: z.object({
|
|
po_token_enabled: z.boolean().default(true),
|
|
frequency: z.string().default("*/5 * * * *"),
|
|
+ po_token_check: z
|
|
+ .boolean()
|
|
+ .default(
|
|
+ Deno.env.get("PO_TOKEN_CHECK") === "true"
|
|
+ ? true
|
|
+ : Deno.env.get("PO_TOKEN_CHECK") === "false"
|
|
+ ? false
|
|
+ : true,
|
|
+ ),
|
|
}).strict().default({}),
|
|
}).strict().default({}),
|
|
youtube_session: z.object({
|
|
diff --git a/src/lib/jobs/potoken.ts b/src/lib/jobs/potoken.ts
|
|
index 6867082..3e5dfc0 100644
|
|
--- a/src/lib/jobs/potoken.ts
|
|
+++ b/src/lib/jobs/potoken.ts
|
|
@@ -166,7 +166,9 @@ export const poTokenGenerate = async (
|
|
"failed to find valid video with adaptive format to check token against",
|
|
);
|
|
}
|
|
- const result = await fetchImpl(validFormat?.url, { method: "HEAD" });
|
|
+ const result = await fetchImpl(validFormat?.url, {
|
|
+ method: "HEAD",
|
|
+ });
|
|
if (result.status !== 200) {
|
|
throw new Error(
|
|
`did not get a 200 when checking video, got ${result.status} instead`,
|
|
--
|
|
2.49.0
|
|
|