From 18d604478ba829a33c7a52ae4dc4a81647c4a120 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Sun, 14 Dec 2025 14:55:21 -0700 Subject: [PATCH] add userscript to onboarding and notif --- public/notifications.xml | 23 +++ src/assets/locales/en.json | 2 + src/components/UserIcon.tsx | 10 ++ src/pages/onboarding/OnboardingExtension.tsx | 149 +++++++++---------- 4 files changed, 107 insertions(+), 77 deletions(-) diff --git a/public/notifications.xml b/public/notifications.xml index faf3dd9a..3df2a16e 100644 --- a/public/notifications.xml +++ b/public/notifications.xml @@ -8,6 +8,29 @@ Mon, 29 Sep 2025 18:00:00 MST + + notification-053 + New Userscript alternative to the extension! + If you prefer to use a userscript instead of the extension, you now have the option! + +It should work almost exactly the same as the extension, but without the need to install an extension. Unfortunatly, our Firefox extension store page keeps getting taken down, so this is the alternative until we can get it back up or if you install the .xpi manually. + +Some things to note: + +- The extension is still the most reliable method! +- This does not currently work in Safari or Orion due to Webkit’s limitations with webRequest APIs. :( + +Thanks to Duplicake for the incredible help building this! + +Use the link below to install the userscript into Violentmonkey or Tampermonkey! + +P.S. We're still working on getting some new sources online, so expect more updates soon! + + https://raw.githubusercontent.com/p-stream/Userscript/main/p-stream.user.js + Sun, 14 Dec 2025 15:00:00 MST + feature + + notification-052 Thanks to everyone who has supported! diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 36de4fc0..7f622f86 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -579,6 +579,8 @@ "extensionHelp": "If you've installed the extension but it's not detected, open the extension through your browsers extension menu and follow the steps on screen.", "linkChrome": "Install Chrome extension", "linkFirefox": "Install Firefox extension", + "linkUserscript": "Alternative Userscript", + "userscriptNote": "(The extension is more reliable than the userscript!)", "notDetecting": "Installed on Chrome, but the site isn't detecting it? Try reloading the page!", "notDetectingAction": "Reload page", "status": { diff --git a/src/components/UserIcon.tsx b/src/components/UserIcon.tsx index 797ea1e2..11b9afb1 100644 --- a/src/components/UserIcon.tsx +++ b/src/components/UserIcon.tsx @@ -22,6 +22,11 @@ export enum UserIcons { WAND = "wand", CLAPPER_BOARD = "clapper_board", BOOKMARK = "bookmark", + FIREFOX = "firefox", + CHROME = "chrome", + SAFARI = "safari", + ORION = "orion", + EDGE = "edge", } export interface UserIconProps { @@ -49,6 +54,11 @@ const iconList: Record = { wand: ``, clapper_board: ``, bookmark: ``, + firefox: ``, + chrome: ``, + safari: ``, + edge: ``, + orion: ``, }; export const UserIcon = memo((props: UserIconProps) => { diff --git a/src/pages/onboarding/OnboardingExtension.tsx b/src/pages/onboarding/OnboardingExtension.tsx index 11e9f3af..0de7be46 100644 --- a/src/pages/onboarding/OnboardingExtension.tsx +++ b/src/pages/onboarding/OnboardingExtension.tsx @@ -122,9 +122,15 @@ interface ExtensionPageProps { loading: boolean; } -function ChromeExtensionPage(props: ExtensionPageProps) { +function DefaultExtensionPage(props: ExtensionPageProps) { const { t } = useTranslation(); - const installLink = conf().ONBOARDING_CHROME_EXTENSION_INSTALL_LINK; + const installChromeLink = conf().ONBOARDING_CHROME_EXTENSION_INSTALL_LINK; + const installFirefoxLink = conf().ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK; + + const browser = useMemo(() => { + return detectExtensionInstall(); + }, []); + return ( <> @@ -133,40 +139,68 @@ function ChromeExtensionPage(props: ExtensionPageProps) { {t("onboarding.extension.explainer")} - {installLink ? ( - - {t("onboarding.extension.linkChrome")} - - ) : null} - - - See extension source code - - - ); -} + {/* Main extension icons */} +
+ {installChromeLink && + (browser === "chrome" || browser === "unknown") ? ( + + + + + + + + {t("onboarding.extension.linkChrome")} + + + ) : null} + {installFirefoxLink && + (browser === "firefox" || browser === "unknown") ? ( + + + + + + + + {t("onboarding.extension.linkFirefox")} + + + ) : null} +
-function FirefoxExtensionPage(props: ExtensionPageProps) { - const { t } = useTranslation(); - const installLink = conf().ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK; - return ( - <> - - {t("onboarding.extension.title")} - - - {t("onboarding.extension.explainer")} - - {installLink ? ( - - {t("onboarding.extension.linkFirefox")} - - ) : null} + {/* Secondary userscript option */} +
+
+ + {t("onboarding.extension.linkUserscript")} + + + {t("onboarding.extension.userscriptNote")} + +
+
- - {t("onboarding.extension.title")} - - - {t("onboarding.extension.explainer")} - -
- {installChromeLink ? ( - - {t("onboarding.extension.linkChrome")} - - ) : null} -
-
- {installFirefoxLink ? ( - - {t("onboarding.extension.linkFirefox")} - - ) : null} -
- - - - See extension source code - - - ); -} - export function OnboardingExtensionPage() { const { t } = useTranslation(); const navigate = useNavigateOnboarding(); @@ -254,12 +249,12 @@ export function OnboardingExtensionPage() { const componentMap: Record< ExtensionDetectionResult, - typeof UnknownExtensionPage + typeof DefaultExtensionPage > = { - chrome: ChromeExtensionPage, - firefox: FirefoxExtensionPage, + chrome: DefaultExtensionPage, + firefox: DefaultExtensionPage, ios: IosExtensionPage, - unknown: UnknownExtensionPage, + unknown: DefaultExtensionPage, }; const PageContent = componentMap[extensionSupport];