From October to November 2026 the main branch's deploy command uploaded versions without
deploying them, so every release went live by a manual promote. The owner set it to
`npx wrangler deploy` on 2026-11-21; merging this is also the first check that a merge now
deploys by itself.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* docs: maintenance mode — policy, triage bot, issue forms, status badge, docs for 2.3.0
From v2.3.0 the project takes no new features (CONTRIBUTING.md, in Vietnamese and
English). Accepted: scheduled dependency updates; security fixes (High/Critical
advisories, runtime vulnerabilities); major language/runtime/framework upgrades; bug
fixes including UI/UX and accessibility; language fixes.
- .github/workflows/triage.yml + scripts/triage.mjs (unit-tested): an issue or pull
request whose title or label asks for a feature is labelled enhancement + out-of-scope,
answered in both languages and closed (issues as "not planned"). The owner's items, bots,
`maintenance-exception` and anything the owner does are left alone. It runs on
pull_request_target but checks out only that one script from the default branch, never a
pull request's code; workflow_dispatch is a dry run.
- Issue forms: blank issues off, questions and ideas to Discussions, security to the
private policy; a new language-problem form; the bug form no longer claims the site's
report button fills it (those reports go to a private repository). The pull request
template asks which of the five kinds of change it is.
- README: a maintenance-mode badge and a Status section; the admin paragraph describes
auto-publish. SECURITY.md: High/Critical fixes ship out of schedule; the age-check
answer is local storage only.
- Docs: decisions D21–D24, maintenance policy and cadence (17 §0, QODANA_TOKEN rotation),
roadmap frozen, CI (Qodana, whole-tree licences, triage, merge rules), architecture
tree, the Workers Builds deploy command, licence notes without the stale
license-checker/GSAP lines.
- CHANGELOG [2.3.0]; sonar.projectVersion 2.3.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: link #138 in the 2.3.0 changelog
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs: album labels come from both language entries
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ci): triage without a checkout, and linear title patterns
SonarCloud and Qodana on #139:
- githubactions:S7631 flags any checkout in a pull_request_target workflow, even of the
default branch. The workflow now reads scripts/triage.mjs from the default branch through
the API and imports it from a data: URL — nothing is checked out at all.
- javascript:S8786: `\s+a?\s*` let two quantifiers compete for the same spaces. The title
is trimmed once and the patterns are written so no two quantifiers overlap.
- Qodana RegExpRedundantEscape: the bot check is `endsWith("[bot]")`, no regex.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(content): content labels, an age check, blurred images and a warning banner
Posts, chapters and albums can carry content labels and an age rating:
- Labels (src/lib/content-labels.ts, names in src/i18n `labels`): horror, blood,
jumpscare, violence, self-harm, death — banner and blurred images; politics,
religion, strong-language, flashing-lights, spoilers — banner only. `contentWarning`
moves from stories to every long-form entry and albums, and single gallery photos can
carry their own (R2 list or captions.json). Unknown labels fail the build.
- Banner (ContentNotice.astro, replaces ContentWarning.astro): names every label in the
page's language, skipped by search. Images in a labelled region are blurred in plain
CSS by default — nothing sharp flashes before a script — and a real "Hiện ảnh"
checkbox un-blurs them through :has(), so it works with the keyboard and with
JavaScript off. A region without pictures shows no such line.
- Age check (AgeGate.astro, src/lib/age-gate.ts) for `ageRating` 13+/16+/18+: the text
sits in a closed <details> (search indexes the title, not the text); its summary asks
in a native modal <dialog> — focus starts on "No", Esc cancels and never means yes,
"No" explains and offers to choose again — and the answer is kept in localStorage
only (age thresholds, never an age or birth date). It never pops up on its own, and
without JavaScript the summary simply opens the text.
- Everywhere else: story/post/album cards name the labels (blurred covers), the lightbox
shows labelled photos blurred behind "Hiện ảnh", RSS descriptions start with the
warning in the item's language, OG cards carry it for blog posts too, JSON-LD
contentRating. The post page now uses the cover's alt text when there is one.
- Admin: a `multiselect` field for labels (with Vietnamese names), an age-rating select,
and per-photo labels in the gallery manager.
- Content (poli0981/content 98f7692): privacy policy §6 lists the age-check answer;
"Đêm không tiếng" chapters 1–2 are rated 16+.
- Tests: label and age-check logic, admin validation, labels kept on album save, RSS
prefix; the accessibility suite scans the gate folded and asked, checks focus, Esc,
No/Yes/reset and the keyboard reveal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(a11y): appendChild for the blur probe (astro check's DOM typing)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(content): findings from an independent review of the labels branch
- Album pages: the lightbox now sits outside the labelled section, whose blur rule also
blurred the viewer's photo — its "show" button removed the veil but not the blur.
- Age check: the browser opens a <details> by itself (find-in-page, a #:~:text= link
from a search engine, an #id inside the text); without a "yes" on record the gate now
folds it straight back. After "Chọn lại" → "Có", focus moves to the summary instead of
being lost with the row that just hid.
- Search indexes nothing inside the gate, not even its status lines, which could have
become the excerpt of a page the reader has not been let into.
- Albums take their labels and age rating from BOTH language entries (same photos, two
pages; the stricter rating wins), on the album page and on its card.
- An age-rated post folds its cover away with the text (PostCover.astro), and post and
album cards blur the cover of age-rated items too. The album card names the cover
photo's own labels, not only the album's.
- Tests: the gate re-folds an unasked open and keeps focus after choosing again;
albumWarning merges both languages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Saving or deleting in the admin now starts the publish workflow by itself, and the admin
follows the change all the way to production instead of stopping at "merged".
- Auto-publish: content saves/deletes and album saves/deletes dispatch content-bump.yml
after their commit (lib/admin/autopublish). The workflow's concurrency group already
coalesces bursts (one run going, one waiting, the waiting one reads the newest main). A
failed dispatch keeps the save and is reported ("publish": "failed"); "Xuất bản" stays
as the manual retry. Audit action publish.auto.
- Live status: the build records the content commit its src/content points at
(__CONTENT_COMMIT__, from the gitlink in HEAD); /api/health and the admin report it as
version.content. A pure publishPhase() turns content head, main's pointer, the running
build, the bump PR and the last run into live / pending / building / review / deploying /
failed, shown by the PublishBar and the dashboard (which now reads it live too).
- Fixes found while tracing the flow:
- validation now matches the content schema, so a save can't queue a red build:
chapter is a positive integer, cover and coverMedia can't both be set, album is a slug
and must already have photos;
- the tags inputs update on input, so Ctrl/⌘+S no longer saves the previous tags;
- commits in the public content repo say "via admin" without the admin's email (the
private audit log keeps who did what);
- deleting an image also checks the content the live site was built from, not only
main;
- the cover gets an alt field in the editor, and the picker takes alt text for uploads;
- one-shot stories (stories/<slug>.md) can be opened and created.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* ci: Qodana analysis and a licence check over the whole dependency tree
- Qodana (JetBrains, Qodana for JS) runs on every PR, on main and by hand
(.github/workflows/qodana.yml, settings in qodana.yaml): native mode on the runner's
Node 26 after `npm ci --ignore-scripts` and the generated types, profile
qodana.recommended over the whole repository, build output, generated files, the
content submodule and the design docs excluded, spelling/grammar checks off (they do
not read Vietnamese). Results go to Qodana Cloud and, for main, to code scanning as
SARIF. Dependabot and fork PRs skip it (no secrets), so it stays advisory.
- Licences: the allowlist moves to scripts/license-policy.mjs, shared by gen-notices
(direct dependencies, THIRD-PARTY-NOTICES.md) and a new check-licenses step in the
build job that reads every package in package-lock.json — transitive ones and every
platform binary — with a small SPDX evaluator (OR, AND, WITH, parentheses). Packages
with no licence fail; reviews are per package with a reason instead of per licence
(an MPL note written for satori used to clear @axe-core/playwright too). Today:
735 packages, 42 cleared (MPL-2.0 build/test tools, sharp's LGPL libvips).
- README badges and Quality row, THIRD-PARTY-NOTICES tool list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: Qodana's first findings, and a zero-problem quality gate
The first Qodana run reported 11 problems; all are handled:
- scripts/smoke-worker.mjs: the forged Access JWT is now built from its JSON parts at run
time (same bytes) instead of sitting in the source as a token literal, which secret
scanners rightly flag; the "did not come up" case reports through the same helper as
any other failure instead of throwing into its own catch.
- scripts/check-csp-hashes.mjs: ("|') → ["'] in the JSON-LD matcher.
- src/lib/format.ts: drop the two escapes of `]` outside a character class (a lone `]`
is a literal there); the classes keep theirs.
- src/lib/legal-lang.ts: the heading → language table is a Map, so "Tiếng Việt" is data,
not a property name mixing scripts.
- qodana.yaml: ES6PreferShortImport off, with the reason — the build scripts and
astro.config.mjs run under plain Node, where the `@/` alias doesn't resolve and a
TypeScript import keeps its `.ts`.
- failThreshold: 0, so any new problem turns the check red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: sort the licence report with an explicit compare function
Sonar S2871: Array#sort() without a compare function sorts by UTF-16 code units, which
is not alphabetical for every name. Both lists now sort with localeCompare.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- npm update --save --before=2026-11-18 (keeps the 3-day cooldown): astro 7.4.12,
@astrojs/cloudflare 14.4.8, @astrojs/mdx 8.1.6, @astrojs/sitemap 3.7.5,
@astrojs/svelte 9.1.6, jose 6.2.17, marked 18.2.1, eslint 10.15.0,
eslint-plugin-svelte 3.24.1, knip 6.45.1, playwright 1.65.1, prettier 3.10.1,
prettier-plugin-svelte 4.2.0, typescript-eslint 8.72.2, wrangler 4.164.0.
Supersedes Dependabot #129-#133.
- prettier-plugin-svelte 4.2.0 breaks long tags at their edges instead of hugging the
text, so 14 Svelte files are reformatted. Svelte 5 drops whitespace at the start and
end of a tag, so the rendered markup is unchanged (compiled before/after samples
produce identical output).
- osv-scanner.toml: deepmerge GHSA-gcqx-w48m-w2h4 (alias CVE-2026-93753) was withdrawn
on 2026-11-16 and OSV no longer reports deepmerge 4.3.1, so both ignores go.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Every sitemap page is checked for sideways scrolling at 320px; the light-theme and phone scans cover a page of every template; a page that does not answer the expected status fails instead of being scanned as an error page; the search focus trap is exercised with results listed; the legal notice is checked at tablet and small-laptop sizes; the story reader is walked backwards with Shift+Tab; each half of a legal page must declare its language. ACCESSIBILITY.md says what the palette test and the suite actually cover, and that the live widgets are not in the test build. CI prints the preview log when the job fails.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Regressions from this branch: overflow-wrap anywhere broke words inside the AI-usage table (break-word now, with minmax(0, 1fr) grid columns so the legal layout can still shrink); the legal notice kept covering footer controls between 768 and about 1100px (the body makes room for it at every width); the home link was a 32x12px mark once the wordmark was hidden (it keeps a 40px box); the sitemap filter dropped any path containing an admin segment (anchored to the host root); prefers-contrast did not reach the sepia reader theme.
Older bugs the new statement made claims about: Tab could leave the search dialog once results were listed, because the trap counted the tabindex=-1 options; and the half of a legal page that is not in the page's language had no lang (each half is wrapped at build time, src/lib/legal-lang.ts).
Found by the wider reflow sweep: the album photo grid used 1fr columns, which grew past a 320px screen.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Turning the project, gallery and tag breadcrumbs into nav landmarks split them into elements, and the build strips the whitespace between elements: they rendered as one run-together string. They are flex rows with a gap now, like the post breadcrumb.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The height published for the page's scroll padding came from offsetTop, which is not guaranteed to be viewport-relative for a fixed element once the page is scrolled. It is now the sheet's height plus its gap to the bottom edge, and the suite checks the published value against what the sheet covers after the page has scrolled, and that it is removed with the sheet.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The template's text becomes a pull request body, where a relative link resolves against the pull request's URL, not the repository tree.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
README gains an Accessibility section and the test:a11y command. CHANGELOG 2.2.0. Design docs: decision D20, the a11y target in the PRD, the checklist in 03 section 8, the legal route list and legal notice in 05, the accessibility@ alias in 07, the CI gate in 08, the roadmap entry and the maintenance tasks in 17.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
npm run test:a11y drives the installed Chrome through Playwright against npm run preview: axe-core (WCAG 2.2 A and AA plus best practices) over every page in the build's sitemap, one page per template again in the light theme and at phone width, and the menu, search, photo viewer, report dialog, reading settings and legal notice while open; then the keyboard contract, no sideways scrolling at 320, 360 and 390px, and the forced-colours rules. It runs inside the required build job after the smoke test. New dev dependencies playwright 1.65.0 and @axe-core/playwright 4.14.0, both past the three-day cooldown and without install scripts. sonar.projectVersion catches up to 2.2.0.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Forced colours (Windows High Contrast): the search field and its active result keep an outline, the scrollbar switch shows its knob and state, the chosen reading option is filled. prefers-contrast: more strengthens hairlines and drops the grain.
Not by colour alone: the current page is underlined in the header and the legal sidebar and gets a bar on its tab; the chosen reading option is bold and double-ruled; links inside the Q&A contact list are underlined.
Focus: scroll padding now clears the mobile tab bar, the story reader bar and the legal notice, which rests on top of the tab bar instead of covering it and publishes its height. Esc in the reading panel returns focus to the Aa button; pressing play keeps focus on the player; the report form ties its error to the field.
Reflow: the header needed 378px (vi) or 400px (en), so pages scrolled sideways at 360px and English pages did at 390px. The language switch shows its code below those widths and the wordmark goes below 352px; prose breaks long URLs.
Names and structure: unique names for the navs that shared one with the footer, play buttons carry their video title, the search close button is named Esc - Close, card headings take a level so lists no longer skip h2, breadcrumbs and the legal notice are landmarks, the photo viewer announces the caption on change. Footer social icons are 44px targets.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The sitemap listed seven /admin/ URLs. They are prerendered shells that only exist on admin.poli0981.dev; on this host they answer 301 or 403. Found while driving the accessibility suite from the sitemap.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A seventh legal page, /legal/accessibility (content repo c9e9827), linked from the footer, the menu, the legal sidebar and the legal notice. ACCESSIBILITY.md at the root is the repository's copy with the notes for contributors, which also ticks the Accessibility entry of GitHub's community standards. New issue template (label accessibility) and a pull request template carrying the checklist. The content bump also brings alt text for the four FrameLedger screenshots.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tailwindcss and @tailwindcss/vite 4.3.4 -> 4.3.5, with their transitive patches (npm update --save --before=2026-11-06T23:43Z, the same three-day cooldown Dependabot applies). Astro 7.4.8, jose 6.2.17, marked 18.2.0, typescript-eslint 8.72.2, wrangler 4.159.0, eslint-plugin-svelte 3.24.1 and knip 6.44.2 are younger than three days and wait for the next Dependabot run.
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Two bugs seen only on iPhone (Safari, iOS 26):
- The resting Waveline drew nothing in WebKit. Its gradient used the
default objectBoundingBox units, and a flat line's bounding box is 0 px
tall, so WebKit drops the gradient and the stroke with it (Chrome draws
it anyway). The footer, section headings and error pages showed an
empty band. Both gradients now use userSpaceOnUse across the viewBox.
- Safari 26 shows the page under the status bar and extends a sticky
header's colour up to the edge, but its fixed-container sampling
(LocalFrameView::fixedContainerEdges) bails out to "multiple colours"
when the container has a backdrop-filter, so the page scrolled into view
above the header. The site header, mobile tab bar and admin bar drop
the blur and use opaque backgrounds.
CHANGELOG 2.1.1; Sonar project version 2.1.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(security): site-wide rate limit for every request the Worker sees
Only the /api groups were rate-limited; pages, /media, /ext-img and the
search index had no limit at all (a 200-request burst against production
answered 200 every time). A new RL_SITE binding (100 requests per 10 s per
client, IPv6 per /64) is checked by the Worker entry right after the IP
denylist. Over it: the 429 page, no-store, Retry-After: 10, its countdown
rewritten to 10 s. The admin host is exempt (behind Access, RL_ADMIN per
account). A throwing limiter fails open without skipping the Turnstile gate.
- tests: worker spam/keys/exemptions/fail-open; Retry-After constants are
checked against the periods in wrangler.jsonc
- smoke: a fourth phase spams the built Worker until the limit answers
- scripts/probe-ratelimit.mjs: tell the Worker's 429 from the WAF's 1015
- docs 06/07/02/09/00: three layers (WAF → RL_SITE → /api groups) and the
Free plan's real WAF limits; CHANGELOG 2.1.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(sonar): project version 2.1.0 for the release
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(worker): stay a 429 if the rate-limit page can't be built
Review follow-ups on the site-wide limit:
- If fetching or rewriting the 429 page threw, the error reached the edge
fail-open path, which hands the request to the Astro app and skips the
Turnstile gate. It now answers a plain-text 429 (no-store, Retry-After).
- Drop Last-Modified and Content-Length with the ETag, as the gate does:
the countdown rewrite only kept the length by luck ("60" vs "10").
- Docs: the WAF rule can't filter by host on Free, so it counts admin.*
too; 09 lists the worker entry as a 429 source and the probe checks;
CHANGELOG says what was unlimited before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* perf: inline page CSS, hydrate the theme toggle and hero wave when idle
Lighthouse puts every page's LCP (a text block) about 2.4 s after the
first byte on a throttled phone, almost all of it render delay: two
render-blocking stylesheets (34 KB raw, 9 KB brotli) cost a round trip
before first paint, and the theme toggle's client:load pulled the Svelte
runtime into the same window on every page.
Inline every page's CSS (build.inlineStylesheets "always"; the CSP check
still finds every style block hashed) and hydrate ThemeToggle and the
home hero's Waveline on idle: CSS already shows the toggle's icon from
data-theme-pref, and the wave renders as a flatline until it hydrates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci(lighthouse): measure through a compressing proxy, like production
astro preview serves HTML, CSS and JS uncompressed; Cloudflare's edge
compresses every text response with brotli. Measured straight off the
preview, the simulated phone downloaded three to four times the bytes a
real one does (home HTML 108 KB vs 25 KB), so LCP overshot on transfer
time alone. scripts/compress-proxy.mjs sits in front of the preview in
the Lighthouse job and compresses text responses with br or gzip; fonts,
images, redirects and HEAD pass through untouched.
Docs 14 and the changelog describe the inline CSS, the idle islands and
how CI now measures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci(lighthouse): compress through nginx instead of a Node proxy
Sonar's taint rules flagged the hand-written proxy (the request URL and
upstream headers flowing into an outgoing request and into response
headers: S5144, S5146, S6109) and failed the gate, though it only ever
joined two ports on the CI runner. nginx is preinstalled on the Ubuntu
runner: the step writes a short config that gzips text responses from
the preview and listens on 127.0.0.1 only. gzip is a little larger than
the edge's brotli, so the numbers stay slightly pessimistic.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Any missing /en/ path got the Vietnamese 404 page. Both 404s now share
components/pages/NotFoundPage.astro (links, recent posts and a search
over the page language's Pagefind index, the heading echoed in the other
language), and ErrorLayout takes a locale.
The asset layer answers a miss with the nearest 404.html up the path, so
an integration moves Astro's en/404/index.html to en/404.html. The Worker
now returns that asset 404 for every missing page instead of handing it
to the app, whose localized error page lookup (/en/404/index) is answered
with a redirect. A test keeps every on-demand route under APP_PREFIXES,
which is what makes skipping the app safe.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The 1.x heading said "untagged", but the launch has a tag and a GitHub
Release. Say that only the later 1.x changes were not tagged, and point
the [1.x] reference (dangling until now) at that release.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
#101 asked three Steam CDNs in turn, but all three refuse Workers (403)
for any icon their edge has not cached, so production still mirrored no
icons. Probed from Cloudflare's network, the shared.fastly and
shared.akamai community-assets hosts served every icon, cdn.fastly served
cached ones, and cdn.cloudflare, cdn.akamai and media.steampowered.com
refused all of them. The worker now asks those three in that order; a
remote run against preview KV mirrored all three current icons.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Watching the cron after #100 showed the CDN switch was not enough: all three
of Steam's hosts (cdn.cloudflare.steamstatic.com, cdn.akamai.steamstatic.com,
media.steampowered.com) answer Workers with 403 for an icon they have not
cached at that edge, and serve it only on a cache hit.
- mirrorImage takes a list of sources and stores the first image any of them
returns; fetchSteam passes all three hosts.
- When every source fails, an icon or thumbnail stored by an earlier run
counts as present (it expires after 14 days), so one bad run no longer
blanks a picture that was working.
- CHANGELOG and docs 11 say what actually happens: icons appear when one of
Steam's edges has them cached; otherwise the game shows its name only.
Verified with `wrangler dev --remote` against the preview namespace: the
Dark Souls III icon (cached) is mirrored, the other two still get 403.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* docs: README, CHANGELOG and the docs suite brought up to v2.0
- README.md (new): what the site is, stack, how the Worker fits together,
getting started on Node 26, commands, deploying with Workers Builds, the
admin, security and licensing.
- CHANGELOG.md (new): v2.0.0 in Keep a Changelog form, plus a summary of the
untagged 1.x months.
- SECURITY.md: admin.poli0981.dev, the bot gate and the widgets worker are in
scope; tagged releases; reports go to a private repository; what the admin
stores.
- THIRD-PARTY-NOTICES.md: every infrastructure service, with what each one is
used for. CONTENT-LICENSE.md: the content submodule and /media images.
- poli0981.dev-docs v2.0: decision log D16–D19; architecture (worker entry,
stack, repo layout, dev setup, ADR 09–11); design system (Glacier Teal
tokens, theme modes, a11y rules); security (headers, single-key CIDR
denylist, body limits, secrets table, supply chain on a public repo,
admin hardening and Access recommendations, structured logs); Cloudflare
setup (correct Workers Builds commands and the deploy incident, ADMIN_EMAILS,
Access settings, observability); CI/CD as it runs today; bug reports,
widgets, error pages, routes, roadmap with status and next steps,
maintenance (TypeScript 7 bumps, rollback, R2/KV backup).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(changelog): link the documentation PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(widgets): Steam icons via Steam's Cloudflare CDN; optional GitHub token
Found by watching the first cron run of the new worker in production: no
image had been mirrored and two sources were stale.
- media.steampowered.com answers requests from Workers with 403, so every
Steam icon mirror failed. cdn.cloudflare.steamstatic.com serves the same
files to Workers (probed from Cloudflare's network).
- The GitHub events API allows 60 unauthenticated requests an hour per IP and
Workers share egress IPs, so the feed was 403 for hours at a time. The
worker now sends GITHUB_TOKEN when that optional secret exists (a
fine-grained token with no permissions is enough for public data).
- YouTube's feeds/videos.xml currently answers 404 for both the channel and
the uploads-playlist URL, from Cloudflare and from elsewhere; the worker
already keeps the last good feed, so nothing changes there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(csp): callout styles were blocked; the CSP check now covers styles
Lighthouse flagged a CSP violation on the one MDX post. Astro hashes the
styles of the components a page renders, but not of a component that only
appears inside MDX content: Callout's inline <style> shipped without its hash
and the browser refused it, so callouts were unstyled in production.
- Callout's rules move to src/styles/prose.css (the stylesheet Prose loads on
every long-form page); the component has no <style> block any more.
- scripts/check-csp-hashes.mjs now hashes every inline <style> block against
the page's policy and fails on any style attribute (a policy without
'unsafe-inline' never allows one), with self-tests for both matchers. The
build reports 339 style blocks across 64 pages, all hashed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(og): Number.parseInt in the colour mixer (Sonar S7773)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(pages): share vi/en page components
Eleven pages existed as two near-identical copies, one per locale. Each now
has one component under src/components/pages/ that takes `locale`, and the
vi and en routes are thin wrappers (the pattern DevPage already used; it and
GamingPage, NowPage and UsesPage move into the same folder). The legal routes
share a `legalPaths()` builder.
The built HTML of all 64 pages is unchanged apart from build noise (scope
ids, asset and CSP hashes). The one visible difference: the vi stories and
projects pages now use the boxed empty state the en pages had, which only
shows when a section has no entries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(ui): Glacier Teal palette, theme that follows the OS
The warm "midnight ink / old paper" palette gives way to a cool one: navy and
teal in dark, frost white and deep teal in light. src/lib/palette.ts holds the
values for code outside CSS (theme-color, OG images, the console egg) and
tests/palette.test.ts fails if it and global.css drift, or if any text or
control colour drops below WCAG AA on bg, surface or elevated.
New tokens: --line-strong for control edges (3:1), --accent-contrast for text
on an accent fill, --overlay for modal backdrops, --shadow-color. The
undefined --text-small becomes --text-meta, native controls take accent-color.
The theme now defaults to the OS setting and keeps following it. The toggle
cycles system → light → dark, picks its icon in CSS before hydrating, and
points both theme-color metas at a pinned choice. The bootstrap moves to
src/lib/theme.ts and tests run the exact string that ships. The admin gets the
same toggle.
Hard-coded colours go: the reader's paper and dark backgrounds reuse the site
palettes (sepia stays its own, now with a 3:1 edge), the lightbox pins the dark
palette for photos, backdrops use --overlay, and the favicon, mini-game, OG
cards and easter egg read the palette. The service worker cache is bumped for
the new favicon and game.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ui): language switch, one-shot stories, reader bar, a11y and i18n
- The header's language switch goes to a page's real translation, or to the
same section in the other language when there is none, instead of 404ing
on every post whose slugs differ (sectionFallbackPath).
- Stories outside a series folder get a reader route (/truyen/[slug]); their
cards linked to a 404. All four story routes share StoryChapterPage.
- The story reader bar docks under the sticky header (--header-h) instead of
sliding behind it; in-page anchors stop below the header too.
- The header keeps the menu button below 960px: the full nav needs ~900px in
English and overflowed between 768 and 900.
- The 500 page shows the Cloudflare Ray ID, stamped by the Worker, instead of
a random code nobody could look up; bug reports carry it.
- Gallery thumbnails are links to the full image, so albums work without JS;
the lightbox still takes plain clicks and leaves modified clicks alone.
- Contact lines on /qa and the 403 page are real mailto/Discord/links links.
- A11y: the search is an ARIA combobox (activedescendant, labelled groups,
status outside the listbox, a visible focus ring) and reports index
failures; the mobile menu is a modal dialog with a focus trap that returns
focus to its trigger; the lightbox trap skips disabled arrows and keeps
focus at either end; the report dialog and its textarea are labelled and the
copy button says "copied" (or why not) instead of "sent"; Esc acknowledges
the legal notice only from inside it; reading options expose aria-pressed.
- Landmark names, project "repo/site" links (with their project and a
new-tab note) and the legal-notice labels come from the i18n dictionaries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(ui): centre modal dialogs, bring back list markers in posts
Two old bugs that Tailwind's preflight caused, found while testing the admin:
- It zeroes every margin, which also removes the browser's `margin: auto` on
modal dialogs, so the public "report a bug" dialog opened stuck in the
top-left corner. Dialogs get their auto margins back.
- It strips list-style everywhere, so bulleted and numbered lists in blog
posts and stories rendered without markers. .prose restores them.
The prose rules move from Prose.astro into src/styles/prose.css so the admin
editor's preview can use the same stylesheet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(admin): audit log, dashboard, activity and denylist APIs; stricter Access
Security:
- Access tokens older than 24 hours are refused (jose maxTokenAge), and
ADMIN_EMAILS is now required: without an allowlist nobody gets in, so an
Access policy widened by mistake no longer opens the admin. (The secret is
already set in production.)
- Every admin action — content save/delete, media upload/alt/delete, album
save/delete, publish, denylist changes — lands in a KV audit log
(audit:*, 90 days, newest first via inverted keys, one list() to read).
New endpoints:
- /api/admin/overview: content counts per collection and language, drafts,
library size, the widgets cron's last run, and the deployment's
configuration (secret names only, gate state, version, single-token mode).
- /api/admin/activity: the audit log next to the content repo's commits.
- /api/admin/security: read, add (with reason and expiry) and remove denylist
entries; refuses a range that contains the admin's own address.
- /api/admin/media?usage: which content files use each image.
- /api/admin/gallery: albums report their cover and how many repo photos come
first; PUT can move the cover (rewriting coverIndex in both language entries
in the same commit); DELETE removes an album's list and entries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(admin): redesigned admin with dashboard, activity, security pages
Layout: a two-row header (brand, publish status, theme toggle, account menu;
then a tab row that scrolls sideways on a phone), a skip link, and one
AdminChrome island that renders toasts (polite for confirmations, alert for
failures), a <dialog> confirm in place of window.confirm, and a "sign in
again" banner. The API client detects a lapsed Access session (Access's
redirect, seen through redirect: "manual", or a 403) instead of failing with
a JSON parse error.
Pages: /admin/ is now an overview (content per collection, drafts, publish
state, library, widgets cron, gate and secrets); the list moves to
/admin/content/ with collection/language/draft filters, sorting, an empty
state and a slug check before creating; /admin/activity/ shows the audit log
and content commits; /admin/security/ manages the IP denylist and shows the
configuration.
Editor: local draft autosave with a restore prompt, Ctrl/⌘+S, field errors
from the same validator the server uses, a preview in a sandboxed frame (no
scripts can run, the site's prose styles apply), a retry instead of an empty
form when loading fails, and edit mode after the first save.
Media: search, an "unused only" filter, where each image is used, up to three
uploads at once with a status per file, and clipboard failures reported.
The picker reuses the loaded library, searches, and can pick several images.
Gallery: unsaved-change tracking with a prompt before leaving, drag-and-drop
or arrow reordering, a cover picker, deleting an album, adding several
photos at once.
Publish bar: polls every 5 s while a run or build is moving, 30 s with
unpublished changes, 60 s when in sync, never in a hidden tab; links a
failed run, and flags single-token mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* chore: add .gitattributes so working trees are LF on every OS
core.autocrlf=true (the Windows default) checked 144 text files out as CRLF, which made
`prettier --check` and `gen-notices --check` fail locally while CI on Linux passed. The
index was already LF, so this changes no content.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* build: Node 26, TypeScript 7 next to TS6, ES2025, latest dependencies
- Node 26 (.nvmrc, engines); Workers Builds already builds with NODE_VERSION=26.
- TypeScript 7.0 ships no JS API, so the tools that need one (astro check/Volar,
typescript-eslint, svelte2tsx) keep the real typescript@6 package, while
@typescript/native (npm:typescript@7) type-checks every .ts file:
`npm run typecheck`. Called by path so the outcome never depends on which package
wins the shared `tsc` bin link.
- tsconfig: target/lib ES2025, no baseUrl (removed in TS 7; Astro's alias plugin falls
back to the tsconfig directory), explicit `types: ["node"]` (TS 6+ default is []),
and erasableSyntaxOnly so Node can strip types for the unit tests — which meant
turning three constructor parameter properties into plain fields.
- Dependencies to current: astro 7.4.2, @astrojs/cloudflare 14.4.2, mdx 8.1.1,
svelte 9.1.1, check 0.9.12, zod 4.6.7 (GHSA-mrhx-c7xc-m3w5), wrangler 4.152.0,
eslint 10.13, typescript-eslint 8.72 (the Svelte false positives that pinned 8.70
are gone), knip 6.42, lefthook 2.2, prettier 3.9.10, satori 0.63.
- Override miniflare's pinned undici to ^7.30.1 (GHSA-xjj6-f33q-929c and two more,
published 2026-10-23). `npm audit`: 0 vulnerabilities.
- ESLint: defineConfig from eslint/config (tseslint.config is deprecated).
- wrangler.jsonc: compatibility date 2026-10-15, version_metadata binding, Workers Logs
with invocation logs and redacted query strings, sampled traces, REPORT_REPO.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* ci: SonarCloud analysis, no npx or install scripts in CI, Dependabot-proof notices
- New `sonarcloud` job (SonarSource/sonarqube-scan-action v8.3.0, pinned) fed with the
lcov report from the build job; sonar-project.properties carries the whole setup and
waits for the quality gate. Skipped where SONAR_TOKEN can't exist (Dependabot, forks)
and for content/bump dispatches.
- `npm ci --ignore-scripts`: esbuild, workerd and sharp take their binaries from
optionalDependencies, so CI needs no lifecycle script at all (verified with a clean
install + full build). Every `npx` became an npm script, and the TS 7 compiler gets
its own step. Jobs have timeouts.
- Lighthouse runs through treosh/lighthouse-ci-action (pinned) instead of fetching
@lhci/cli with npx at run time, and measures mobile as docs 14 says (it was desktop).
- gen-notices no longer prints the resolved-package count inside the checked block:
every Dependabot PR that changed one transitive package failed CI on it (PR #94).
- Dependabot: a 3-day cooldown on both ecosystems, a typescript group, the TS 6 pin
explained, and the typescript-eslint pin dropped (8.72 lints Svelte cleanly).
- osv-scanner-action v2.7.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(edge): denylist on every route, a gate that fails closed, /ext-img, version reporting
- IP denylist moved from the middleware (on-demand routes only — pages were never covered)
into the worker entry, for every route. One `denylist` KV key with CIDR ranges and
expiry (lib/denylist), memoized per isolate for a minute, failing open on KV errors.
- The Turnstile gate fails CLOSED: if deciding or rendering it throws, the visitor gets a
503, never the page behind it. Pass signatures must be exactly 43 characters.
- frame-ancestors 'none' as a header-only CSP (it cannot work from <meta>); appended, so
/media's and /ext-img's own sandbox CSP stays. Admin responses add CORP same-origin.
- /ext-img: the widgets' YouTube thumbnails and Steam icons are mirrored into KV by the
cron worker and served from this origin, so a page never contacts Google or Steam before
the visitor presses play; img-src is back to 'self' data:. The route only reads KV —
nothing a visitor sends makes the Worker fetch anything.
- /api/health reports the Worker version (version_metadata) and the git commit it was
built from (Workers Builds' WORKERS_CI_COMMIT_SHA), so a deploy is verifiable from
outside. Structured JSON logs (lib/log) for denylist, gate, admin and rate limits.
- Middleware error pages keep their status under `astro dev` (a rewrite used to answer 200).
- Widgets cron: parallel sources, 10 s timeouts, per-source error logs, the KV contract in
one shared types module, its bindings typed locally (WidgetsEnv).
- gate.js: Turnstile follows the theme actually shown (system preference included).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(api): bounded bodies, timeouts, server-side validation, private bug reports
- Request bodies are refused by Content-Length before anything is buffered, and streamed
bodies stop at the limit (lib/body): report 32 KB, gate 8 KB, admin JSON 512 KB, upload
20 MB. The old code read the whole body first, whatever its size.
- Every outbound fetch has a timeout: GitHub (admin, 15 s), GitHub issues and Discord (10 s).
- /api/report files into REPORT_REPO — the private poli0981/site-reports, as the privacy
policy always said — breaks @mentions, fences the console log so it can't escape its
code block, sends allowed_mentions: none to Discord, and no longer echoes the issue URL.
- Admin content API: frontmatter validated against the collection's fields (the same
validateFrontmatter the editor will use), plain objects only, JSON content type
required, "already exists" instead of a misleading edit conflict when creating, and
legal / now / album entries can no longer be deleted from the admin.
- Admin gallery and media APIs: the same JSON/size rules, existing-album check on create,
oversized uploads refused before formData() parses them.
- Publish status says when the content token is doing the dispatching (no publish token).
- Structured logs for saves, deletes, uploads, publishes and every GitHub failure.
- Admin client: specific messages for the new error codes; a failed Turnstile load is
retried instead of replayed until reload.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: SonarCloud findings, two checks that passed without checking, RepoLens link
Checks that silently checked nothing:
- check-exif handed exifr file paths; its reader throws on current Node and the old
`.catch(() => null)` read that as "no EXIF" — CI never inspected a single image. It now
reads the bytes itself, fails on unreadable images, honours --changed (it ignored the
flag) and stops git from octal-quoting Vietnamese file names out of its filter.
- check-csp-hashes skipped any page whose CSP meta it failed to parse and reported
"ok — 0 pages". The meta tag is now found in any attribute order or quoting (self-tested),
a page without one fails, and zero checked pages fails.
SonarCloud (29 open issues):
- Six super-linear regexes rewritten linearly (format, bugbuffer, access, cookie,
new-post); the email mask works token by token.
- smoke-worker runs wrangler via process.execPath + its CLI file (no PATH lookup, and it
finally works on Windows: no `npx` without a shell, taskkill instead of a POSIX process
group), sends `%2e%2e` raw instead of letting fetch normalize it, has a deadline, and
covers /ext-img, frame-ancestors, oversized bodies, malformed gate passes and the
denylist (a third phase). KV seeding names the namespace, as wrangler 4.152 requires.
- strip-exif only walks src/assets (path traversal), recurses, and actually enforces its
1.5 MB budget; sw.js keeps the worker alive until cache.put settles and caps the warm
cache; gate.js rejects with Errors; the mini-game draws obstacles from the CSPRNG.
- new check-install-scripts: CI installs with --ignore-scripts, which also switches off
npm's own strict-allow-scripts — this keeps the "unreviewed install script" alarm.
- gen-og imports ogKey() from src/lib/og.ts instead of keeping a copy in sync by hand;
new-post parses flags anywhere and escapes titles for YAML properly.
Also: the "all repositories" link now points at https://repolens.poli0981.dev/repos.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: run the TypeScript sources under node:test with Astro/Workers stand-ins
No new dependencies. tests/support/register.mjs installs Node 26 module hooks:
- `@/…` and extensionless/directory imports resolve to the .ts sources;
- astro:env/*, astro:content, astro:middleware, cloudflare:workers and the Cloudflare
adapter's handler resolve to small stubs whose values tests change at run time;
- `import.meta.env` / `import.meta.glob` are rewritten to same-length globals, so V8
coverage still maps character for character onto the files on disk.
tests/support/fakes.ts provides KV, R2, Images, the Cache API, ASSETS, rate limiters, a
minimal HTMLRewriter and a fetch router; tests/support/github.ts an in-memory content
repo speaking REST, Git Data and GraphQL.
162 tests across the worker entry, middleware, every API route, the admin libraries
(including real RS256 Access JWTs), media, gate rendering, content queries, RSS, the
client modules and the widgets cron: 99.5% of lines, 94.6% of branches. Writing them
found the middleware's error pages losing their status under `astro dev`. The
frontmatter round-trip test used to skip itself on Windows (`URL.pathname` → "/E:/…").
`npm run test:coverage` writes coverage/lcov.info (80% line floor) for SonarCloud, with
the same exclusions as sonar-project.properties, which now also analyzes .github, versions
the project, and waits for the quality gate on pull requests only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(content): publish 9265c94 — legal pages for this release
Private bug reports, widget images served by the site, Workers Logs and IP blocks
disclosed, the AI disclosure's merge policy, and the full third-party/service list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: match script end tags loosely in the HTMLRewriter fake
CodeQL (js/bad-tag-filter) flagged the fake's script regexes because they
miss end tags such as `</script >` or `</SCRIPT>`. The fake only rewrites
HTML this repo builds, but there is no reason to keep a pattern the
analyzer rightly calls fragile.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test: cut script elements by offset in the HTMLRewriter fake
The looser end-tag regex did not satisfy CodeQL's js/bad-tag-filter, which
distrusts any regex that matches whole <script>…</script> elements. The fake
now finds each element with indexOf and checks the opening tag's attributes,
so there is no tag-filtering regex left to flag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
A signature atob cannot decode made verifyPass() throw past the gate into the worker's fail-open path, which served the real page. Decoding now never throws, signatures must be 43 characters, and the smoke test covers it. Also bumps zod and patches undici so the required npm audit step passes again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Saving the first post from the admin failed with a raw 502: GitHub refused
POST /repos/poli0981/content/git/trees with "Resource not accessible by personal access
token" — the fine-grained token could read the content repo but not write it.
- Permission errors now say what's missing: GitHubError keeps GitHub's
X-Accepted-GitHub-Permissions header, 401/403 map to `github_permission`, and the
admin shows which token needs which permission on which repo.
- Two tokens instead of one. A fine-grained token's permissions apply to every repo it
covers, so "Contents write on content, Actions write on the site" can't be one token
without also granting Contents write on the site repo. GITHUB_CONTENT_TOKEN: content
repo only, Contents read & write. New GITHUB_PUBLISH_TOKEN: site repo only, Actions
read & write — used just to dispatch content-bump.yml (falls back to the content
token). Status reads need no permission; both repos are public.
- "Tạo mới" is limited to collections where another entry is safe: blog, stories,
projects, faq. The test entry was now/hello-world.md (en): the /now page renders the
FIRST entry of a language and hello-world sorts before now-en, so saving it would have
replaced the live English /now page. /now and legal pages are edit-only; new albums go
through the Gallery page (they need photos). The API enforces the same rule.
- Docs: 06 §9, 07 §13b (exact token settings), 17.
- Tests: collection guard (unit).
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
An admin for the owner, on its own host behind Cloudflare Access.
Security
- src/lib/hosts.ts: admin.poli0981.dev serves only /admin*, /api/admin* and /media/*
(other paths 301 to the site); poli0981.dev/admin* 301s to the admin host and
/api/admin* 404s there. Same origin would let any XSS on a public page drive the
admin API with the Access cookie.
- Every admin route (matched on Astro's routePattern) needs a valid Cloudflare Access
JWT, verified in the Worker with jose against the team JWKS: aud = ACCESS_AUD, iss =
team domain, RS256, unexpired; optional ADMIN_EMAILS allowlist. So a forged header,
another app's token or any non-Access URL gets 403 even though Access already guards
the edge. State-changing requests must be same-origin (Sec-Fetch-Site + Origin);
RL_ADMIN is keyed by email; responses are no-store + noindex. `astro dev` gets a
stand-in identity only under import.meta.env.DEV.
- GITHUB_CONTENT_TOKEN (fine-grained) writes ONLY poli0981/content, plus dispatching the
publish workflow on this repo. A leak means content edits, never code pushed here.
Content (src/lib/admin/{collections,frontmatter,github}.ts, api/admin/content.ts)
- One GraphQL request lists every entry with its frontmatter; edits commit straight to
content's main through the Git Data API (tree → commit → fast-forward ref, one atomic
commit for multi-file changes), refusing with 409 when a file moved since it was
opened. New entries are .md only (MDX runs code at build).
- Frontmatter round-trips through yaml's Document API and only rewrites keys whose
value changed: all 28 content entries come back byte-for-byte when unedited (unit
test against the real submodule), flow lists and quoting survive edits.
Media (src/lib/media/process.ts, api/admin/media.ts)
- Upload: magic-byte sniffing (no SVG), ≤ 20 MB, id = SHA-256 prefix — the same file
again returns the existing record without a single new transformation. A full-size
WebP master (re-encoded: EXIF/GPS gone; no original kept) and the fixed variants
(AVIF 480/800/1200, WebP 800/1600) are made once with the Images binding and stored
in R2 with their real content type; sizes come from the output, after EXIF rotation.
- Library: list from R2 metadata, edit alt, copy the <picture> snippet, delete (refused
while any content still references the id; purges this colo's cache).
Gallery (api/admin/gallery.ts): albums from gallery/*.md + gallery-photos/<album>.json;
reorder, caption (vi + en required), add from the library; a new album writes its vi/en
entries and photo list in one commit and needs at least one photo.
Publish (.github/workflows/content-bump.yml, api/admin/publish.ts): the admin
dispatches the workflow, which points src/content at content's main on content/bump,
opens/updates the PR, enables auto-merge only when the diff is .md/.json, and runs
ci.yml on the bump commit (GITHUB_TOKEN PRs don't trigger pull_request workflows) so
the required `build` check exists. ci.yml gains workflow_dispatch. "Allow GitHub
Actions to create pull requests" is enabled on the repo; default token stays read.
UI: AdminLayout + Svelte islands (client:only) — content list with search and "new",
editor (schema-driven form, Markdown with marked preview, image insert, cover picker,
unsaved-changes guard), media library (drag-and-drop), gallery manager, and a publish
bar that shows pending changes, the bump PR and its build status.
Also
- wrangler: Images binding, ACCESS_TEAM_DOMAIN/ACCESS_AUD vars (not secrets), and
run_worker_first now excludes /@*, /src/*, /node_modules/* — in `astro dev` the
Cloudflare Vite plugin applied "/*" before Vite's own middleware, so /@vite/client
and every module 404'd and no island hydrated (dev-only regression from #79).
- robots.txt disallows /admin/. Deps: jose, marked; yaml moves to dependencies.
- Tests: hosts routing (unit), frontmatter round-trip (unit), smoke: admin 403
without/with a forged JWT. Verified locally on astro dev: upload → 5 variants of the
right sizes with no EXIF, re-upload deduped, CSRF refused, alt edit, delete → 404;
editor defaults, preview and picker work.
- Docs: 00 (D2, D11–D15), 01, 02 (ADR-04, ADR-08), 04 §5a, 06 §9, 07 §13b + checklist,
08 §0 (what actually runs), 16, 17.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Pre-flight for #80, all done:
- the zone Transform Rule is live: a production `wrangler tail` showed
`x-verified-bot: false` on requests from curl and from a spoofed Googlebot user
agent alike — Cloudflare classifies by origin, so the header can't be faked;
- GATE_SECRET is set (random, never displayed); TURNSTILE_SECRET and the public
site key were already in place for the report form;
- the gate, its exemptions and the pass cookie are covered by `npm test` and the
smoke test's forced-gate phase.
Kill switch: set GATE_MODE back to "off" (docs 06 §3b).
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Uploaded images (the admin comes next) live in the new R2 bucket poli0981-media
(APAC, no public URL). Each upload is transformed ONCE into a fixed set of variants, so
nothing is ever re-processed: AVIF 480/800/1200 (Cloudflare's AVIF encoder stops at
1,200 px) and WebP 800/1600 as the fallback, capped at the source width. Anything that
knows an image's id and size can build its URLs and srcsets without a lookup
(src/lib/media.ts).
- GET/HEAD /media/v1/<id>/<avif|webp>-<w> (src/lib/media/serve.ts, routed by the worker
entry): strict path regex, so the private prefixes and traversal attempts can't reach
R2; Cache API in front of R2; `Cache-Control: public, max-age=31536000, immutable`,
ETag/304, nosniff and a `default-src 'none'; sandbox` CSP on every image. Ids are
content hashes and a pipeline change gets a new prefix (v2/…) instead of overwriting,
so "immutable" is true.
- Content: `coverMedia: { id, w, h, alt? }` for blog/stories/projects (a refine rejects
having both `cover` and `coverMedia`), rendered by src/components/MediaImage.astro —
a <picture> with AVIF first, WebP fallback and width/height. PostCard and PostLayout
render it.
- Gallery: the content repo's gallery-photos/<album>.json lists an album's R2 photos
with {vi, en} captions; src/lib/gallery.ts merges them after the local photos and
validates them with zod (read via import.meta.glob like captions.json, so a repo
without the folder builds without warnings). Album-only-on-R2 is valid; an album
with no photos at all still fails the build. Lightbox uses the WebP variants.
- wrangler: r2_buckets MEDIA → poli0981-media.
Smoke test: /media seeds a local R2 object and checks 200 + type, year-long immutable
caching, sandbox CSP, nosniff, 304, HEAD, 404 for missing/private/encoded-traversal/
other-version paths and 405 for POST. Verified with a temporary R2 album + coverMedia
post: srcsets come out capped at the source width (1000 px → avif 480/800/1000).
Docs: 04 §6b (how R2 images work), 16 (R2 + Images costs), 00 D10.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Visitors without a pass get a "checking you're human" step instead of the page; solving
Turnstile earns a signed 48-hour cookie. Lives in the worker entry, since static pages
never reach Astro middleware.
How a page request is decided (src/lib/gate/policy.ts):
- off unless GATE_MODE is "on"/"force" AND GATE_SECRET and TURNSTILE_SECRET exist — CI,
Lighthouse and branch previews are never gated;
- never gated: non-GET, the admin host, /api, /admin, /media and the legal pages (the
privacy policy must be readable first); feeds, sitemap, robots, OG images, hashed
assets, sw.js and /offline/ don't even reach the Worker (run_worker_first);
- `x-verified-bot: true` passes. A zone Transform Rule sets that header on every request
to to_string(cf.client.bot), so clients can't forge it. No header at all means the rule
isn't deployed: fail OPEN and log, rather than lock search engines out ("force" skips
this for local testing);
- a valid `__Host-gate` pass passes (src/lib/gate/cookie.ts: v1.<exp>.<nonce>.<HMAC>,
Max-Age 172800, Secure, HttpOnly, SameSite=Lax; expiry can't be extended or pushed
past one TTL; rotating GATE_SECRET voids every pass).
The gate page (src/lib/gate/render.ts) is the requested page with its <body> swapped by
HTMLRewriter. The <head> stays as built — title, description, canonical, OG/Twitter,
CSS, fonts, theme bootstrap and the CSP meta — so link previews from bots that aren't
"verified" (Zalo, Telegram…) still show the real title, and the page's own CSP already
allows /gate.js ('self') and Turnstile. External scripts, modulepreloads and JSON-LD
(the Q&A page carries every answer in it) are dropped. It answers 200 — preview bots
ignore non-2xx — with no-store, noindex and no validators. Only 200 text/html becomes
the gate; redirects, 304s and 404s pass through. /pagefind/* (full text of every page)
is 403 without a pass.
public/gate.js renders Turnstile (action "gate", page language, current theme), trades
the token at POST /api/gate (rate-limited by RL_GATE, same-origin only, verified with
action + hostname) for the cookie and reloads. Strings in i18n `humanCheck`; styles in
global.css (the gate can't add a <style> without breaking the page's CSP hashes).
Ships with GATE_MODE "off". Turning it on is a one-line follow-up once the Transform
Rule is confirmed to reach the Worker.
Legal: privacy §1/§3/§8 (content#2, bumped) disclose Turnstile, the one strictly
necessary cookie and that JS is needed once; the legal sheet's line 3 and SECURITY.md
no longer say "cookieless" / "no cookies". Docs: 06 §3b (flow, kill switch), 07 §8/§8b
(reusing the widget, GATE_SECRET, the exact Transform Rule), 09.
Tests: `npm test` (node --test, 11 cases: pass lifetime, wrong secret, tampered/too-far
expiry, garbage, cookie format/parsing, settings, decisions) and smoke phase 2, which
forces the gate on with Turnstile's always-pass test secret and walks the whole flow
against the built worker (gate page, exemptions, 403 pagefind, cross-site rejection,
/api/gate → cookie → real page, tampered cookie → gate).
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Prerendered pages are served by the adapter's static-asset lookup before the Astro
middleware runs, so nothing at runtime could touch them — the www→apex redirect, the
denylist and the security headers only ever applied to /api routes (the headers reached
pages through public/_headers). The upcoming Turnstile gate and /media route need a
hook there, so this adds one.
- wrangler `main` → src/worker.ts, which wraps `handle()` from
@astrojs/cloudflare/handler (the adapter's documented custom-entry API; the build-time
prerender worker still uses the adapter's own entry, so nothing here runs at build).
- `assets.run_worker_first`: every path except hashed /_astro assets, OG images, the
favicon, sw.js/skullhop.js/gate.js, /offline/, robots/sitemaps/feeds and /.well-known
— those stay on the asset layer (unbilled, unaffected by any gate). /pagefind/* goes
through the Worker on purpose: its fragments hold every page's full text.
- Pages are fetched from ASSETS with the original request. The adapter's own lookup
fetches by URL string, which drops the method and conditional headers: once pages run
through the Worker, every revalidation would have become a full 200 and HEAD a GET.
- www→apex moves from the middleware into the entry, so it covers static pages too.
- Security headers come from src/lib/security-headers.ts, shared with the middleware,
and are set on every response leaving the entry (copying immutable asset responses).
- Edge logic fails open to `handle()`; a bug there must not take the site down.
- `preview_urls: false`: per-version preview URLs live on workers.dev, outside the
zone's WAF, Transform Rules and Access. Explicit because an omitted key keeps the
current setting.
CI: `wrangler types --strict-vars=false` (vars typed as string, not literals), and a
smoke test (scripts/smoke-worker.mjs, `npm run smoke`) boots the built worker with
`wrangler dev` and checks /, headers, 304 revalidation, HEAD, the trailing-slash 307,
404, /api/health, sw.js, a hashed asset, RSS and security.txt.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Rate limiting (wrangler `ratelimits`, src/lib/ratelimit.ts) replaces the KV counter in
the middleware, which read-then-wrote a key on every /api request (three KV ops, not
atomic, a TTL that slid on every write, and a put that can throw on bursts because KV
allows ~1 write/s per key). It also rate-limited GET /api/widgets, which the home page
calls on every view — so the 6th page view in a minute got a 429.
- One binding per group, keyed "<group>:<client>": RL_REPORT 5/60s, RL_GATE 30/60s
(room for carrier-grade NAT on VN mobile networks), RL_ADMIN 120/60s, RL_API
120/60s for everything else. IPv6 clients are keyed by their /64 (a host usually
owns the whole /64); IPv4-mapped addresses count as IPv4.
- /api/widgets is no longer limited; its payload is identical for every visitor, so
it is cached per colo with caches.default for 5 minutes instead of 4 KV reads.
- Missing bindings (astro dev, prerender) allow the request. The KV denylist stays.
Turnstile: src/lib/turnstile-server.ts verifies `success` and that the token was minted
for this host and this form's `action` (report now renders with action "report"), so a
token solved on one widget can't be spent on another. One retry on network errors under
an idempotency key; Cloudflare's dummy test secrets skip the action/hostname checks
(their responses say "test"/"localhost"). The report dialog now resets the widget after
every submit — tokens are single-use, so a second send in the same session used to fail.
Docs: 06 §2 (flow, limits, denylist is exact-IP), 10 §3/§8 (real order and status
codes: 429 → 503 → 413 → 400).
Verified on astro dev: 6th report POST → 429 + Retry-After: 60, another IP unaffected,
20× /api/widgets → 200, five addresses in one IPv6 /64 share a budget; the verifier
returns ok / invalid-input-response / timeout-or-duplicate for the three test secrets.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The dashboard site is switched to JS-snippet (manual) mode; this adds the snippet.
- src/components/CfBeacon.astro renders the owner's snippet as-is (`type="module"`,
`data-cf-beacon` with the public site token) in the <head> of BaseLayout and
ErrorLayout. Module scripts load deferred, so it stays off the first-paint path.
`type="module"` is safe: the CDN answers CORS with `*`, and the beacon falls back to
querySelector("script[data-cf-beacon]") when document.currentScript is null.
- Only production builds report: PUBLIC_CF_BEACON (astro:env, client/public) defaults
to true only when WORKERS_CI=1 and WORKERS_CI_BRANCH=main, i.e. Workers Builds on
main. CI, Lighthouse CI and branch previews render nothing. Overridable per build.
- CSP: script-src += https://static.cloudflareinsights.com, connect-src +=
https://cloudflareinsights.com (where manual-mode beacons report). The CSP guard
skips src-only scripts, and the built pages carry both hosts.
Docs: 07 §12 now documents manual mode (and why automatic must stay off — it would
double-count and inject an inline script the CSP blocks), 06 §5 lists the one external
script, 14 §2 notes it is deferred and absent from Lighthouse CI.
Verified with PUBLIC_CF_BEACON=true: 63/63 pages carry exactly one beacon tag; CSP
check ok.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Scrollbars now follow the site palette instead of the OS default:
- --scrollbar-thumb / -thumb-hover / -track live in each palette block, mixed from
--muted / --accent and --bg with color-mix(in oklab). The thumb holds ≥ 3:1 against
the page background (WCAG 1.4.11): muted 65% on dark (3.4:1), 75% on light (3.1:1).
- `scrollbar-color` inherits, so the menu sheet, search results, legal sheet, report
preview and code blocks pick it up too; `scrollbar-width: thin` is applied wherever
scrollbar-color is supported. Safari (width but no colour support) gets an
::-webkit-scrollbar branch instead — a non-auto width there would disable it.
- Forced-colors mode ignores both, as it should.
Hide option: a switch in the footer (role="switch", shown only for fine pointers —
touch devices overlay their scrollbars anyway) stores `scrollbar=hidden` in
localStorage. The existing pre-paint theme bootstrap now also restores it, so there's
no flash of a scrollbar that then disappears, and its CSP hash still comes from the
same injectScript string. Only the page's own bar is hidden; it still scrolls by
wheel/touch/keys and inner scrollers keep their thin bar.
Docs: 03 gains the scrollbar tokens and the ScrollbarToggle entry.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Mail for poli0981.dev is Google Workspace now (MX → Google), with one mailbox and
topic aliases. contact@ stays the general address; each purpose gets its own:
- security@ — security.txt (first Contact; contact@ kept as the second) and SECURITY.md
- collab@ — Q&A "Business" line and /links; press@ — /links
- sponsor@ relabelled "Sponsorship & ads" now that collab@ covers partnerships
- privacy@ / legal@ / copyright@ / dmca@ / takedown@ — legal pages (content repo,
poli0981/content#1, bumped here) and CONTENT-LICENSE.md
- links.ts builds `href` from the address instead of repeating the literal.
Docs: 07 §11 replaces the Email Routing section with the Workspace setup and the
alias table; 06 security.txt sample; 12_LEGAL drafts mirror the content repo.
Also fixes `npm run new:post`: the lefthook pre-commit prettier pass had rewritten
`{{LANG}}`/`{{DATE}}`/`{{YEAR}}` in docs/templates to `{ { LANG } }` (prettier reads
them as YAML flow mappings), so new posts shipped with literal placeholders. The
templates are restored and added to .prettierignore.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
main has been red since September: the `npm audit --omit=dev --audit-level=high`
gate in ci.yml tripped on advisories that piled up, so every PR failed — including
the 13 Dependabot PRs, each of which only fixed one package and so could never go
green on its own. This bumps everything in one go.
- astro 7.2.0 → 7.3.6 (critical RCE via AVIF image optimization, GHSA-26w7-cxv4-gfx2;
path-segment auth bypass GHSA-376h-93r7-7g6f), @astrojs/cloudflare 14.3.4,
@astrojs/mdx 8.0.3 (Astro 7.3 ships markdown-satteri 0.4, which mdx 7 can't peer
with), @astrojs/sitemap, svelte 5.57.2, zod 4.6.5, sharp 0.35.5, wrangler 4.148.
- Transitive fixes now come from the parents (svgo 4.1, devalue 5.9.4, undici 7.29.1/
8.x, fast-uri 3.1.8, http-cache-semantics 4.3, source-map-js 1.2.2, …), so the old
overrides are gone. Two remain because a parent pins an exact vulnerable version:
fflate (satori → 0.7.3) and sharp (miniflare → 0.35.4, librsvg CVE fixed in 0.35.5).
The old `undici` override also forced 7.x onto unifont's ^8 range — that's fixed.
- gray-matter → yaml in scripts/gen-og.mjs: gray-matter's js-yaml@3 → argparse@1 →
sprintf-js chain carries an advisory with no fixed version. Only frontmatter is read.
- Dev tools bumped; typescript-eslint held at 8.70.x (8.71 reports 131 false
`no-unused-vars` in Svelte files) and prettier-plugin-astro at 0.14 (1.x reflows
inline expressions in 50 .astro files — a visual change). Both are in Dependabot's
ignore list with the reason.
- `z` now comes from astro/zod (the astro:content re-export is deprecated).
CI:
- ci.yml no longer path-filters pull_request: `build` is a required check, so a
docs-only PR could never merge.
- OSV now uses the reusable SARIF workflow (repo is public → code scanning is free);
findings land in Security → Code scanning and still fail the run. v2.6.0 (#70).
npm audit: 0 vulnerabilities (prod and dev). Build: 63 pages, sitemap unchanged,
CSP guard ok, OG images generated.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Lighthouse CI failed on its very first run, and it was right twice — once about the
site, once about my own config.
**WCAG 2.5.3 Label in Name (Level A), two violations.** Both had an `aria-label` that
replaced the visible text instead of containing it, so the accessible name and the
words on screen disagreed. Voice control acts on the accessible name: a user saying
"click SkullMute" or "click English" could not activate either control.
brand logo aria-label "poli0981.dev — home" visible "SkullMute"
lang switch aria-label "Ngôn ngữ" visible "English"
Now "SkullMute — poli0981.dev" and "English — Ngôn ngữ": visible text first, context
after. Verified 0 mismatches across vi, en and a listing page.
**The job could never have been warn-only as written.** `assert.preset:
"lighthouse:no-pwa"` switches on Lighthouse's full default assertion set at ERROR
level, which is what actually failed the run — my four explicit `warn` entries were
beside the point. docs 14 §3 says warn only, so the preset is gone and the config now
asserts exactly the budget from §1 and nothing else.
**The reports artifact was empty in the only case that mattered.** `lhci autorun`
aborts on a failed assertion before writing anything, so the run that needed
inspecting produced no artifact ("No files were found with the provided path"). Split
into separate collect and assert steps: collect always writes, assert is free to fail.
Findings I have NOT verified, kept as warnings rather than silenced: uses-text-
compression (workerd preview does not gzip; Cloudflare does in production),
errors-in-console and inspector-issues (likely the unset Turnstile/KV env in CI, but
that is a guess). They will show as warnings with a readable artifact next run.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs 14 §3 asks for a Lighthouse job on a preview build asserting the §1 budget,
explicitly "chỉ warn, không block" — Lighthouse numbers move with runner load, and a
hard gate would block deploys on noise rather than on regressions.
Advisory by construction, in two independent ways: every assertion is `warn`, and the
job is `continue-on-error` so a red run cannot fail the check suite. Per the doc, act
when it is red twice in a row, not on one bad sample.
Budget from docs 14 §1: performance/a11y/best-practices/SEO >= 0.95, LCP < 2.0s,
CLS < 0.05, total weight < 600KB. INP is a field metric with no lab equivalent, so
total-blocking-time <= 200ms stands in for it — noted here so the substitution is not
mistaken for the real thing.
Runs against `astro preview`, i.e. the built worker in workerd with real bindings and
_headers, rather than a bare static server — otherwise the numbers would not reflect
what visitors get. Four representative pages per the doc: home, a blog post, a story
chapter, a gallery album. Three runs each to blunt variance. Reports upload as an
artifact so a warning can be read rather than guessed at.
`@lhci/cli` is fetched with npx in CI instead of added to devDependencies: it is a
large tree that would land in the audit surface, the notices file and Dependabot's
queue for a job that never blocks anything.
Note on the pins: I wrote the upload-artifact SHA from memory and it was WRONG — a
fabricated pin is worse than a floating tag, because it looks authoritative while
pointing at nothing. All four action pins in the repo are now verified against the
GitHub API: checkout v7.0.1, setup-node v7.0.0, upload-artifact v7.0.1,
osv-scanner-action v2.5.0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs 09 §4 and docs 15 P3 — "the only place on the site allowed to play".
**Skull Hop** on /offline: pixel skull hops waveform bars (the Waveline motif),
Space/tap, speed ramps, best score in localStorage `skullhop`. 6047B raw, 2475B
gzip — inside the 6KB the spec allows.
Two deviations from the letter of the spec, both for the same reason — the offline
page has to work with no network:
- It lives at public/skullhop.js, NOT as an Astro-bundled chunk. The SW precaches
by name, and a content-hashed /_astro/ filename cannot be precached; the SW only
warms those on first fetch, which for a page nobody visits while online means the
game would 404 in exactly the situation it exists for. SHELL bumped to v2 so
clients re-precache, and _headers gives it no-cache like sw.js since the url is
stable.
- The skull is drawn from an 8x8 grid in code rather than the specified 8-bit PNG.
A sprite is one more file to precache and one more thing to 404, and drawing it
stays crisp at any DPR.
Loaded via `<script src defer>`, so CSP `'self'` covers it with no hash. Reduced
motion never autostarts — the button is the only entry point.
**Console easter egg** (src/lib/easter.ts): ASCII skull banner plus the konami code,
which flips the accent to the horror tone for four seconds via a data attribute. Both
run at requestIdleCallback so they cannot compete with first paint; the deferral sits
in the module so that rule travels with the feature. The keydown handler ignores
inputs and contenteditable so it never fights typing or the "/" search shortcut.
Two repo conventions re-learned the hard way:
- `x === 0 ? a() : b()` as a statement is banned by typescript-eslint here.
- knip reports easter.ts as unused; that is a false positive, because its only
importer is a <script> inside an .astro file, which knip does not resolve.
bugbuffer.ts escapes it only because report.ts also imports it from real TS —
so easter.ts is listed in knip.json `ignore` with the reason recorded in the file.
Verified: 63 pages build, CSP guard 355/355, island JS 31.0KB gzip (budget 40KB),
canvas carries an aria-label, skullhop.js lands in dist + sw.js PRECACHE + _headers.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs 15 P3 asks for a /now page on a monthly cadence, and docs 04 §1 already
anticipated it living at src/content/now.md. Built that way rather than as
hard-coded TS like /dev/uses, because /now is prose the owner rewrites monthly —
that is content, and content now lives in its own repo.
- `now` collection: title, lang, translationKey?, and a REQUIRED `updated`.
Required on purpose: a /now page whose staleness you cannot see is worse than
not having one, so the date is part of the schema rather than a convention.
- `now` added to SEGMENTS, so /now and /en/now come from the same i18n seam as
every other section and LangSwitch works with no special case.
- NowPage.astro renders the entry, the updated date, and a short line explaining
what a /now page is — most visitors have never seen the convention.
- Listed in menuNav (not the 7-item primary nav, which is full).
Content is committed in poli0981/content (8d6db00) and the submodule pointer is
bumped here — the first real exercise of the two-step publishing flow the
submodule split introduced.
Verified: 63 pages build (was 61), both routes emit with correct hreflang pairs
(vi/en/x-default all resolving to the right URLs), the updated date renders as a
machine-readable <time>, and check/lint/knip/prettier/CSP guard are green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs 04 §5 promises `docs/templates/{blog,story-chapter,project,faq}.md` and §5's
utility note promises `npm run new:post`. Neither existed, so every new entry
started by copy-pasting an old file and hoping the schema had not moved.
The templates are the single source of truth; the script only substitutes
placeholders. Adding a field to a Zod schema means editing one template and the
scaffolder follows, rather than the two drifting apart — which is the failure mode
that made a hand-maintained THIRD-PARTY-NOTICES.md credit a package we never used.
npm run new:post -- blog "Đêm render đầu tiên"
npm run new:post -- story "Chương 3" --series dem-khong-tieng
npm run new:post -- project "RepoLens" --lang en
npm run new:post -- faq "Bạn dùng công cụ gì?"
Slugs are stripped of diacritics per docs 04 §7. NFD handles the combining marks,
but đ/Đ is its own codepoint rather than d-plus-a-mark, so it is mapped by hand —
"Đêm render đầu tiên" becomes dem-render-dau-tien, not "-m-render-d-u-tien".
Each template carries a comment block explaining the non-obvious fields
(translationKey pairing, contentWarning, the stories folder = series segment,
draft visibility), because that knowledge previously lived only in the schema file.
Refuses to overwrite an existing file. That is not hypothetical: the first test run
tried to scaffold "Đêm render đầu tiên" and hit the real post of that name.
Because src/content is now a submodule, the script prints where the commit actually
belongs — writing to a submodule and committing in the parent is an easy way to
lose an afternoon's writing.
Verified: all four types scaffold, slugs correct across diacritics/đ/punctuation,
bad input rejected with usage, and a full build passes with the generated files in
place (Astro validates draft frontmatter at collection load).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs 08 §6 specifies `node scripts/gen-notices.mjs --check` as a CI gate and it
never existed, so the notices file was hand-maintained — which is how it ended up
crediting `@vite-pwa/astro`, a package this repo has never depended on.
The file now follows the A/B split docs 12 describes: hand-written framing outside
the BEGIN/END markers, generated table inside. `--check` regenerates in memory and
diffs, so a dependency change without a regenerate fails the build.
Licenses are read from each package's own package.json rather than via
`license-checker` — same source of truth, one fewer dependency to vet, which is
rather the point of a licence audit.
Two things fell out of building it:
1. **The survey has to be deterministic or the gate is useless.** npm installs only
the platform-matching binaries (`@img/sharp-*`, `*-msvc`), so a disk-based walk
of the resolved tree produces a different file on Windows than in Linux CI and
`--check` could never pass. The table is therefore built from direct
dependencies, which are installed everywhere; the transitive tree contributes a
count straight from the lockfile. Verified: every row corresponds to a
package.json entry, 31/31.
2. **sharp's prebuilt binaries are Apache-2.0 AND LGPL-3.0-or-later** — they bundle
libvips. Nobody had noticed. It is fine here (build-time only, never served,
LGPL attaches to distributing the library) but it is now written down instead of
waiting to be rediscovered. Documented in prose alongside the MPL-2.0 build
tools, since platform binaries are outside the generated block.
Licenses outside the allowlist are reported and fail `--check` unless they carry an
explicit REVIEWED entry with a reason.
THIRD-PARTY-NOTICES.md is added to .prettierignore: prettier re-aligns markdown
tables, so leaving it in put the two tools in permanent disagreement — prettier
rewrites the block, then --check reports drift, every run. Confirmed by running the
full CI order twice.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Third js/bad-tag-filter alert on the same line: `</script\t\n bar>`. An HTML end
tag may carry attributes after the name — the parser discards them, but it is
still a valid `</script>`. So `<\/script\s*>` was still too narrow.
The pattern now mirrors the grammar on both sides:
/<script(\s[^>]*)?>([\s\S]*?)<\/script(\s[^>]*)?>/gi
`(\s[^>]*)?` means "either `>` immediately, or whitespace then anything" —
requiring that whitespace is what keeps `<scripting>` from matching.
More usefully: this is the third one-line patch to the same regex, each written
from reasoning about the grammar and each wrong. So the grammar is now asserted
rather than argued. SELFTEST holds ten tag forms — plain, uppercase, mixed case,
attributes, typed, newlines inside the start tag, spaced end tag, end tag with
junk, plus `<scripting>`/`<noscript>` as negative controls — and runs before
every real check. A mismatch exits 1 before any "ok" can be printed.
Verified by sabotage, not by reading it: restoring the original pattern makes
the selftest fail with exit 1 and name all four holes at once; the correct
pattern passes and the real 61-page build still reports 343/343.
This is the failure mode the guard itself exists to prevent — a checker that
quietly passes because it cannot see the thing it is checking for.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Second CodeQL js/bad-tag-filter alert on the same line: `</script >` — HTML
allows whitespace before a closing tag's `>`, and the previous pattern required
`</script>` exactly. Fixing only the casing last time addressed one symptom of
the same underlying mistake: matching what Astro emits rather than what a
browser runs.
/<script(\s[^>]*)?>([\s\S]*?)<\/script\s*>/gi
/i <SCRIPT> executes
(\s[^>]*)? requires whitespace or `>` after the name, so `<scripting>` is
NOT treated as a script (the old `([^>]*)` matched it)
<\/script\s*> tolerates `</script >`
Tested against every variant a browser would run rather than eyeballing the
regex — lowercase, uppercase, spaced end tag, mixed-case + spaced, and with
attributes: 5/5 now caught, 0/5 of the last three before. Negative control
`<scripting>not a script</scripting>` correctly ignored, and the real 61-page
build still passes 343/343.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CodeQL (js/bad-tag-filter, high) on its first run after the repo went public:
`/<script([^>]*)>([\s\S]*?)<\/script>/g` does not match `<SCRIPT>`.
Astro only ever emits lowercase, so this changes nothing about today's output —
but it matters more than a "not currently reachable" finding usually would,
because this guard's entire job is to notice inline scripts nobody expected. A
matcher that only sees the expected casing would report "all clear" on exactly
the surprise it exists to catch. Raw HTML in a markdown body, or any future tool
in the build chain, is enough to produce one.
Verified both directions rather than just adding the flag: a synthetic page
containing `<SCRIPT>alert(1)</SCRIPT>` now fails the guard (it did not before),
and the real 61-page build still passes 343/343.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Separates writing from deploying: content now lives in its own repo and the site
pins a commit of it.
Chose a submodule over a remote content loader specifically to keep the existing
pipeline intact. Because the files stay at the same physical path, everything
resolves exactly as before:
- Astro content collections (the glob loaders keep base ./src/content/<dir>)
- the `image()` schema helper, which resolves relative to the .md file
- blog/lan-dau-viet-truyen.mdx importing "@/components/Callout.astro" — that
alias points into the site's src/, which still contains the submodule
- Pagefind indexing and build-time OG generation
A remote loader would have broken the middle two.
27 entries moved: blog 3, stories 2, projects 2, faq 3, gallery 12, legal 6.
CONTENT-LICENSE.md is copied into the content repo so the All-Rights-Reserved
terms travel with the content — both repos are public now, and the site repo's
GPL-3.0 LICENSE must not be read as covering the stories and photos.
- ci.yml checkout gains `submodules: recursive`; without it the collections
resolve to an empty directory and the build dies on the first getCollection()
- .prettierignore now skips src/content/: formatting a submodule from the
parent leaves it permanently dirty, and the reformat could never be committed
from here anyway
Note: a commit in the content repo does NOT deploy on its own — the site builds
from the commit it has pinned, so publishing is a two-step (commit there, bump
the pointer here). That is the intended tradeoff of pinning.
Verified locally: 61 pages build, Callout renders inside the MDX post, CSP guard
343/343, check/lint/knip/prettier green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The gallery has been live since PR #10 showing five machine-generated gradient
JPGs. This swaps in the real set from the owner's photo folder.
Albums (34 photos): home 7, game 20, portrait 3, dev 2, meal 2. Files are
renamed to `<album>-NN.jpg` — lowercase and zero-padded — so the numeric sort in
lib/gallery.ts is stable and the `Meal-1.jpg` vs `meal-1.jpg` case mismatch in
the source notes can't bite. Game files keep their original numbering so the
captions map 1:1.
Captions: every file has a vi + en pair (the schema build-fails otherwise). They
are translated from the owner's own notes; the five game screenshots whose title
was not recorded get an honest "a screenshot from another game" rather than an
invented one. The game album description carries the developer/publisher
attribution the source notes asked for, and Disclaimer §3 already covers it.
**strip-exif now also enforces the size budget.** docs 04 §5 states two rules for
a committed photo — no metadata, and max 2560px / ~1.5MB — but only the first was
implemented, so the second had never actually been applied. Phone photos arrive
at 6048x8064 and 2.5MB. The script now resizes the long edge to 2560 and
re-encodes JPEG with mozjpeg at q85; mozjpeg specifically, because stripping
metadata always costs one re-encode generation and plain q82 was coming out
*larger* than the input on already-compressed files.
Result: 10.9MB -> 6.9MB, largest file 932KB (was 2.5MB), nothing over 2560px.
Demo album retired: `src/assets/gallery/demo/`, both content entries, and
`scripts/gen-demo-gallery.mjs` + its npm script are removed. They existed only to
give the gallery something to render before real photos arrived.
Verified: 59 pages build (was 51), 5 albums x 2 locales, 241 optimized
derivatives, `check-exif` passes over every tracked asset (0 GPS, 0 serials),
CSP guard 331/331, check/lint/knip/prettier green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Closes the gaps between docs 13 and what the head/JSON-LD actually emitted.
**FAQPage on /qa + /en/qa.** The highest-value item and the cheapest: the `faq`
collection was already fully structured (q / group / order) and rendered into
accordions, but emitted no schema at all. `acceptedAnswer.text` needs a string,
not rendered HTML, so it comes from the raw markdown body via a new
`plainText()` helper in lib/format. Entries with an empty body are filtered out
— Google rejects an answer-less Question. 3 questions per locale.
**BreadcrumbList** on post + project pages. Both already rendered a visible
breadcrumb; the schema is now built from the same two values so they can't drift.
**BlogPosting completeness.** Added `publisher` (Organization — Google's article
guidelines want one, and a one-person site publishes as itself), `image` (the
generated OG card), and `mainEntityOfPage`. SoftwareSourceCode gains `image` too.
**Head tags** that were simply missing: `twitter:site` / `twitter:creator`,
`og:image:width` / `height` / `type` / `alt`, and the OG `article:*` namespace
(published_time, modified_time, author, tag) behind a new optional `article`
prop so only dated content pages emit it.
**Feed autodiscovery.** Only /rss.xml was advertised, so a reader could never
find the blog-only or truyện-only feeds. All three are now linked.
**Sitemap lastmod.** There was none on any of the 46 URLs. Per-page dates would
mean threading content dates through the integration; every deploy is a full
rebuild, so build time is the truthful site-wide "as of". 46/46 now carry it.
**Duplicate meta descriptions.** All ten legal pages inherited the site-wide
default description because neither `[slug].astro` passed one. Each now derives
its own from the page title.
Deliberately NOT included: WebSite + SearchAction. It needs a URL-addressable
`?q=` results route, and search here is a client-side Pagefind modal. Adding the
markup without the route would advertise a searchbox that cannot be linked to.
Verified in the built output: FAQPage with 3 questions, BreadcrumbList
"Blog > <title>", publisher/image/mainEntityOfPage present, all og/twitter/
article meta emitted, 46/46 sitemap URLs with lastmod. Build, check (0 errors),
eslint, prettier, knip and the CSP guard all green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The dev-tools group PR (#34) fails at `npm ci` with ERESOLVE because the group
sweeps typescript up to ~7.0.2, and nothing in this toolchain accepts it:
typescript-eslint peers >=4.8.4 <6.1.0 <- the binding constraint
@astrojs/check peers ^5.0.0 || ^6.0.0
@astrojs/svelte peers ^5.3.3 || ^6.0.0
So 6.0.x is the only version that satisfies everyone — which is why package.json
pins `~6.0.3`. This is not new information; it was decided during scaffolding. But
Dependabot had no way to know, so it re-proposed the same impossible bump every
week and took 9 unrelated dev-tool updates down with it each time.
Ignoring only the major means patch and minor TypeScript updates still flow.
Remove this entry when typescript-eslint widens its peer range past 7.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
**AI disclosure** (`/legal/ai-usage` + `/en/legal/ai-usage`, order 6). The site's
code was written with AI assistance and nothing said so anywhere. Built on the
`third-party.md` shape: bilingual framing sections plus one shared table.
It states, specifically:
- what AI did: writing source code, tests, debugging, and review/checking
- what it did NOT do: blog posts, stories, Q&A answers and photographs are
human-written and human-shot
- that every change lands via a PR the owner reads and merges — AI has no
publish access
- that the legal texts themselves were drafted from AI templates and have not
been reviewed by a lawyer (true, and exactly the kind of thing a disclosure
page exists to say)
- that none of this weakens the AI-training prohibition, cross-linking Terms §3
and the Content License rather than restating them
The table names model, version and vendor per task: Claude Opus 4.8 and Claude
Opus 5, both by Anthropic, via Claude Code. It also points at the git history as
the authoritative record, since AI-assisted commits carry a `Co-Authored-By:
Claude <noreply@anthropic.com>` trailer naming the model — a table can go stale,
the trailers cannot.
Wiring: `legalNav()`, `aiUsage` label in both i18n files, and the slug added to
the titleMap in BOTH `[slug].astro` routes. Routes generate themselves; the legal
gate already excludes `/legal/*` by regex.
**Root legal files.** docs 12 requires four files at the repo root and none
existed — while `src/content/legal/third-party.md` already told readers to look
in `THIRD-PARTY-NOTICES.md`. Now added: `LICENSE` (GPL-3.0-only, SPDX text),
`CONTENT-LICENSE.md`, `DISCLAIMER.md`, `THIRD-PARTY-NOTICES.md`. These matter
more now that the repo is going public: without CONTENT-LICENSE.md at the root, a
GPL LICENSE file next to `src/content/**` reads as if the stories and photos were
GPL too. They are not, and now that is written down where a forker will see it.
THIRD-PARTY-NOTICES.md splits ships-to-browser from build-time-only, and notes
that the two MPL-2.0 packages (satori, @resvg/resvg-js) are used unmodified as
build tools so no source-disclosure obligation is triggered.
**Bug fix:** `third-party.md` credited `@vite-pwa/astro / Workbox`, which is not
and never was a dependency — the service worker is a hand-written 60-line
`public/sw.js`. Replaced with the Satori/resvg entry that was genuinely missing.
Verified: 53 pages build (was 51), both locale routes emit, footer legal nav
shows 6 items, CSP guard passes 295/295, check/lint/knip/prettier all clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The OSV scan added in the previous commit immediately earned its keep by
catching a mistake in that same commit.
I had claimed js-yaml 3.x had no patched release ("the fix was not
backported") and wrote an osv-scanner.toml suppression for it. That was
wrong. OSV reports FIXED VERSION 3.15.1, and 3.15.1 is published and
satisfies gray-matter's declared `^3.13.1` — so it needed a one-line
override, not an exception. npm audit had been saying "fix available" all
along; I read the advisory title instead of the fix field.
- overrides: add `js-yaml@^3` -> `^3.15.1` (range-scoped alongside the
existing `js-yaml@^4` -> `^4.3.1`, so each major gets its own patch line
and gray-matter keeps the v3 API it needs)
- delete osv-scanner.toml — with nothing left to suppress, an empty policy
file is just a place for future exceptions to accumulate
- drop it from the workflow's pull_request paths filter
`npm audit` now reports **0 vulnerabilities** (was 1 high). Verified
gray-matter still parses frontmatter on 3.15.1: `npm run build` regenerates
all 8 OG images, which goes through gray-matter in scripts/gen-og.mjs.
Also fixes the config bug that made the suppression a no-op anyway: the key
is `ignoreUntil`, not `untilDate`, so the scanner logged "Ignored invalid
config file ... unknown keys in config file: IgnoredVulns.untilDate" and
scanned as if the file were absent. Moot now that the file is gone.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three supply-chain gaps, two of which the repo already claimed to have closed.
1. Actions were pinned to floating tags (`actions/checkout@v7`). A tag is mutable,
so CI executed whatever that tag pointed at on the day it ran. Now pinned to
commit SHAs with the version in a trailing comment; the existing
github-actions Dependabot ecosystem keeps both in sync.
2. Weekly OSV scan (.github/workflows/osv-scanner.yml). docs 06 §6 and 08 §2 both
require one and none existed. It complements the per-PR audit gate: `npm audit
--omit=dev --audit-level=high` only sees the production tree and only fails on
high+, while OSV covers the whole lockfile against the full database. Also runs
on PRs that touch package-lock.json so a bad bump is caught on the PR instead of
up to a week later.
It runs the scanner directly rather than the reusable SARIF workflow, because
SARIF upload needs `security-events: write` plus code scanning, which this plan
does not have. A non-zero exit failing the run is the alert. Switch to the
reusable workflow once the repo is public and code scanning is free.
osv-scanner.toml carries one suppression: gray-matter -> js-yaml@3.15.0
(GHSA-5p4m-2wfm-xmqj), which has no patched 3.x and only ever parses our own
committed frontmatter at build time. It has an `untilDate` so it expires and
gets re-argued rather than becoming permanent.
3. Install-script hardening. `.npmrc` asserted "ignore-scripts is applied in CI"
and that sharp needed scripts. Both were false: ci.yml never set it, and
sharp@0.35 ships prebuilt @img/sharp-* binaries with no install script at all.
Replaced with npm 11's allowlist model, which is what docs 06 §6 actually asks
for: package.json#allowScripts names the four packages that legitimately have
install scripts (esbuild, workerd, lefthook, fsevents) and .npmrc sets
strict-allow-scripts so anything unreviewed is a hard failure.
Verified in a clean directory: with strict on and esbuild NOT allow-listed,
`npm install` exits 1 with ESTRICTALLOWSCRIPTS; with it allow-listed, it
succeeds. A dependency that suddenly grows a postinstall now stops the build
instead of executing it.
Also: job-level `permissions:` on the build job, and dependabot.yml's stale note
about /workers/widgets corrected — the worker exists now; it is skipped because it
is deliberately dependency-free and has no manifest to read.
Verified: prettier, eslint, astro check (0 errors), knip, build + CSP guard, audit
gate all green; `npm ci --dry-run` confirms lockfile and package.json stay in sync.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
docs 06 §7 has specified `public/.well-known/security.txt` since the start and
it was never created — there is currently no machine-readable way to report a
vulnerability, and no SECURITY.md for GitHub's Security tab either.
- `public/.well-known/security.txt` — RFC 9116 valid (Contact + Expires are the
required fields; Expires is 10.7 months out, inside the 12-month guidance).
Contents follow docs 06 §7 verbatim, plus a `Policy:` line.
- `SECURITY.md` at the repo root — reporting address, response expectation, and
an explicit in/out-of-scope list so scanner-output reports can be declined
without a discussion. Includes what the site actually handles (no accounts,
no trackers, one Turnstile-gated form) since that governs real impact.
- `public/_headers` — `text/plain; charset=utf-8` for security.txt. Wrangler
already infers this from the extension; the entry is belt-and-braces.
- `public/robots.txt` — the AI-crawler block listed 5 user-agents and had gone
stale. Now 25, covering OpenAI (incl. OAI-SearchBot / ChatGPT-User),
Anthropic, Perplexity, Apple, ByteDance, Amazon, Meta, Cohere, Mistral,
Diffbot, AI2 and friends. Content is All Rights Reserved, so this mirrors the
Cloudflare "Block AI Scrapers" toggle.
Verified `.well-known/` survives the pipeline: Astro copies it to
dist/client/.well-known/security.txt, the generated `_headers` carries the
entry, and `.assetsignore` only excludes wrangler.json and .dev.vars — so
wrangler will upload it. Confirmed with curl after deploy.
Note: the `Policy:` URL resolves once the repo is public.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three production bugs, all verified against the live site before and after.
1. CSP violations in the console
Two separate causes, only one of which is ours:
- The theme bootstrap was `<script is:inline>`, which Astro never hashes
(core/csp/common.js `trackScriptHashes` walks bundled scripts, client
directives, island prebuilts and settings.scripts — `is:inline` is in
none of them). It survived only because a <meta> CSP does not govern
markup that precedes it, and the script happened to sit at byte 237 with
the meta at byte 16119. Fragile by accident.
- The same trick did NOT save /500 and /429, whose `is:inline` scripts sit
in the body, after the meta. Verified in dist: meta@8777, script@14554.
The 500 reference code and the 429 countdown have never run in
production.
Fixes: the theme bootstrap moves to `injectScript("head-inline", ...)` via
a tiny local integration — the one path that is both rendered verbatim
inline (no FOUC) and hashed from that same string, so the CSP cannot drift.
The two error-page scripts become processed `<script>` and get bundled and
hashed; deferring is harmless for a span fill and a 1s countdown.
`scripts/check-csp-hashes.mjs` now fails the build if any inline script is
missing from its page CSP. Currently: 283 scripts / 51 pages, 0 unhashed.
NOTE: the violation actually visible in the browser console is Cloudflare's
Browser Insights beacon (`window.__CF$cv$params`), which embeds the CF-RAY
so its hash changes per request and can never be allowlisted. That one is a
dashboard setting, not code.
2. Hovering any link logged a 503
`<ClientRouter />` force-enables prefetch with `prefetchAll: true` and a
hover strategy. Cloudflare's zone Speculation Rules then refuses every
`Sec-Purpose: prefetch` request to a Worker origin:
curl -H 'Sec-Purpose: prefetch' /gaming/ -> 503 Cf-Speculation-Refused
Both /gaming and /gaming/ 503, so this was never a trailing-slash problem.
`prefetch: false` is pinned so re-adding the router cannot silently switch
hover-prefetch back on. The zone toggle still has to be turned off too.
3. Pages not finishing render on route change
Astro documents `<ClientRouter />` as unsupported with `security.csp`, and
the mechanism is concrete: swapHeadElements removes the old <meta> CSP, but
removing a meta does not revoke an enforced policy — so each navigation
ANDs another policy onto the document. style-src genuinely differs per page
(58 distinct hashes site-wide, 45-47 per page), so after one soft nav the
destination loses stylesheets. Removing the router is the fix; CSP-as-header
is not available here (the Cloudflare adapter declares no
adapterFeatures.staticHeaders, so prerendered routes are forced to meta).
Nothing used transition:persist/name/animate, so only the default fade is
lost — and 16KB of the 81KB client JS budget goes with it.
Also in this pass:
- Trailing slash: `sectionPath`/`alternatePath` now emit the canonical form, so
nav hrefs match canonicals and the sitemap instead of costing a 307 each.
`isActivePath` had to change with them or every aria-current would silently
disappear (`"/blog/" + "/"` never matches). Deliberately NOT setting
`trailingSlash: "always"`: create-manifest.js gives extension-less endpoints
the config value, which would make POST /api/report 404.
- Pre-existing bug: middleware served `/403` and `/429` through ASSETS, but
those build to `403/index.html` and `html_handling: "auto-trailing-slash"`
answers the slash-less form with a 307 and an EMPTY body — which the handler
re-wrapped as a blank 403/429. Confirmed live: `/403` -> 307, 0 bytes.
Denylisted and rate-limited visitors have been getting a blank page.
Verified: build, astro check (0 errors), eslint, prettier, knip all green;
CSP guard passes; no slash-less internal hrefs remain in the built HTML.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`npm audit --omit=dev --audit-level=high` has been exiting 1 since the
undici advisories landed, so every CI run has failed at the "Audit (prod
deps, high+)" step and four Dependabot PRs (#26, #30, #31, #32) are stuck
behind a red gate unrelated to their contents.
`--omit=dev` cannot exclude these: @astrojs/cloudflare is a *prod*
dependency and pulls @cloudflare/vite-plugin -> miniflare -> undici, and
vite -> postcss -> nanoid. Bumping wrangler alone does not help because
miniflare's range is not ours to control, so pin via overrides:
- undici ^7.29.0 (3 HIGH: cache disclosure, retry desync, CRLF)
- fast-uri ^3.1.5 (2 HIGH: host confusion via backslash authority)
- postcss ^8.5.26 (sourceMappingURL arbitrary .map read)
- nanoid ^3.3.18 (infinite loop on zero size)
- js-yaml@^4 -> ^4.3.1 (quadratic CPU in !!omap)
The js-yaml override is range-scoped on purpose: gray-matter needs the
v3 API (safeLoad), so an unscoped override would force it to v4 and break
scripts/gen-og.mjs.
Also bump wrangler ^4.114.0 -> ^4.120.0 (declared range no longer matched
what was installed).
One HIGH remains and is deliberately left: gray-matter -> js-yaml@3.15.0.
It is dev-only, has no patched 3.x release (the fix was not backported),
and only ever parses our own content frontmatter at build time.
Verified: npm audit --omit=dev --audit-level=high now exits 0; prettier,
eslint, astro check (0 errors), knip and the full build are all green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds a "Tất cả repo công khai / All public repos" link on /projects (+ /en)
pointing to the RepoLens listing (repolens.k30021424.workers.dev/repos).
ALL_REPOS_URL constant in links.ts; dev.allRepos i18n (vi + en).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- public/sw.js: minimal offline-fallback SW (network-first navigations →
cached /offline/, cache-first + warm for /_astro/*). Hand-rolled because
@vite-pwa/astro caps at astro ^5.
- BaseLayout registers it once after load (CSP-safe processed script).
- public/_headers: /sw.js → Cache-Control: no-cache so updates propagate.
- 404: inline search input that lazy-loads the Pagefind runtime on first
keystroke and lists top hits; degrades silently without an index.
- knip: ignore public/sw.js (referenced by URL, not imported).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- scripts/gen-og.mjs: renders a 1200x630 card per blog/story/project entry
(both locales) + a default card into dist/client/og/. Ink-night background,
Waveline motif, Bricolage title, section badge, CW strip for stories.
- Runs in Node from the build script: a prerendered endpoint runs in workerd
(no sharp/fs), verified — so generation is a post-build Node step.
- Static Bricolage TTFs (instanced from the variable font via fonttools)
committed for Satori (it can't read WOFF2 or variable fonts).
- src/lib/og.ts: pure ogUrl()/DEFAULT_OG. seo.ts defaults og:image to the
default card; Post/Story/Project layouts pass per-entry images.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- @astrojs/rss@4; prerendered endpoints emit static XML at build.
- /rss.xml (blog + stories, both locales, 30 newest), /blog/rss.xml,
/truyen/rss.xml. Per-item <dc:language> disambiguates vi/en.
- Stories are description + link ONLY (all rights reserved) — no content.
- src/lib/rss.ts item builders; getAllBlogPosts/getAllStoryChapters helpers.
- RSS autodiscovery <link> in BaseLayout head.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- links.ts: SocialLink gains persona (game/dev) + platform; real account
URLs (info.txt), Instagram + Steam added, Telegram dropped.
- CONTACT_EMAILS: contact@/code@/sponsor@/games@ with topic labels + helpers
(socialsForPersona, emailForScope).
- LinksList: two persona sections (SkullMute — Game / Kokone — Dev · life)
plus a contact block; every row gets a brand glyph.
- SocialIcon.astro: Simple Icons (CC0) glyphs keyed by platform slug.
- Footer: social-icon row + contact line (contact@ / sponsor@); author now
from SITE.author instead of a hardcoded string.
- i18n: linksGroups + footer.social (vi + en).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>