allow to turn on or off po_token

This commit is contained in:
Emilien Devos 2024-10-23 23:29:14 +02:00
parent 608f177bcb
commit 551cf0075b
2 changed files with 11 additions and 4 deletions

View file

@ -11,4 +11,6 @@ enabled = true
#proxy = ""
[jobs]
po_token_cron = "*/5 * * * *"
[po_token]
enabled = true
frequency = "*/5 * * * *"

View file

@ -8,11 +8,16 @@ const app = new Hono();
const konfigStore = await konfigLoader();
let innertubeClient = await Innertube.create({ retrieve_player: false });
let innertubeClient: Innertube;
innertubeClient = await poTokenGenerate(innertubeClient, konfigStore);
if (konfigStore.get("jobs.po_token.enabled") as boolean) {
innertubeClient = await Innertube.create({ retrieve_player: false });
innertubeClient = await poTokenGenerate(innertubeClient, konfigStore);
} else {
await Innertube.create();
}
Deno.cron("regenerate poToken", konfigStore.get("jobs.po_token_cron") as string, async () => {
Deno.cron("regenerate poToken", konfigStore.get("jobs.po_token.frequency") as string, async () => {
innertubeClient = await poTokenGenerate(innertubeClient, konfigStore);
});