From 5ea170a5acdd7ff7d96fa141e7917c7705ca47e4 Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 14 Jun 2025 16:35:35 +0600 Subject: [PATCH] web: deprecate youtube HLS, enable it only via env variable it's now disabled by default because if we ever need HLS for youtube in the future, it'll be managed by the processing instance, not the web client. will probably be removed completely in next major release. --- web/README.md | 11 ++++---- web/src/lib/api/saving-handler.ts | 3 ++- web/src/lib/env.ts | 8 ++++-- web/src/routes/settings/video/+page.svelte | 29 ++++++++++++---------- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/web/README.md b/web/README.md index a04ff9a4..8c7c42ac 100644 --- a/web/README.md +++ b/web/README.md @@ -12,11 +12,12 @@ them, you must specify them when building the frontend (or running a vite server `WEB_DEFAULT_API` is **required** to run cobalt frontend. -| name | example | description | -|:---------------------|:----------------------------|:--------------------------------------------------------------------------------------------| -| `WEB_HOST` | `cobalt.tools` | domain on which the frontend will be running. used for meta tags and configuring plausible. | -| `WEB_PLAUSIBLE_HOST` | `plausible.io`* | enables plausible analytics with provided hostname as receiver backend. | -| `WEB_DEFAULT_API` | `https://api.cobalt.tools/` | changes url which is used for api requests by frontend clients. | +| name | example | description | +|:--------------------------------|:----------------------------|:--------------------------------------------------------------------------------------------------------| +| `WEB_HOST` | `cobalt.tools` | domain on which the frontend will be running. used for meta tags and configuring plausible. | +| `WEB_PLAUSIBLE_HOST` | `plausible.io`* | enables plausible analytics with provided hostname as receiver backend. | +| `WEB_DEFAULT_API` | `https://api.cobalt.tools/` | changes url which is used for api requests by frontend clients. | +| `ENABLE_DEPRECATED_YOUTUBE_HLS` | `true` | enables the youtube HLS settings entry; allows sending the related variable to the processing instance. | \* don't use plausible.io as receiver backend unless you paid for their cloud service. use your own domain when hosting community edition of plausible. refer to their [docs](https://plausible.io/docs) when needed. diff --git a/web/src/lib/api/saving-handler.ts b/web/src/lib/api/saving-handler.ts index b2dfbbb4..f18bd4ab 100644 --- a/web/src/lib/api/saving-handler.ts +++ b/web/src/lib/api/saving-handler.ts @@ -1,3 +1,4 @@ +import env from "$lib/env"; import API from "$lib/api/api"; import settings from "$lib/state/settings"; import lazySettingGetter from "$lib/settings/lazy-get"; @@ -60,7 +61,7 @@ export const savingHandler = async ({ url, request, oldTaskId }: SavingHandlerAr youtubeVideoCodec: getSetting("save", "youtubeVideoCodec"), videoQuality: getSetting("save", "videoQuality"), - youtubeHLS: getSetting("save", "youtubeHLS"), + youtubeHLS: env.ENABLE_DEPRECATED_YOUTUBE_HLS ? getSetting("save", "youtubeHLS") : undefined, convertGif: getSetting("save", "convertGif"), allowH265: getSetting("save", "allowH265"), diff --git a/web/src/lib/env.ts b/web/src/lib/env.ts index 1ba6a843..960d7ddb 100644 --- a/web/src/lib/env.ts +++ b/web/src/lib/env.ts @@ -9,13 +9,17 @@ const getEnv = (_key: string) => { } } +const getEnvBool = (key: string) => { + return getEnv(key) === "true"; +} + const variables = { HOST: getEnv('HOST'), PLAUSIBLE_HOST: getEnv('PLAUSIBLE_HOST'), PLAUSIBLE_ENABLED: getEnv('HOST') && getEnv('PLAUSIBLE_HOST'), DEFAULT_API: getEnv('DEFAULT_API'), - // temporary variable until webcodecs features are ready for testing - ENABLE_WEBCODECS: !!getEnv('ENABLE_WEBCODECS'), + ENABLE_WEBCODECS: getEnvBool('ENABLE_WEBCODECS'), + ENABLE_DEPRECATED_YOUTUBE_HLS: getEnvBool('ENABLE_DEPRECATED_YOUTUBE_HLS'), } const contacts = { diff --git a/web/src/routes/settings/video/+page.svelte b/web/src/routes/settings/video/+page.svelte index 233f0112..56a31db8 100644 --- a/web/src/routes/settings/video/+page.svelte +++ b/web/src/routes/settings/video/+page.svelte @@ -1,4 +1,5 @@