Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 573a508288188553a86ab3fed228633a490fa7bb
parent 284247fd065347b2d35e09511560ad105c12fea8
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 27 Oct 2026 13:26:44 -0400

thread shot: only a gold or grey check exempts the replied-to author from the blur

X's blue check is X Premium's, bought by anyone. The live proof's parent
(@Toothless2210, a person asking "How's Huck?" under TheQuartering's
post) carries one, and the first rule left him unblurred. The snapshot
now reads which check it is (the gold's gradient, the blue's and grey's
fills); only an organisation's gold or a government's grey counts as
verified. A blue-checked author is blurred with reason "blue-check", the
badge is recorded as parentBadge, and threadRedact: false still lets a
public blue-checked author through.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mcommon/social/postCapture.ts | 9+++++++--
Mcommon/social/xThreadShot.test.ts | 27++++++++++++++++++---------
Mcommon/social/xThreadShot.ts | 38+++++++++++++++++++++++++++++++-------
3 files changed, 56 insertions(+), 18 deletions(-)

diff --git a/common/social/postCapture.ts b/common/social/postCapture.ts @@ -136,11 +136,14 @@ export type ArticleCaptureRecord = { // Why a thread shot's parent author was or was not blurred: // private — the parent's author is neither verified nor the reply's own // (the default's reason to blur) -// verified — the parent's author carries X's verified badge: not blurred +// blue-check — the parent's author carries only X Premium's blue check, +// which anyone can buy: blurred like a private author +// verified — the parent's author carries an organisation's gold check or a +// government's grey one: not blurred // self — a self-thread: the parent is the reply's own author's // off — the capture (or its channel) turned the blur off // forced — the capture asked for the blur whatever the author -export type ThreadRedactionReason = "private" | "verified" | "self" | "off" | "forced"; +export type ThreadRedactionReason = "private" | "blue-check" | "verified" | "self" | "off" | "forced"; // One blurred box of a thread shot, in the shot's own pixels (its top-left // is 0,0), and what it covered. @@ -156,7 +159,9 @@ export type ThreadCaptureRecord = CapturedFile & { parentHandle?: string; // The parent's display name as the page showed it. parentAuthor?: string; + // Any check by the name (parentBadge says which). parentVerified: boolean; + parentBadge?: "blue" | "gold" | "grey" | "other"; // How the parent was told on the page: its status link matched the // archive's in-reply-to id, or (the archive not saying) the post directly // above the reply. diff --git a/common/social/xThreadShot.test.ts b/common/social/xThreadShot.test.ts @@ -88,22 +88,31 @@ test("parent: a post with nothing above it is not a reply; an unmarked page has // --- the blur ------------------------------------------------------------------ -test("blur: a private author is blurred; a verified one or the reply's own author is not; the knob overrides", () => { - assert.deepEqual(threadRedaction({ parentHandle: "Toothless2210", parentVerified: false, ownHandle: "TheQuartering" }), { +test("blur: a private author is blurred; a gold- or grey-checked one or the reply's own author is not; the knob overrides", () => { + assert.deepEqual(threadRedaction({ parentHandle: "someone", parentVerified: false, ownHandle: "TheQuartering" }), { redact: true, reason: "private", }); - assert.deepEqual(threadRedaction({ parentHandle: "elonmusk", parentVerified: true, ownHandle: "TheQuartering" }), { - redact: false, - reason: "verified", - }); + for (const parentBadge of ["gold", "grey"] as const) { + assert.deepEqual(threadRedaction({ parentHandle: "org", parentVerified: true, parentBadge, ownHandle: "TheQuartering" }), { + redact: false, + reason: "verified", + }); + } + // X Premium's blue check is bought: the proof run's parent (a person asking "How's Huck?") carries one. + for (const parentBadge of ["blue", "other", undefined] as const) { + assert.deepEqual(threadRedaction({ parentHandle: "Toothless2210", parentVerified: true, parentBadge, ownHandle: "TheQuartering" }), { + redact: true, + reason: "blue-check", + }); + } // A self-thread, whatever the case or the @. assert.deepEqual(threadRedaction({ parentHandle: "thequartering", parentVerified: false, ownHandle: "@TheQuartering" }), { redact: false, reason: "self", }); assert.deepEqual(threadRedaction({ parentHandle: "x", parentVerified: false, ownHandle: "y" }, false), { redact: false, reason: "off" }); - assert.deepEqual(threadRedaction({ parentHandle: "x", parentVerified: true, ownHandle: "y" }, true), { redact: true, reason: "forced" }); + assert.deepEqual(threadRedaction({ parentHandle: "x", parentVerified: true, parentBadge: "gold", ownHandle: "y" }, true), { redact: true, reason: "forced" }); // No own handle known: not a self-thread. assert.equal(threadRedaction({ parentHandle: "x", parentVerified: false }).redact, true); }); @@ -228,9 +237,9 @@ test("shot: the union from the parent's top to the reply's bottom, the private a assert.deepEqual(new Uint8Array(await readFile(path.join(dir, THREAD_SHOT_FILENAME))), THREAD_PNG); }); -test("shot: a verified parent is shot unblurred; a parent whose name cannot be found to blur gets no shot", async () => { +test("shot: a gold-checked parent is shot unblurred; a parent whose name cannot be found to blur gets no shot", async () => { const dir = path.join(await mkdtemp(path.join(os.tmpdir(), "xthread-")), "1"); - const verified = { ...CHAIN, articles: CHAIN.articles.map((a, i) => (i === 1 ? { ...a, verified: true } : a)) }; + const verified = { ...CHAIN, articles: CHAIN.articles.map((a, i) => (i === 1 ? { ...a, verified: true, badge: "gold" as const } : a)) }; const p = threadPage({ snap: verified }); const res = await shootXThread(p, "1", dir, { replyTo: { id: "2114113495989907691" } }); assert.ok("thread" in res); diff --git a/common/social/xThreadShot.ts b/common/social/xThreadShot.ts @@ -18,14 +18,19 @@ // public one. By default the shot blurs the parent's avatar, display name and // @handle, and every link to their profile in the reply (the "Replying to" // line and any @mention), unless the parent's author is verified or is the -// reply's own author (a self-thread). The blur is a CSS filter set on those +// reply's own author (a self-thread). VERIFIED MEANS AN ORGANISATION'S GOLD +// CHECK OR A GOVERNMENT'S GREY ONE: X's blue check is X Premium's, bought by +// anyone, so a blue-checked private person is blurred like any other (the +// proof run's parent was one: a person asking "How's Huck?"); the badge is +// recorded either way, and `redact: false` lets a public blue-checked +// author through. The blur is a CSS filter set on those // elements in the page before the shot; their boxes are measured after it // and recorded, in the shot's own pixels, in capture.json. A parent whose // name cannot be found to blur gets NO thread shot: the blur is not skipped // to get a picture. // // `redact: false` turns the blur off (an author the operator has judged -// public); `redact: true` blurs even a verified author. +// public); `redact: true` blurs even a gold- or grey-checked author. // // NOT VERIFIED AGAINST LIVE X beyond the one proof run the CHANGELOG names; // the markers are X's as of 2026-10. @@ -60,11 +65,16 @@ export type ThreadArticle = { // The display name: User-Name's first line. name?: string; verified: boolean; + // Which check it carries: X Premium's blue, an organisation's gold, a + // government's grey, or one the snapshot could not tell. + badge?: XBadge; // Its box's top and bottom, document coordinates. top: number; bottom: number; }; +export type XBadge = "blue" | "gold" | "grey" | "other"; + export type ThreadSnapshot = { // The post's own article among `articles`, or -1 when it is not marked. own: number; @@ -83,9 +93,20 @@ export const threadSnapshotScript = () => `(() => { } const un = a.querySelector('[data-testid="User-Name"]'); const name = un ? ((un.innerText || "").split("\\n")[0] || "").trim() : ""; - const verified = !!(un && un.querySelector('[data-testid="icon-verified"]')); + const icon = un && un.querySelector('[data-testid="icon-verified"]'); + const verified = !!icon; + let badge; + if (icon) { + // Gold is drawn with a gradient; blue and grey are one fill, X's own colours. + const paint = [getComputedStyle(icon).color, icon.getAttribute("fill") || "", + ...Array.from(icon.querySelectorAll("[fill]")).map((e) => e.getAttribute("fill") || "")].join(" "); + badge = /linearGradient/i.test(icon.outerHTML) ? "gold" + : /29,\\s*155,\\s*240|#1d9bf0/i.test(paint) ? "blue" + : /130,\\s*154,\\s*171|#829aab/i.test(paint) ? "grey" + : "other"; + } const r = a.getBoundingClientRect(); - return { id, handle, name: name || undefined, verified, top: r.top + window.scrollY, bottom: r.bottom + window.scrollY }; + return { id, handle, name: name || undefined, verified, badge, top: r.top + window.scrollY, bottom: r.bottom + window.scrollY }; }); return { own, articles }; })()`; @@ -125,15 +146,17 @@ export function pickThreadParent( } // Whether the parent's author is blurred, and why. Pure. +// Only a gold or grey check is "verified" here: the blue is bought (above). export function threadRedaction( - p: { parentHandle?: string; parentVerified: boolean; ownHandle?: string }, + p: { parentHandle?: string; parentVerified: boolean; parentBadge?: XBadge; ownHandle?: string }, redact?: boolean, ): { redact: boolean; reason: ThreadRedactionReason } { if (redact === false) return { redact: false, reason: "off" }; if (redact === true) return { redact: true, reason: "forced" }; const same = (a?: string, b?: string) => !!a && !!b && a.replace(/^@/, "").toLowerCase() === b.replace(/^@/, "").toLowerCase(); if (same(p.parentHandle, p.ownHandle)) return { redact: false, reason: "self" }; - if (p.parentVerified) return { redact: false, reason: "verified" }; + if (p.parentVerified && (p.parentBadge === "gold" || p.parentBadge === "grey")) return { redact: false, reason: "verified" }; + if (p.parentVerified) return { redact: true, reason: "blue-check" }; return { redact: true, reason: "private" }; } @@ -260,7 +283,7 @@ export async function shootXThread( const { parent } = pick; const ownHandle = opts.ownHandle ?? snap.articles[snap.own]?.handle; const choice = threadRedaction( - { parentHandle: parent.handle ?? opts.replyTo?.author, parentVerified: parent.verified, ownHandle }, + { parentHandle: parent.handle ?? opts.replyTo?.author, parentVerified: parent.verified, parentBadge: parent.badge, ownHandle }, opts.redact, ); if (!(await page.evaluate(markParentScript(pick.index)).catch(() => false))) { @@ -326,6 +349,7 @@ export async function shootXThread( ...(parent.handle ? { parentHandle: parent.handle } : {}), ...(parent.name ? { parentAuthor: parent.name } : {}), parentVerified: parent.verified, + ...(parent.badge ? { parentBadge: parent.badge } : {}), parentFrom: pick.from, redaction: { applied: choice.redact, reason: choice.reason, boxes }, },