mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-09 07:42:39 +02:00
feat(desktop): intercept OAuth redirects to hosted frontend via webRequest
This commit is contained in:
parent
a866e6caa1
commit
d4ad5c7fe4
3 changed files with 15 additions and 19 deletions
|
|
@ -35,15 +35,6 @@ function LoginContent() {
|
|||
localStorage.setItem("surfsense_redirect_path", decodeURIComponent(returnUrl));
|
||||
}
|
||||
|
||||
// Desktop app: persist login source so TokenHandler can redirect to
|
||||
// the surfsense:// deep link after the OAuth round-trip completes.
|
||||
const source = searchParams.get("source");
|
||||
if (source === "desktop") {
|
||||
sessionStorage.setItem("surfsense_login_source", "desktop");
|
||||
} else {
|
||||
sessionStorage.removeItem("surfsense_login_source");
|
||||
}
|
||||
|
||||
// Show registration success message
|
||||
if (registered === "true") {
|
||||
toast.success(t("register_success"), {
|
||||
|
|
|
|||
|
|
@ -60,15 +60,6 @@ const TokenHandler = ({
|
|||
setRefreshToken(refreshToken);
|
||||
}
|
||||
|
||||
// Desktop app: redirect tokens to the Electron deep link handler
|
||||
const loginSource = sessionStorage.getItem("surfsense_login_source");
|
||||
if (loginSource === "desktop") {
|
||||
sessionStorage.removeItem("surfsense_login_source");
|
||||
const deepLink = `surfsense://auth/callback?token=${token}${refreshToken ? `&refresh_token=${refreshToken}` : ""}`;
|
||||
window.location.href = deepLink;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if there's a saved redirect path from before the auth flow
|
||||
const savedRedirectPath = getAndClearRedirectPath();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue