From 825a28502d10732540667c2753d000c36f796491 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Wed, 24 Jan 2024 14:53:54 +0100 Subject: [PATCH] Add config options for extension install links --- src/pages/onboarding/OnboardingExtension.tsx | 8 ++++---- src/setup/config.ts | 21 +++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/pages/onboarding/OnboardingExtension.tsx b/src/pages/onboarding/OnboardingExtension.tsx index 5dbbecad..c6ab3db4 100644 --- a/src/pages/onboarding/OnboardingExtension.tsx +++ b/src/pages/onboarding/OnboardingExtension.tsx @@ -119,7 +119,7 @@ interface ExtensionPageProps { function ChromeExtensionPage(props: ExtensionPageProps) { const { t } = useTranslation(); - const installLink = conf().ONBOARDING_EXTENSION_INSTALL_LINK; + const installLink = conf().ONBOARDING_CHROME_EXTENSION_INSTALL_LINK; return ( <> @@ -141,7 +141,7 @@ function ChromeExtensionPage(props: ExtensionPageProps) { function FirefoxExtensionPage(props: ExtensionPageProps) { const { t } = useTranslation(); - const installLink = conf().ONBOARDING_EXTENSION_INSTALL_LINK; + const installLink = conf().ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK; return ( <> @@ -180,8 +180,8 @@ function IosExtensionPage(_props: ExtensionPageProps) { function UnknownExtensionPage(props: ExtensionPageProps) { const { t } = useTranslation(); - const installChromeLink = conf().ONBOARDING_EXTENSION_INSTALL_LINK; - const installFirefoxLink = conf().ONBOARDING_EXTENSION_INSTALL_LINK; + const installChromeLink = conf().ONBOARDING_CHROME_EXTENSION_INSTALL_LINK; + const installFirefoxLink = conf().ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK; return ( <> diff --git a/src/setup/config.ts b/src/setup/config.ts index ef04a786..f081e673 100644 --- a/src/setup/config.ts +++ b/src/setup/config.ts @@ -20,7 +20,8 @@ interface Config { TURNSTILE_KEY: string; CDN_REPLACEMENTS: string; HAS_ONBOARDING: string; - ONBOARDING_EXTENSION_INSTALL_LINK: string; + ONBOARDING_CHROME_EXTENSION_INSTALL_LINK: string; + ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK: string; ONBOARDING_PROXY_INSTALL_LINK: string; } @@ -38,7 +39,8 @@ export interface RuntimeConfig { TURNSTILE_KEY: string | null; CDN_REPLACEMENTS: Array; HAS_ONBOARDING: boolean; - ONBOARDING_EXTENSION_INSTALL_LINK: string | null; + ONBOARDING_CHROME_EXTENSION_INSTALL_LINK: string | null; + ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK: string | null; ONBOARDING_PROXY_INSTALL_LINK: string | null; } @@ -48,8 +50,10 @@ const env: Record = { GITHUB_LINK: undefined, DONATION_LINK: undefined, DISCORD_LINK: undefined, - ONBOARDING_EXTENSION_INSTALL_LINK: import.meta.env - .VITE_ONBOARDING_EXTENSION_INSTALL_LINK, + ONBOARDING_CHROME_EXTENSION_INSTALL_LINK: import.meta.env + .VITE_ONBOARDING_CHROME_EXTENSION_INSTALL_LINK, + ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK: import.meta.env + .VITE_ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK, ONBOARDING_PROXY_INSTALL_LINK: import.meta.env .VITE_ONBOARDING_PROXY_INSTALL_LINK, DMCA_EMAIL: import.meta.env.VITE_DMCA_EMAIL, @@ -80,7 +84,8 @@ function getKey(key: keyof Config, defaultString?: string): string { export function conf(): RuntimeConfig { const dmcaEmail = getKey("DMCA_EMAIL"); - const extensionLink = getKey("ONBOARDING_EXTENSION_INSTALL_LINK"); + const chromeExtension = getKey("ONBOARDING_CHROME_EXTENSION_INSTALL_LINK"); + const firefoxExtension = getKey("ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK"); const proxyInstallLink = getKey("ONBOARDING_PROXY_INSTALL_LINK"); const turnstileKey = getKey("TURNSTILE_KEY"); return { @@ -89,8 +94,10 @@ export function conf(): RuntimeConfig { DONATION_LINK, DISCORD_LINK, DMCA_EMAIL: dmcaEmail.length > 0 ? dmcaEmail : null, - ONBOARDING_EXTENSION_INSTALL_LINK: - extensionLink.length > 0 ? extensionLink : null, + ONBOARDING_CHROME_EXTENSION_INSTALL_LINK: + chromeExtension.length > 0 ? chromeExtension : null, + ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK: + firefoxExtension.length > 0 ? firefoxExtension : null, ONBOARDING_PROXY_INSTALL_LINK: proxyInstallLink.length > 0 ? proxyInstallLink : null, BACKEND_URL: getKey("BACKEND_URL", BACKEND_URL),