All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m15s
61 lines
2.3 KiB
Diff
61 lines
2.3 KiB
Diff
From 849be9e4b94bd415140f4dfc5223598234b9e83f Mon Sep 17 00:00:00 2001
|
|
From: Fijxu <fijxu@nadeko.net>
|
|
Date: Mon, 24 Mar 2025 20:34:33 -0300
|
|
Subject: [PATCH 07/12] 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 8e2af1c..b1cb4ee 100644
|
|
--- a/config/config.example.toml
|
|
+++ b/config/config.example.toml
|
|
@@ -53,6 +53,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 cd0489d..6004753 100644
|
|
--- a/src/lib/helpers/config.ts
|
|
+++ b/src/lib/helpers/config.ts
|
|
@@ -45,6 +45,15 @@ export 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 c2b9441..b8be39b 100644
|
|
--- a/src/lib/jobs/potoken.ts
|
|
+++ b/src/lib/jobs/potoken.ts
|
|
@@ -177,7 +177,9 @@ async function checkToken({
|
|
"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
|
|
|