~ knotless Search/
↑↓ move↵ open⇧↵ all results

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

Grain's own sign-in screen, suggesting accounts as you type

Merged
Merged chadtmiller.com asked to merge into feature/hud from grain.social/grain:next/signin

What changes

Sign-in screen. Grain has its own sign-in screen, in the words and look of grain web's LoginModal. On the web it is at /auth/signin and behind Settings → Add account; on iOS the sign-in sheet is drawn in grain-ios's look. As you type a handle it suggests accounts with their avatars from typeahead.waow.tech. The arrows and Enter pick a suggestion, Escape closes the list, and picking one goes straight on to the account's PDS, with no HUD page in between. Errors, such as an unknown handle, show on the screen.

App file. next/grain.social.json gains signIn: its title, its lines with links, the placeholder, the create link, and the typeahead to ask. check-apps.mjs checks it: its links open a page, a route or an https URL, and its typeahead is a bare https origin with the fields it reads.

Web. /auth/signin is now a page with a form action, drawn by the shell's sign-in screen; the catch-all's Shell wiring moved to lib/AppPage.svelte.

Form action. It redirects to the account's server as an external redirect, as SvelteKit asks.

vendor/hud is HUD at 1ce08dc, which adds the screen to the shell and HUDKit.

Why

Signing in went through HUD's own page, which neither looks like Grain nor suggests accounts. HUD now lets an app with signIn skip that page and sends failures back to the app, so the screen is Grain's from start to finish.

How it was checked

node next/check-apps.mjs, npm run check and npm run build in next/, and the iOS app built for the simulator. HUD's own checks at 1ce08dc: just cov at 100%, the web check, ssr and unit tests, just lex, HUDKit's tests and Android's tests. Checked live against a release HUD and the built app, in Chromium at 390 and 1440 and on the iOS simulator. That covers suggestions, the keys, server render with no shift, the unknown-handle error, alice.test signed in on HUD's harness PDS and Settings → Add account; the comments on this pull give the details.

Shortcomings

hud-next must run HUD 1ce08dc or later before this deploys: older HUDs refuse the unknown signIn key at startup. iOS has no Settings → Add account; it has a single account. A real handle was checked only up to HUD's request to its PDS, which a local HUD's client metadata can't pass. feature/hud's grain-app.json still names social.grain.unspecced.deleteGallery, which HUD has had no lexicon for since a73ef12, so next/delete-gallery must land for hud-next to load these views.

Approved

This pull gives Grain its own sign-in screen. next/grain.social.json gains signIn, and check-apps.mjs validates it. /auth/signin becomes a page with a form action, and the Shell wiring moves into AppPage.svelte. The iOS sheet is redrawn, and vendor/hud moves to 1ce08dc.

I found nothing that must change. I read the next/ changes and the vendored oauth.ts, session.ts, server.ts and typeahead.ts.

  • Form action: it checks the request's origin before reading the form.
  • Return paths: the post-sign-in back goes through backPath.
  • Refusal redirect: it uses pending.from, which comes from the sealed sign-in cookie, so it can't be steered.
  • Typeahead: its avatar URLs are limited to https.
  • App-file check: check-apps.mjs covers the new signIn keys.

I did not read the iOS Swift files (SignInSheet.swift, Shell.swift, Config.swift, the UI tests), the HUDKit SignInPlan files, or the vendored SignIn.svelte, Shell.svelte and back.ts. The iOS app can't be built here. Per AGENTS.md, vendored files are copied from HUD and not edited by hand.

The deploy-order constraint in the body is real: hud-next needs HUD 1ce08dc or later, or it refuses the unknown signIn key at startup. Roll hud-next first.

Bug, found while testing the account deletion pull (3n2uhboomsljq) on top of this one: next/src/routes/auth/signin/+page.server.ts does redirect(303, went.to). Where HUD goes straight on to the PDS (a grain.social or loopback callback, so production), went.to is the PDS's own page, and SvelteKit refuses an external redirect without the flag (redirect_external_not_allowed), a 500 on every sign-in. The fix is redirect(303, went.to, { external: true }). Please take it here before this merges.

Taken in f04f35b: redirect(303, went.to, { external: true }). I hit the same 500 in the live run before your note, and after the fix the alice.test sign-in below goes through.

Live checks at f04f35b. Setup: a release HUD at 1ce08dc with HUD_WORKSPACE=off, HUD_APPS a copy of this branch's next/, behind HUD's TLS proxy at hud.harness.internal, and the built Grain web in front of it. For the test account: HUD's harness PDS and PLC with alice.test.

Two things in the copy differ from this branch, and both were needed only to run it:

  • grain-app.json and grain-gallery-view.json are taken from next/delete-gallery. feature/hud's social.grain.unspecced.deleteGallery has had no lexicon in HUD since a73ef12, so no HUD on app/shell loads feature/hud's views as they are.
  • For Settings only, a local stand-in serves getPreferences, because grain.social refuses a test PDS's token.

Chromium, at 390 and 1440:

  • Server render: signed out, /auth/signin is drawn on the server, and the form, field, legal line and button stay at the same boxes once hydrated.
  • Suggestions: typing "chadtm" suggests chadtmiller.com with its avatar. The arrows move the highlight, Escape closes the list, and Enter picks.
  • A real handle: picking chadtmiller.com goes straight on from HUD to PAR at its PDS (monolith.chadtmiller.com), with no HUD page in between. That PDS then refuses with invalid_client_metadata, because it can't fetch a local HUD's client metadata, and the screen shows that refusal. So the browser never left for a real PDS, and no real account was signed in.
  • Unknown handle: nobody.test shows "nobody.test does not resolve to an account" on the screen.
  • alice.test: goes straight from Grain to the PDS's page, signs in, and lands back on Grain at /.
  • Settings → Add account: opens the screen at /auth/signin?back=%2Fsettings.

iOS simulator, against the same HUD: SignInTests passes both tests.

  • testSignInSuggestsAccounts: chadtmiller.com is suggested with its avatar.
  • testSignInAsTestAccount: nobody.test is refused on the sheet, then alice.test signs in at the PDS.

Web at 390: chadtm suggests chadtmiller.com with its avatar

Web at 1440: an unknown handle refused on the screen

iOS: the sheet suggesting chadtmiller.com

Approved

The only change since my approval is in next/src/routes/auth/signin/+page.server.ts. The redirect to the account's PDS now passes { external: true }. That is the right fix for a redirect off-site, and it doesn't affect anything I approved. My earlier approval stands.

Merged as fdb1588
Part of a stack of 2
  1. Grain's own sign-in screen, suggesting accounts as you type Landed as fdb1588
  2. main