Browser extension: detect and subscribe to standard.site publications on ATProto substandard.blog
6.4 kB · 128 lines
Markdown
at main

threadbare #

A browser app for finding your own long Bluesky threads and exporting one as Markdown.

The browser build of longread, served at threadbare.substandard.blog. It is a substandard subsite: same paper, ink, red pen and hard misprint shadows as substandard.blog. It reads public Bluesky records directly, with no backend. Sign-in with atproto is required; the session identifies the account and grants no write access.

What it does #

  • Sign in uses atproto OAuth with the identity-only atproto scope. The app is unavailable without a session.
  • Scan runs automatically for the signed-in account and surfaces its long self-threads that are worth writing up, scored with the same six-composite tree as panoptiblog. The run reads all available history, includes threads that start as replies, and requires five posts. There is no word floor; the score weighs prose and depth. The list starts at the top quarter by percentile; lower-scoring threads sit behind a Show button.

Each thread carries up to five topics: words drawn from its own text with a bundled stopword list. The extraction is local and deterministic. It is not a model, makes no extra request, and does not affect the ranking.

Each result is a compact row: a 1/n thread spine, the author's avatar, display name and handle, a two-line root snippet, the first image as a thumbnail, engagement, three topics, and the score. The full root and its quoted posts are in the thread view. The card is rendered from public records, not an embed.bsky.app iframe, so it keeps the substandard theme and makes no third-party request.

Rows have a ⋯ menu for opening the post on Bluesky. Copy Markdown appears only when the thread belongs to the signed-in account. Copy writes the Markdown body without its frontmatter; Copy Bluesky link copies the root post URL for an editor's Bluesky embed or bskyPostRef field; Download .md writes the full file with standard.site fields and the thread's source and author. Long result sets render 50 rows at a time, and a running scan is cancelled when the route changes.

The score is panoptiblog's canonical tree, version 19, from scripts/panoptiblog/score-tree.json. Six composites (Audience, Volume, Consistency, Style, Pulse and Network) average percentile-ranked factors; the overall raw score averages the composites, and the displayed score is that raw score's percentile among the scanned threads. A scan run is one cohort. Factors that describe publications use thread-scoped inputs with the same ids and bounds: likes, reposts plus quotes, quotes per kiloword, attention against the author's median, thread continuity and post formats. Expanding the score shows the overall percentile and cohort, each composite and factor with its weight, scale, raw value and percentile, the engagement counts, and any score notes.

What it looks for #

Long self-threads that can stand alone: one line of thought, enough prose and structure to read as an essay, and a voice that holds. Link dumps and short reaction chains fall on depth, structure and continuity.

This is not a best-performing list. Audience — likes, reposts and quotes — is one of six composites. A quiet thread with strong writing, volume and continuity can outrank a popular but thin one. Engagement is a diagnostic, and the score is a percentile within the scanned cohort.

Strong content labels (!hide, spam, scam, impersonation) hide a row behind a “show hidden” toggle; adult and graphic labels show a content warning with a Show button. The thread view applies the same rule. If a post has forks, the card shows ⑂ n and the thread view lists every branch, with the chosen path marked and clickable alternatives.

Quoted posts are fetched and rendered inline. A quote whose author carries !no-unauthenticated stays a link, matching the CLI's opt-out rule.

Develop #

npm install
npm run build:wasm   # compiles infra/longread/wasm to src/wasm
npm run dev

npm run check runs tsc --noEmit. npm test runs the unit tests. npm run build writes dist/.

A harness can build with VITE_THREADBARE_TEST_DID=<did> to exercise the signed-in UI without an OAuth round trip. Normal builds leave it unset.

The Vite dev server is pinned to 127.0.0.1:5190. The threadbare wordmark is src/assets/threadbare.svg; the substandard wordmark comes from brand/. The sticker favicon is copied by the threadbare-favicon prek hook.

Sign-in #

public/client-metadata.json is the OAuth client. It asks for atproto only, so the session identifies the account and grants no write access. The callback is /oauth/callback; a CloudFront viewer-request function rewrites that path to index.html, so the static release handles it. The metadata lists only the production callback. On local dev, src/auth.ts builds a loopback client instead. The authorization server fetches the metadata from the production URL, so a local sign-in works after that metadata is deployed.

Analytics #

src/analytics.ts sends PostHog events to the substandard.blog EU project, only from threadbare.substandard.blog. It keeps posthog-js's default persistence, so unlike the frontpage it sets a cookie and localStorage. The cookie is host-only and never reaches substandard.blog. Elements that show a handle, a DID or an at:// link carry ph-no-capture. before_send drops the OAuth code, state and iss parameters and the hash route's query from every URL. Session recording and surveys are off.

Deploy #

scripts/deploy-threadbare.sh builds the app, uploads an immutable release tree to s3://threadbare.substandard.blog/releases/<sha>/, and flips CloudFront with tofu apply. The Route53 zone, certificate, bucket and distribution live in infra/threadbare.tf. The release includes client-metadata.json; the authorization server fetches it from the deployed site, so sign-in works only after the first deploy.

The first apply needs AWS credentials and a release_sha for the frontpage in infra/terraform.tfvars.json; scripts/deploy-site.sh writes that value.

Browser support #

Reading public.api.bsky.app, plc.directory and PDS listRecords endpoints from the browser relies on their access-control-allow-origin: * responses. did:web documents must also send CORS headers; most accounts are did:plc.