From 57c9b46f0ed0bc47f12f29b64a2f3962fcc712d3 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Sun, 18 Oct 2026 12:01:14 -0700 Subject: [PATCH] Fix AT Protocol sign-in and brand it as Bluesky Accept DID documents served as application/did+ld+json, which plc.directory uses for every did:plc account; the strict content-type check rejected all of them before any PDS was contacted. The fixture now serves its DID document with that type. Show the Bluesky butterfly and blue on the provider button and Shale author marks, ask for a handle, and align the back link, heading and hint on the handle step with the password step. Verified live PAR starts for a self-hosted PDS (paperclover.net) and bsky.social (pfrazee.com), 57 Rust tests, web check/build, and browser layouts in light, dark and mobile. Assisted-by: claude-opus-5.5 --- dashboard/src/atproto.rs | 8 +------- dashboard/src/guest.rs | 2 +- dashboard/tests/atproto-fixture.py | 6 +++--- dashboard/web/pages/SignIn.css | 7 +++++-- dashboard/web/pages/SignIn.tsx | 14 +++++++------- dashboard/web/sso/atproto.svg | 2 +- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/dashboard/src/atproto.rs b/dashboard/src/atproto.rs index 10bb1e22338bad81f311e25c088ddac977272707..c3cb49038c9e471d1337d48e2c6ffca44f8ec16f 100644 --- a/dashboard/src/atproto.rs +++ b/dashboard/src/atproto.rs @@ -160,13 +160,7 @@ async fn get(url: Url) -> Result { .send() .await .map_err(|_| reject())?; - if response.status() != StatusCode::OK - || response - .headers() - .get("content-type") - .and_then(|v| v.to_str().ok()) - .is_none_or(|v| v.split(';').next() != Some("application/json")) - { + if response.status() != StatusCode::OK { return Err(reject()); } serde_json::from_slice(&bytes(response, 65536).await?).map_err(|_| reject()) diff --git a/dashboard/src/guest.rs b/dashboard/src/guest.rs index bb1d815244f14cf5c592626fd6155bfe8357a247..097120113408e1ebf1caeb30ea6a950d871a6f39 100644 --- a/dashboard/src/guest.rs +++ b/dashboard/src/guest.rs @@ -32,7 +32,7 @@ fn known(provider: &str) -> Result<&str> { match provider { "github" => Ok("GitHub"), "astheno" => Ok("Astheno"), - "atproto" => Ok("AT Protocol"), + "atproto" => Ok("Bluesky"), _ => Err(Error::new( 404, "Choose a provider on the Shale sign-in page.", diff --git a/dashboard/tests/atproto-fixture.py b/dashboard/tests/atproto-fixture.py index 74820c67226e0582ec622646e5026acdc186a601..182fc418ed1b254e3e37d7c170c5ed9d186497b4 100644 --- a/dashboard/tests/atproto-fixture.py +++ b/dashboard/tests/atproto-fixture.py @@ -46,10 +46,10 @@ class Fixture(BaseHTTPRequestHandler): def log_message(self, *_): pass - def send(self, code, value, nonce=False): + def send(self, code, value, nonce=False, content_type='application/json'): body = json.dumps(value).encode() self.send_response(code) - self.send_header('Content-Type', 'application/json') + self.send_header('Content-Type', content_type) self.send_header('Content-Length', str(len(body))) if nonce and self.mode != 'missing-nonce': self.send_header('DPoP-Nonce', self.nonce) @@ -85,7 +85,7 @@ class Fixture(BaseHTTPRequestHandler): type(self).mode = parse_qs(urlsplit(self.path).query).get('mode', [''])[0] return self.send(200, {}) if path == '/.well-known/did.json': - return self.send(200, {'id': DID, 'alsoKnownAs': ['at://'+urlsplit(PDS).hostname] if 'ATPROTO_FIXTURE_ORIGIN' in os.environ else [], 'service': [{'id': '#atproto_pds', 'type': 'AtprotoPersonalDataServer', 'serviceEndpoint': 'https://127.0.0.1' if self.mode == 'private-pds' else PDS}]}) + return self.send(200, {'id': DID, 'alsoKnownAs': ['at://'+urlsplit(PDS).hostname] if 'ATPROTO_FIXTURE_ORIGIN' in os.environ else [], 'service': [{'id': '#atproto_pds', 'type': 'AtprotoPersonalDataServer', 'serviceEndpoint': 'https://127.0.0.1' if self.mode == 'private-pds' else PDS}]}, content_type='application/did+ld+json') if path == '/.well-known/oauth-protected-resource': return self.send(200, {'resource': PDS, 'authorization_servers': [ISSUER]}) if path == '/.well-known/oauth-authorization-server': diff --git a/dashboard/web/pages/SignIn.css b/dashboard/web/pages/SignIn.css index f3bfd94dc7ebe2072a59f2b5d14ad535733a3560..b34dd181f61be0e15e9e70b7e9ca036e396435a7 100644 --- a/dashboard/web/pages/SignIn.css +++ b/dashboard/web/pages/SignIn.css @@ -8,7 +8,7 @@ body { font: 16px "Name Sans", sans-serif; } .guest-providers { margin-bottom: 1.5rem; } .sign-in-account { margin-bottom: 1.25rem; } .sign-in-account h2 { margin: 0; color: var(--primary); font-size: 28px; line-height: 1.2; font-weight: 500; text-align: center; text-transform: none; overflow-wrap: anywhere; } -.sign-in-account button { display: inline-flex; align-items: center; gap: .375rem; margin-bottom: .75rem; background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; } +.sign-in-account :is(a, button) { display: inline-flex; align-items: center; gap: .375rem; margin-bottom: .75rem; background: none; border: 0; padding: 0; color: var(--primary); text-decoration: none; cursor: pointer; } .pf-v5-c-login__main .guest-providers a { display: grid; grid-template-columns: 20px minmax(0, 1fr) 20px; @@ -25,7 +25,10 @@ body { font: 16px "Name Sans", sans-serif; } .guest-providers a[data-provider="astheno"]:hover { background-color: #4d5e35; } .guest-providers a[data-provider="github"] { background-color: white; color: #24292f; } .guest-providers a[data-provider="github"]:hover { background-color: #f0f3f6; } +.guest-providers a[data-provider="atproto"] { background-color: #1185fe; color: white; } +.guest-providers a[data-provider="atproto"]:hover { background-color: #0a6fe0; } +.guest-providers span:has(> svg) svg { width: 18px; height: 18px; } .guest-providers a:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; } -.guest-providers svg, .guest-providers img { display: block; } +.guest-providers svg, .guest-providers img, .guest-providers span:has(> svg) { display: block; } @media (prefers-reduced-motion: reduce) { .guest-providers a { transition: none; } } .guest-providers a + a { margin-top: .75rem; } diff --git a/dashboard/web/pages/SignIn.tsx b/dashboard/web/pages/SignIn.tsx index ca55f6c0aead51840270c4a21397fda6c7e82ae1..e1b6bdf36b243e2dfa2d1716bce99e5d512e2431 100644 --- a/dashboard/web/pages/SignIn.tsx +++ b/dashboard/web/pages/SignIn.tsx @@ -1,7 +1,7 @@ import { createEffect, createResource, createSignal, For, onCleanup, onMount, Show } from "solid-js"; import { authReason, authRequest } from "../auth.ts"; import ArrowLeft from "lucide-solid/icons/arrow-left"; -import atprotoIcon from "../sso/atproto.svg"; +import atprotoIcon from "../sso/atproto.svg?raw"; import Stone from "lucide-solid/icons/stone"; import githubIcon from "../sso/github.svg"; import theme from "../sso/css/styles.css?inline"; @@ -22,7 +22,7 @@ export function SignIn() { const [passwordStep, setPasswordStep] = createSignal(false); const [visible, setVisible] = createSignal(false); const [busy, setBusy] = createSignal(false); - const [error, setError] = createSignal(params.has("guest_error") ? (atproto ? "Sign-in couldn't start. Check your handle or DID and try again." : "Guest sign-in wasn't completed. Choose a provider to try again.") : ""); + const [error, setError] = createSignal(params.has("guest_error") ? (atproto ? "Sign-in couldn't start. Check your handle and try again." : "Guest sign-in wasn't completed. Choose a provider to try again.") : ""); const [notice, setNotice] = createSignal(""); let conditional: AbortController | undefined; let disposed = false; @@ -91,19 +91,19 @@ export function SignIn() { refetch()}>try again}> { if (busy()) { event.preventDefault(); return; } setBusy(true); setError(""); }}> - +
- - queueMicrotask(() => input.focus())} /> -

Your provider will ask you to approve sign-in.

+ + queueMicrotask(() => input.focus())} /> + custom domain handles work too.
}>
diff --git a/dashboard/web/sso/atproto.svg b/dashboard/web/sso/atproto.svg index e834fdff4f6e2dcde2884c0a22c79d7ed584cac1..33fbf1fd0dcff6044f6a206c3c7a8d9aca4e22d9 100644 --- a/dashboard/web/sso/atproto.svg +++ b/dashboard/web/sso/atproto.svg @@ -1 +1 @@ -@ + -- 2.54.1