Remove the need for a separate page

This commit is contained in:
Manav Rathi 2024-04-04 09:53:11 +05:30
parent cb94dd8b42
commit 949a42004f
No known key found for this signature in database
2 changed files with 9 additions and 20 deletions

View file

@ -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;

View file

@ -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;