From 45003ebabd329db7d529e0f32ce83afb88d57150 Mon Sep 17 00:00:00 2001 From: Emilien <4016501+unixfox@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:36:38 +0100 Subject: [PATCH] fixing await dynamic import --- deno.json | 1 + src/lib/helpers/youtubePlayerHandling.ts | 2 +- src/lib/jobs/potoken.ts | 2 +- src/main.ts | 2 +- src/routes/videoPlaybackProxy.ts | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/deno.json b/deno.json index 58cd42d..443a714 100644 --- a/deno.json +++ b/deno.json @@ -17,6 +17,7 @@ "@willsoto/node-konfig-file": "npm:@willsoto/node-konfig-file@3.0.0", "@willsoto/node-konfig-toml-parser": "npm:@willsoto/node-konfig-toml-parser@3.0.0", "youtubePlayerReq": "./src/lib/helpers/youtubePlayerReq.ts", + "getFetchClient": "./src/lib/helpers/getFetchClient.ts", "googlevideo": "npm:googlevideo@2.0.0" }, "unstable": ["cron", "kv", "http"] diff --git a/src/lib/helpers/youtubePlayerHandling.ts b/src/lib/helpers/youtubePlayerHandling.ts index 233cdbb..82826d9 100644 --- a/src/lib/helpers/youtubePlayerHandling.ts +++ b/src/lib/helpers/youtubePlayerHandling.ts @@ -2,7 +2,7 @@ import { ApiResponse, Innertube, YT } from "youtubei.js"; import { generateRandomString } from "youtubei.js/Utils"; import { compress, decompress } from "https://deno.land/x/brotli@0.1.7/mod.ts"; const { youtubePlayerReq } = await import( - Deno.env.get("YT_PLAYER_REQ_LOCATION") || "./youtubePlayerReq.ts" + Deno.env.get("YT_PLAYER_REQ_LOCATION") || "youtubePlayerReq" ); import { Store } from "@willsoto/node-konfig-core"; diff --git a/src/lib/jobs/potoken.ts b/src/lib/jobs/potoken.ts index ff6c369..02865eb 100644 --- a/src/lib/jobs/potoken.ts +++ b/src/lib/jobs/potoken.ts @@ -3,7 +3,7 @@ import type { BgConfig } from "bgutils"; import { JSDOM } from "jsdom"; import { Innertube, UniversalCache } from "youtubei.js"; import { Store } from "@willsoto/node-konfig-core"; -const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "../helpers/getFetchClient.ts"); +const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "getFetchClient"); // Adapted from https://github.com/LuanRT/BgUtils/blob/main/examples/node/index.ts export const poTokenGenerate = async ( diff --git a/src/main.ts b/src/main.ts index 2d43373..e5becf5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,7 +3,7 @@ import { routes } from "./routes/index.ts"; import { Innertube, UniversalCache } from "youtubei.js"; import { poTokenGenerate } from "./lib/jobs/potoken.ts"; import { konfigLoader } from "./lib/helpers/konfigLoader.ts"; -const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "./lib/helpers/getFetchClient.ts"); +const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "getFetchClient"); const app = new Hono(); const konfigStore = await konfigLoader(); diff --git a/src/routes/videoPlaybackProxy.ts b/src/routes/videoPlaybackProxy.ts index ead43d0..bd5479e 100644 --- a/src/routes/videoPlaybackProxy.ts +++ b/src/routes/videoPlaybackProxy.ts @@ -1,6 +1,6 @@ import { Hono } from "hono"; import { Store } from "@willsoto/node-konfig-core"; -const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "../lib/helpers/getFetchClient.ts"); +const { getFetchClient } = await import(Deno.env.get("GET_FETCH_CLIENT_LOCATION") || "getFetchClient"); import { HTTPException } from "hono/http-exception"; const videoPlaybackProxy = new Hono();