From 8fe32c68cefe02a48f41a09895895ee0c9237eb8 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Thu, 20 Feb 2025 19:07:38 -0700 Subject: [PATCH] require env config for fedapi stuff --- src/pages/onboarding/Onboarding.tsx | 147 ++++++++++--------- src/pages/parts/settings/ConnectionsPart.tsx | 116 ++++++++------- src/pages/parts/settings/SetupPart.tsx | 15 +- src/setup/config.ts | 4 + 4 files changed, 153 insertions(+), 129 deletions(-) diff --git a/src/pages/onboarding/Onboarding.tsx b/src/pages/onboarding/Onboarding.tsx index 97d3ac7a..a05e4150 100644 --- a/src/pages/onboarding/Onboarding.tsx +++ b/src/pages/onboarding/Onboarding.tsx @@ -25,85 +25,89 @@ import { MiniCardContent, } from "@/pages/onboarding/utils"; import { PageTitle } from "@/pages/parts/util/PageTitle"; +import { conf } from "@/setup/config"; import { useAuthStore } from "@/stores/auth"; import { getProxyUrls } from "@/utils/proxyUrls"; import { PopupModal } from "../parts/home/PopupModal"; -export function OptionalDropdown() { +export function FEDAPISetup() { const { t } = useTranslation(); const [isExpanded, setIsExpanded] = useState(false); const febboxToken = useAuthStore((s) => s.febboxToken); const setFebboxToken = useAuthStore((s) => s.setFebboxToken); - return ( -
- -
-
-

- Optional: FED API (Febbox) token -

-

- - Bring your own Febbox account to get the best streaming with 4K - quality, Dolby Atmos, and the best (fastest) load times! - -

-
-
- setIsExpanded(!isExpanded)} - enabled={isExpanded} - /> -
-
- {isExpanded ? ( - <> - - + if (conf().ALLOW_FEBBOX_KEY) { + return ( +
+ +
+

+ Optional: FED API (Febbox) token +

- To get your UI token: -
- 1. Go to - febbox.com - {" "} - and log in with Google (use a fresh account!) -
- 2. Open DevTools or inspect the page -
- 3. Go to Application tab → Cookies -
- 4. Copy the "ui" cookie. -
- 5. Close the tab, but do NOT logout! + Bring your own Febbox account to get the best streaming with + 4K quality, Dolby Atmos, and the best (fastest) load times!

-

- (Do not share this token!) -

+
+ setIsExpanded(!isExpanded)} + enabled={isExpanded} + /> +
+
+ {isExpanded ? ( + <> + - -

- {t("settings.connections.febbox.tokenLabel", "Token")} -

- { - setFebboxToken(newToken); - }} - value={febboxToken ?? ""} - placeholder="eyABCdE..." - passwordToggleable - /> - - ) : null} -
-
- ); +
+

+ + To get your UI token: +
+ 1. Go to + febbox.com + {" "} + and log in with Google (use a fresh account!) +
+ 2. Open DevTools or inspect the page +
+ 3. Go to Application tab → Cookies +
+ 4. Copy the "ui" cookie. +
+ 5. Close the tab, but do NOT logout! +
+

+

+ (Do not share this token!) +

+
+ + +

+ {t("settings.connections.febbox.tokenLabel", "Token")} +

+ { + setFebboxToken(newToken); + }} + value={febboxToken ?? ""} + placeholder="eyABCdE..." + passwordToggleable + /> + + ) : null} +
+
+ ); + } } + export function OnboardingPage() { const navigate = useNavigateOnboarding(); const skipModal = useModal("skip"); @@ -177,13 +181,18 @@ export function OnboardingPage() { might be slower due to shared bandwidth.

- Optional FED API (Febbox) UI token -
- Bringing your own Febbox account allows you to unlock FED API, - our best source with 4K quality, Dolby Atmos, the most content, - and the best (fastest) load times. This the highly recommended! -
-
+ {conf().ALLOW_FEBBOX_KEY && ( + <> + Optional FED API (Febbox) UI token +
+ Bringing your own Febbox account allows you to unlock FED + API, our best source with 4K quality, Dolby Atmos, the most + content, and the best (fastest) load times. This the highly + recommended! +
+
+ + )} If you have more questions on how this works, feel free to ask on the{" "} - + ); diff --git a/src/pages/parts/settings/ConnectionsPart.tsx b/src/pages/parts/settings/ConnectionsPart.tsx index 4b4aa32f..05fa5f80 100644 --- a/src/pages/parts/settings/ConnectionsPart.tsx +++ b/src/pages/parts/settings/ConnectionsPart.tsx @@ -10,6 +10,7 @@ import { AuthInputBox } from "@/components/text-inputs/AuthInputBox"; import { Divider } from "@/components/utils/Divider"; import { Heading1 } from "@/components/utils/Text"; import { SetupPart } from "@/pages/parts/settings/SetupPart"; +import { conf } from "@/setup/config"; import { useAuthStore } from "@/stores/auth"; interface ProxyEditProps { @@ -176,68 +177,73 @@ function BackendEdit({ backendUrl, setBackendUrl }: BackendEditProps) { function FebboxTokenEdit({ febboxToken, setFebboxToken }: FebboxTokenProps) { const { t } = useTranslation(); - - return ( - -
-
-

- Optional: FED API (Febbox) token -

-

- - Bring your own Febbox account to get the best streaming with 4K - quality, Dolby Atmos, and the best (fastest) load times! - -

-
-
- setFebboxToken((s) => (s === null ? "" : null))} - enabled={febboxToken !== null} - /> -
-
- {febboxToken !== null ? ( - <> - - + if (conf().ALLOW_FEBBOX_KEY) { + return ( + +
+

+ Optional: FED API (Febbox) token +

- To get your UI token: -
- 1. Go to febbox.com and - log in with Google (use a fresh account!) -
- 2. Open DevTools or inspect the page -
- 3. Go to Application tab → Cookies -
- 4. Copy the "ui" cookie. -
- 5. Close the tab, but do NOT logout! + Bring your own Febbox account to get the best streaming with 4K + quality, Dolby Atmos, and the best (fastest) load times!

-

(Do not share this token!)

+
+ setFebboxToken((s) => (s === null ? "" : null))} + enabled={febboxToken !== null} + /> +
+
+ {febboxToken !== null ? ( + <> + - -

- {t("settings.connections.febbox.tokenLabel", "Token")} -

- { - setFebboxToken(newToken); - }} - value={febboxToken ?? ""} - placeholder="eyABCdE..." - passwordToggleable - /> - - ) : null} -
- ); +
+

+ + To get your UI token: +
+ 1. Go to + febbox.com + {" "} + and log in with Google (use a fresh account!) +
+ 2. Open DevTools or inspect the page +
+ 3. Go to Application tab → Cookies +
+ 4. Copy the "ui" cookie. +
+ 5. Close the tab, but do NOT logout! +
+

+

+ (Do not share this token!) +

+
+ + +

+ {t("settings.connections.febbox.tokenLabel", "Token")} +

+ { + setFebboxToken(newToken); + }} + value={febboxToken ?? ""} + placeholder="eyABCdE..." + passwordToggleable + /> + + ) : null} +
+ ); + } } export function ConnectionsPart( diff --git a/src/pages/parts/settings/SetupPart.tsx b/src/pages/parts/settings/SetupPart.tsx index 9886e196..e2b004b8 100644 --- a/src/pages/parts/settings/SetupPart.tsx +++ b/src/pages/parts/settings/SetupPart.tsx @@ -15,6 +15,7 @@ import { StatusCircleProps, } from "@/components/player/internals/StatusCircle"; import { Heading3 } from "@/components/utils/Text"; +import { conf } from "@/setup/config"; import { useAuthStore } from "@/stores/auth"; const testUrl = "https://postman-echo.com/get"; @@ -26,7 +27,7 @@ type SetupData = { extension: Status; proxy: Status; defaultProxy: Status; - febboxTokenTest: Status; + febboxTokenTest?: Status; }; function testProxy(url: string) { @@ -100,7 +101,9 @@ function useIsSetup() { extension: extensionStatus, proxy: proxyStatus, defaultProxy: "success", - febboxTokenTest: febboxTokenStatus, + ...(conf().ALLOW_FEBBOX_KEY && { + febboxTokenTest: febboxTokenStatus, + }), }; }, [proxyUrls, febboxToken]); @@ -243,9 +246,11 @@ export function SetupPart() { > {t("settings.connections.setup.items.default")} - - Febbox UI token - + {conf().ALLOW_FEBBOX_KEY && ( + + Febbox UI token + + )}