authoravatarclover caruso<git@paperclover.net>2026-10-18 12:01:14-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-21 02:52:29-07:00
log57c9b46f0ed0bc47f12f29b64a2f3962fcc712d3
tree5c190f9cd61f1c31f30a4eea6e4a4030f4124831
parent98f5cad4a37277e29c08152dca2ac5c121b4c45a
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

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

6 files changed, 18 insertions(+), 21 deletions(-)

dashboard/src/atproto.rs+1-7
......@@ -160,13 +160,7 @@ async fn get(url: Url) -> Result<Value> {
160160 .send()
161161 .await
162162 .map_err(|_| reject())?;
163 if response.status() != StatusCode::OK
164 || response
165 .headers()
166 .get("content-type")
167 .and_then(|v| v.to_str().ok())
168 .is_none_or(|v| v.split(';').next() != Some("application/json"))
169 {
163 if response.status() != StatusCode::OK {
170164 return Err(reject());
171165 }
172166 serde_json::from_slice(&bytes(response, 65536).await?).map_err(|_| reject())
dashboard/src/guest.rs+1-1
......@@ -32,7 +32,7 @@ fn known(provider: &str) -> Result<&str> {
3232 match provider {
3333 "github" => Ok("GitHub"),
3434 "astheno" => Ok("Astheno"),
35 "atproto" => Ok("AT Protocol"),
35 "atproto" => Ok("Bluesky"),
3636 _ => Err(Error::new(
3737 404,
3838 "Choose a provider on the Shale sign-in page.",
dashboard/tests/atproto-fixture.py+3-3
......@@ -46,10 +46,10 @@ class Fixture(BaseHTTPRequestHandler):
4646 def log_message(self, *_):
4747 pass
4848
49 def send(self, code, value, nonce=False):
49 def send(self, code, value, nonce=False, content_type='application/json'):
5050 body = json.dumps(value).encode()
5151 self.send_response(code)
52 self.send_header('Content-Type', 'application/json')
52 self.send_header('Content-Type', content_type)
5353 self.send_header('Content-Length', str(len(body)))
5454 if nonce and self.mode != 'missing-nonce':
5555 self.send_header('DPoP-Nonce', self.nonce)
......@@ -85,7 +85,7 @@ class Fixture(BaseHTTPRequestHandler):
8585 type(self).mode = parse_qs(urlsplit(self.path).query).get('mode', [''])[0]
8686 return self.send(200, {})
8787 if path == '/.well-known/did.json':
88 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}]})
88 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')
8989 if path == '/.well-known/oauth-protected-resource':
9090 return self.send(200, {'resource': PDS, 'authorization_servers': [ISSUER]})
9191 if path == '/.well-known/oauth-authorization-server':
dashboard/web/pages/SignIn.css+5-2
......@@ -8,7 +8,7 @@ body { font: 16px "Name Sans", sans-serif; }
88.guest-providers { margin-bottom: 1.5rem; }
99.sign-in-account { margin-bottom: 1.25rem; }
1010.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; }
11.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; }
11.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; }
1212.pf-v5-c-login__main .guest-providers a {
1313 display: grid;
1414 grid-template-columns: 20px minmax(0, 1fr) 20px;
......@@ -25,7 +25,10 @@ body { font: 16px "Name Sans", sans-serif; }
2525.guest-providers a[data-provider="astheno"]:hover { background-color: #4d5e35; }
2626.guest-providers a[data-provider="github"] { background-color: white; color: #24292f; }
2727.guest-providers a[data-provider="github"]:hover { background-color: #f0f3f6; }
28.guest-providers a[data-provider="atproto"] { background-color: #1185fe; color: white; }
29.guest-providers a[data-provider="atproto"]:hover { background-color: #0a6fe0; }
30.guest-providers span:has(> svg) svg { width: 18px; height: 18px; }
2831.guest-providers a:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
29.guest-providers svg, .guest-providers img { display: block; }
32.guest-providers svg, .guest-providers img, .guest-providers span:has(> svg) { display: block; }
3033@media (prefers-reduced-motion: reduce) { .guest-providers a { transition: none; } }
3134.guest-providers a + a { margin-top: .75rem; }
dashboard/web/pages/SignIn.tsx+7-7
......@@ -1,7 +1,7 @@
11import { createEffect, createResource, createSignal, For, onCleanup, onMount, Show } from "solid-js";
22import { authReason, authRequest } from "../auth.ts";
33import ArrowLeft from "lucide-solid/icons/arrow-left";
4import atprotoIcon from "../sso/atproto.svg";
4import atprotoIcon from "../sso/atproto.svg?raw";
55import Stone from "lucide-solid/icons/stone";
66import githubIcon from "../sso/github.svg";
77import theme from "../sso/css/styles.css?inline";
......@@ -22,7 +22,7 @@ export function SignIn() {
2222 const [passwordStep, setPasswordStep] = createSignal(false);
2323 const [visible, setVisible] = createSignal(false);
2424 const [busy, setBusy] = createSignal(false);
25 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.") : "");
25 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.") : "");
2626 const [notice, setNotice] = createSignal("");
2727 let conditional: AbortController | undefined;
2828 let disposed = false;
......@@ -91,19 +91,19 @@ export function SignIn() {
9191 <Show when={!status.error} fallback={<button class="pf-v5-c-button pf-m-primary pf-m-block" onClick={() => refetch()}>try again</button>}>
9292 <Show when={!atproto} fallback={
9393 <form action="/auth/guest/start/atproto" method="get" onSubmit={(event) => { if (busy()) { event.preventDefault(); return; } setBusy(true); setError(""); }}>
94 <div class="sign-in-account"><a rel="external" href={`/sign-in?${statusQuery}`}><ArrowLeft size={18} aria-hidden="true" />back</a></div>
94 <div class="sign-in-account"><a rel="external" href={`/sign-in?${statusQuery}`}><ArrowLeft size={18} aria-hidden="true" />back</a><h2>sign in with bluesky</h2></div>
9595 <input type="hidden" name="next" value={params.get("next") ?? ""} />
9696 <div class="pf-v5-c-form__group">
97 <label for="atproto-identifier" class="pf-v5-c-form__label">handle or DID</label>
98 <input id="atproto-identifier" name="identifier" class="pf-v5-c-form-control" required maxlength={2048} autocomplete="username" autocapitalize="none" spellcheck={false} placeholder="you.example.com" aria-describedby="atproto-hint" autofocus ref={(input) => queueMicrotask(() => input.focus())} />
99 <p id="atproto-hint">Your provider will ask you to approve sign-in.</p>
97 <label for="atproto-identifier" class="pf-v5-c-form__label">handle</label>
98 <input id="atproto-identifier" name="identifier" class="pf-v5-c-form-control" required maxlength={2048} autocomplete="username" autocapitalize="none" spellcheck={false} placeholder="you.bsky.social" aria-describedby="atproto-hint" autofocus ref={(input) => queueMicrotask(() => input.focus())} />
99 <span id="atproto-hint" class="pf-v5-c-helper-text__item-text">custom domain handles work too.</span>
100100 </div>
101101 <div id="kc-form-buttons" class="pf-v5-c-form__group"><button class="pf-v5-c-button pf-m-primary pf-m-block" type="submit" disabled={busy() || !status()} aria-busy={busy()}>{busy() ? "connecting…" : "continue"}</button></div>
102102 </form>
103103 }>
104104 <Show when={!setup && !passwordStep() && status()?.providers?.length}>
105105 <div id="kc-social-providers" class="guest-providers">
106 <For each={status()?.providers}>{(provider) => <a rel="external" data-provider={provider.id} class="pf-v5-c-button pf-m-primary pf-m-block" href={provider.id === "atproto" ? `/sign-in?${statusQuery}&atproto=1` : `/auth/guest/start/${provider.id}?next=${encodeURIComponent(params.get("next") ?? "")}`}>{provider.id === "atproto" ? <img src={atprotoIcon} width="18" height="18" alt="" /> : provider.id === "astheno" ? <Stone size={18} aria-hidden="true" /> : <img src={githubIcon} width="18" height="18" alt="" />}<span>continue with {provider.name}</span></a>}</For>
106 <For each={status()?.providers}>{(provider) => <a rel="external" data-provider={provider.id} class="pf-v5-c-button pf-m-primary pf-m-block" href={provider.id === "atproto" ? `/sign-in?${statusQuery}&atproto=1` : `/auth/guest/start/${provider.id}?next=${encodeURIComponent(params.get("next") ?? "")}`}>{provider.id === "atproto" ? <span innerHTML={atprotoIcon} /> : provider.id === "astheno" ? <Stone size={18} aria-hidden="true" /> : <img src={githubIcon} width="18" height="18" alt="" />}<span>continue with {provider.name}</span></a>}</For>
107107 </div>
108108 </Show>
109109 <div id="kc-form"><div id="kc-form-wrapper">
dashboard/web/sso/atproto.svg+1-1
......@@ -1 +1 @@
1<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><text x="12" y="18" text-anchor="middle" font-family="sans-serif" font-size="22" fill="currentColor" stroke="none">@</text></svg>
1<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 530"><path fill="currentColor" stroke="none" d="m135.72 44.03c66.496 49.921 138.02 151.14 164.28 205.46 26.262-54.316 97.782-155.54 164.28-205.46 47.98-36.021 125.72-63.892 125.72 24.795 0 17.712-10.155 148.79-16.111 170.07-20.703 73.984-96.144 92.854-163.25 81.433 117.3 19.964 147.14 86.092 82.697 152.22-122.39 125.59-175.91-31.511-189.63-71.766-2.514-7.3797-3.6904-10.832-3.7077-7.8964-0.0174-2.9357-1.1937 0.51669-3.7077 7.8964-13.714 40.255-67.233 197.36-189.63 71.766-64.444-66.128-34.605-132.26 82.697-152.22-67.108 11.421-142.55-7.4491-163.25-81.433-5.9562-21.282-16.111-152.36-16.111-170.07 0-88.687 77.742-60.816 125.72-24.795z"/></svg>