allow to turn on or off po_token
This commit is contained in:
parent
608f177bcb
commit
551cf0075b
2 changed files with 11 additions and 4 deletions
|
@ -11,4 +11,6 @@ enabled = true
|
|||
#proxy = ""
|
||||
|
||||
[jobs]
|
||||
po_token_cron = "*/5 * * * *"
|
||||
[po_token]
|
||||
enabled = true
|
||||
frequency = "*/5 * * * *"
|
11
src/main.ts
11
src/main.ts
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue