Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove the need for a separate page

Manav Rathi949a42004ffd
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 2dc5d0bb39..0000000000
--- 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 (
- <Container>
- <Spinner />
- </Container>
- );
-};
-
-export default Page;
diff --git a/web/apps/payments/src/services/billing-service.ts b/web/apps/payments/src/services/billing-service.ts
index 30a7bfb4a4..9a3af5c9d6 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 "<our-origin>/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;