From d0d0f16c5f42588ae57a9ed7a4b05bbbaff466d1 Mon Sep 17 00:00:00 2001 From: wukko Date: Sat, 31 Aug 2024 14:08:48 +0600 Subject: [PATCH] web/privacy: add support for always proxying files --- web/i18n/en/settings.json | 4 ++++ web/src/lib/api/api.ts | 6 +++++- web/src/lib/settings/defaults.ts | 1 + web/src/lib/types/settings.ts | 1 + web/src/routes/settings/privacy/+page.svelte | 13 +++++++++++-- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/web/i18n/en/settings.json b/web/i18n/en/settings.json index 943749da..d5c7bfb3 100644 --- a/web/i18n/en/settings.json +++ b/web/i18n/en/settings.json @@ -101,6 +101,10 @@ "privacy.analytics.description": "we use a self-hosted plausible instance for getting an approximate number of active cobalt users. no identifiable information about you is ever stored. all processed data is anonymized and aggregated.\n\nplausible does not use any cookies and is fully compliant with GDPR, CCPA, and PECR.", "privacy.analytics.learnmore": "learn more about plausible's dedication to privacy.", + "privacy.tunnel": "tunnelling", + "privacy.tunnel.title": "always tunnel all files", + "privacy.tunnel.description": "cobalt will always hide your ip address and browser info from the source service. this also helps bypass local network restrictions.", + "advanced.debug": "debug", "advanced.debug.title": "enable debug features", "advanced.debug.description": "gives you access to a page with various info that can be useful for debugging.", diff --git a/web/src/lib/api/api.ts b/web/src/lib/api/api.ts index 15c1cd60..ee8f5f0c 100644 --- a/web/src/lib/api/api.ts +++ b/web/src/lib/api/api.ts @@ -9,7 +9,9 @@ import type { Optional } from "$lib/types/generic"; import type { CobaltAPIResponse, CobaltErrorResponse } from "$lib/types/api"; const request = async (url: string) => { - const saveSettings = get(settings).save; + const gSettings = get(settings); + const saveSettings = gSettings.save; + const privacySettings = gSettings.privacy; const request = { url, @@ -29,6 +31,8 @@ const request = async (url: string) => { twitterGif: saveSettings.twitterGif, tiktokH265: saveSettings.tiktokH265, + + alwaysProxy: privacySettings.alwaysProxy, } await apiOverrideWarning(); diff --git a/web/src/lib/settings/defaults.ts b/web/src/lib/settings/defaults.ts index b2c17a75..ce643ed2 100644 --- a/web/src/lib/settings/defaults.ts +++ b/web/src/lib/settings/defaults.ts @@ -29,6 +29,7 @@ const defaultSettings: CobaltSettings = { youtubeDubBrowserLang: false, }, privacy: { + alwaysProxy: false, disableAnalytics: false, }, processing: { diff --git a/web/src/lib/types/settings.ts b/web/src/lib/types/settings.ts index de855259..3c9cef6e 100644 --- a/web/src/lib/types/settings.ts +++ b/web/src/lib/types/settings.ts @@ -23,6 +23,7 @@ type CobaltSettingsAdvanced = { }; type CobaltSettingsPrivacy = { + alwaysProxy: boolean, disableAnalytics: boolean, }; diff --git a/web/src/routes/settings/privacy/+page.svelte b/web/src/routes/settings/privacy/+page.svelte index 00eacbca..dfe3bd7c 100644 --- a/web/src/routes/settings/privacy/+page.svelte +++ b/web/src/routes/settings/privacy/+page.svelte @@ -2,11 +2,20 @@ import env from "$lib/env"; import { t } from "$lib/i18n/translations"; - import SettingsCategory from "$components/settings/SettingsCategory.svelte"; - import SettingsToggle from "$components/buttons/SettingsToggle.svelte"; import OuterLink from "$components/misc/OuterLink.svelte"; + import SettingsToggle from "$components/buttons/SettingsToggle.svelte"; + import SettingsCategory from "$components/settings/SettingsCategory.svelte"; + + + + {#if env.PLAUSIBLE_ENABLED}