Skip to content

fix(web): return to the requested page after sign-in - #134

Merged
cheetahbyte merged 1 commit into
mainfrom
fix/web-return-after-sign-in
Nov 10, 2026
Merged

cheetahbyte merged 1 commit into
mainfrom
fix/web-return-after-sign-in

Conversation

@cheetahbyte

Copy link
Copy Markdown
Contributor

Summary

When the browser isn't signed in, a visit to an app page now redirects to /connect?next=<path>, and signing in returns to that path instead of /. An already signed-in visit to /connect?next=… goes straight there, and an ended session sends you to sign-in with the page you were on.

appRoute.beforeLoad   no session → redirect(connectPath(location.href))
connectRoute.beforeLoad   session → redirect(returnPath(search.next))
Connect.enter()       → location.assign(returnPath(?next))
signedOut()           → location.assign(connectPath(current path))

returnPath accepts only paths on this site. It rejects anything that doesn't start with /, starts with // or /\, or points back at /connect, and falls back to / for those.

Why

The iOS, macOS and Android apps no longer configure the server. Their links open web settings pages such as /settings/providers (crumble-project/apple#10, crumble-project/android#14). The browser has its own session, so the link showed sign-in and then dropped you on the home page.

Evidence

  • bun run check passes: agents check, lint, format, typecheck, OpenAPI check and 1187 tests.
  • apps/web/lib/session.test.ts covers accepted paths, rejected off-site and /connect values, and the next encoding.
  • Not clicked through in a browser.

Risk & Rollback

Reversibility: Reversible

Blast Radius: The web app's sign-in redirects. No server or API change.

If the redirect misbehaved, the worst case is landing on / after sign-in, which is the old behavior.

A signed-out visit to a page such as /settings/providers, which the native apps now link to, redirects to /connect?next=<path>, and signing in returns there instead of to the home page. An ended session does the same. returnPath follows only paths on this site, so next can't send the browser to another origin.
@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit be0e118.

@cheetahbyte cheetahbyte mentioned this pull request Nov 10, 2026
@cheetahbyte
cheetahbyte merged commit 83af578 into main Nov 10, 2026
8 checks passed
@cheetahbyte cheetahbyte mentioned this pull request Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant