Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto substandard.blog
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132---import Layout from "../layouts/Layout.astro";
// The diagram is inlined rather than loaded, for the same reason the wordmark// is on the homepage: as one element in the document it takes the page's theme// tokens (see `.diagram` in global.css) instead of baking in one palette.//// It is inlined *pre-rendered*, because substandard.blog is served behind a// strict CSP with no `unsafe-inline` and no `unsafe-eval`: a client-side// Mermaid would need a script the CSP blocks. `npm --prefix web run diagram`// renders web/src/diagrams/architecture.mmd in headless Chrome and strips the// CSS the CSP would drop; nothing here ships a script.import diagram from "../diagrams/architecture.svg?raw";
const REPO = "https://tangled.org/permadeath.com/substandard";const src = (path: string) => `${REPO}/blob/main/${path}`;
// Who calls whom. Every row is a request the extension makes itself; links a// person clicks (a reader, a Bluesky profile) are left out, since they are// ordinary navigations and not the extension talking.const calls = [ { from: "background worker", to: "the site you are viewing", what: "GET /.well-known/site.standard.publication", why: "detect a publication, and check that its record points back at the site", }, { from: "background worker, popup", to: "plc.directory, public.api.bsky.app", what: "DID documents, identity.resolveHandle (including whether a site's host is a handle)", why: "turn a DID into a PDS host, and a handle into a DID", }, { from: "background worker, popup", to: "the publication's PDS", what: "repo.getRecord", why: "the publication and document records the page's link tags name", }, { from: "background worker, popup", to: "your PDS", what: "repo.listRecords", why: "your own subscriptions, blocks and follows, to know what to show", }, { from: "popup", to: "the owner's PDS", what: "repo.getRecord, sync.getBlob", why: "the owner's profile, and avatar or publication icon images", }, { from: "popup", to: "constellation.microcosm.blue", what: "GET /links/distinct-dids, GET /links/count", why: "who else has a subscription record pointing at this publication, and how many documents point at it", }, { from: "popup", to: "public.api.bsky.app", what: "app.bsky.feed.getPosts", why: "reply, repost and like counts for the article's Bluesky thread, when its document record names one", }, { from: "popup", to: "api.bsky.app", what: "app.bsky.feed.searchPosts", why: "other people's posts that link to the article's canonical URL", }, { from: "popup", to: "the labelers your account subscribes to", what: "label.queryLabels", why: "moderation labels on the publication and its owner", }, { from: "popup", to: "your PDS", what: "repo.createRecord, repo.deleteRecord", why: "subscribe and unsubscribe; post feedback if you use the feedback form", }, { from: "OAuth host (offscreen document on Chrome, background page on Firefox)", to: "your PDS and its authorization server", what: "OAuth: authorization request, token refresh (daily keepalive), revoke", why: "sign in, refresh, and sign out", },];
// Where anything that outlives a single request is kept. All of it is local;// there is no substandard-operated server for it to be kept on.const storage = [ { where: "extension session storage", what: "per-tab detection state, well-known probe results, short-lived lookups", life: "cleared when the browser closes", }, { where: "extension local storage", what: "your follow list, your chosen reader, and a non-secret session mirror (DID, handle, avatar URL)", life: "until you clear it or uninstall", }, { where: "extension-origin IndexedDB and localStorage", what: "OAuth tokens, DPoP keys and PKCE state, written by the OAuth client", life: "until sign-out or uninstall", },];---
<Layout title="substandard architecture" description="The substandard extension's components, and which network calls each one makes."> <header class="hero"> <h1>architecture</h1> </header>
<main class="wide"> <section> <h2>how it works</h2> <p> The extension runs in your browser and talks to AT Protocol services directly. </p> <p> This includes the site you're on, both their and your PDS, and ecosystem services (like Bluesky APIs). </p> <figure class="diagram" set:html={diagram} /> </section> </main></Layout>