| author | |
| committer | |
| log | 57c9b46f0ed0bc47f12f29b64a2f3962fcc712d3 |
| tree | 5c190f9cd61f1c31f30a4eea6e4a4030f4124831 |
| parent | 98f5cad4a37277e29c08152dca2ac5c121b4c45a |
| signature | Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU |
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.56 files changed, 18 insertions(+), 21 deletions(-)
dashboard/src/atproto.rs+1-7| ... | ... | @@ -160,13 +160,7 @@ async fn get(url: Url) -> Result<Value> { |
| 160 | 160 | .send() |
| 161 | 161 | .await |
| 162 | 162 | .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 { | |
| 170 | 164 | return Err(reject()); |
| 171 | 165 | } |
| 172 | 166 | 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> { |
| 32 | 32 | match provider { |
| 33 | 33 | "github" => Ok("GitHub"), |
| 34 | 34 | "astheno" => Ok("Astheno"), |
| 35 | "atproto" => Ok("AT Protocol"), | |
| 35 | "atproto" => Ok("Bluesky"), | |
| 36 | 36 | _ => Err(Error::new( |
| 37 | 37 | 404, |
| 38 | 38 | "Choose a provider on the Shale sign-in page.", |
dashboard/tests/atproto-fixture.py+3-3| ... | ... | @@ -46,10 +46,10 @@ class Fixture(BaseHTTPRequestHandler): |
| 46 | 46 | def log_message(self, *_): |
| 47 | 47 | pass |
| 48 | 48 | |
| 49 | def send(self, code, value, nonce=False): | |
| 49 | def send(self, code, value, nonce=False, content_type='application/json'): | |
| 50 | 50 | body = json.dumps(value).encode() |
| 51 | 51 | self.send_response(code) |
| 52 | self.send_header('Content-Type', 'application/json') | |
| 52 | self.send_header('Content-Type', content_type) | |
| 53 | 53 | self.send_header('Content-Length', str(len(body))) |
| 54 | 54 | if nonce and self.mode != 'missing-nonce': |
| 55 | 55 | self.send_header('DPoP-Nonce', self.nonce) |
| ... | ... | @@ -85,7 +85,7 @@ class Fixture(BaseHTTPRequestHandler): |
| 85 | 85 | type(self).mode = parse_qs(urlsplit(self.path).query).get('mode', [''])[0] |
| 86 | 86 | return self.send(200, {}) |
| 87 | 87 | 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') | |
| 89 | 89 | if path == '/.well-known/oauth-protected-resource': |
| 90 | 90 | return self.send(200, {'resource': PDS, 'authorization_servers': [ISSUER]}) |
| 91 | 91 | 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; } |
| 8 | 8 | .guest-providers { margin-bottom: 1.5rem; } |
| 9 | 9 | .sign-in-account { margin-bottom: 1.25rem; } |
| 10 | 10 | .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; } | |
| 12 | 12 | .pf-v5-c-login__main .guest-providers a { |
| 13 | 13 | display: grid; |
| 14 | 14 | grid-template-columns: 20px minmax(0, 1fr) 20px; |
| ... | ... | @@ -25,7 +25,10 @@ body { font: 16px "Name Sans", sans-serif; } |
| 25 | 25 | .guest-providers a[data-provider="astheno"]:hover { background-color: #4d5e35; } |
| 26 | 26 | .guest-providers a[data-provider="github"] { background-color: white; color: #24292f; } |
| 27 | 27 | .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; } | |
| 28 | 31 | .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; } | |
| 30 | 33 | @media (prefers-reduced-motion: reduce) { .guest-providers a { transition: none; } } |
| 31 | 34 | .guest-providers a + a { margin-top: .75rem; } |
dashboard/web/pages/SignIn.tsx+7-7| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | import { createEffect, createResource, createSignal, For, onCleanup, onMount, Show } from "solid-js"; |
| 2 | 2 | import { authReason, authRequest } from "../auth.ts"; |
| 3 | 3 | import ArrowLeft from "lucide-solid/icons/arrow-left"; |
| 4 | import atprotoIcon from "../sso/atproto.svg"; | |
| 4 | import atprotoIcon from "../sso/atproto.svg?raw"; | |
| 5 | 5 | import Stone from "lucide-solid/icons/stone"; |
| 6 | 6 | import githubIcon from "../sso/github.svg"; |
| 7 | 7 | import theme from "../sso/css/styles.css?inline"; |
| ... | ... | @@ -22,7 +22,7 @@ export function SignIn() { |
| 22 | 22 | const [passwordStep, setPasswordStep] = createSignal(false); |
| 23 | 23 | const [visible, setVisible] = createSignal(false); |
| 24 | 24 | 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.") : ""); | |
| 26 | 26 | const [notice, setNotice] = createSignal(""); |
| 27 | 27 | let conditional: AbortController | undefined; |
| 28 | 28 | let disposed = false; |
| ... | ... | @@ -91,19 +91,19 @@ export function SignIn() { |
| 91 | 91 | <Show when={!status.error} fallback={<button class="pf-v5-c-button pf-m-primary pf-m-block" onClick={() => refetch()}>try again</button>}> |
| 92 | 92 | <Show when={!atproto} fallback={ |
| 93 | 93 | <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> | |
| 95 | 95 | <input type="hidden" name="next" value={params.get("next") ?? ""} /> |
| 96 | 96 | <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> | |
| 100 | 100 | </div> |
| 101 | 101 | <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> |
| 102 | 102 | </form> |
| 103 | 103 | }> |
| 104 | 104 | <Show when={!setup && !passwordStep() && status()?.providers?.length}> |
| 105 | 105 | <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> | |
| 107 | 107 | </div> |
| 108 | 108 | </Show> |
| 109 | 109 | <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> |