diff --git a/web/apps/payments/src/pages/desktop-redirect.tsx b/web/apps/payments/src/pages/desktop-redirect.tsx deleted file mode 100644 index 2dc5d0bb3..000000000 --- a/web/apps/payments/src/pages/desktop-redirect.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { Container } from "components/Container"; -import { Spinner } from "components/Spinner"; -import React, { useEffect } from "react"; - -const Page: React.FC = () => { - useEffect(() => { - const currentURL = new URL(window.location.href); - const desktopRedirectURL = new URL("ente://app/gallery"); - desktopRedirectURL.search = currentURL.search; - window.location.href = desktopRedirectURL.href; - }, []); - - return ( - - - - ); -}; - -export default Page; diff --git a/web/apps/payments/src/services/billing-service.ts b/web/apps/payments/src/services/billing-service.ts index 30a7bfb4a..9a3af5c9d 100644 --- a/web/apps/payments/src/services/billing-service.ts +++ b/web/apps/payments/src/services/billing-service.ts @@ -292,6 +292,15 @@ const redirectToApp = ( status: RedirectStatus, reason?: FailureReason, ) => { + // The desktop app passes "/desktop-redirect" as `redirectURL`. + // This is just a placeholder, we want to intercept this and instead + // redirect to the ente:// scheme protocol handler that is internally being + // used by the desktop app. + if (new URL(redirectURL).pathname == "/desktop-redirect") { + redirectToApp("ente://app/gallery", status, reason); + return; + } + let url = `${redirectURL}?status=${status}`; if (reason) url = `${url}&reason=${reason}`; window.location.href = url;