Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20e312b851 | ||
|
|
b200da80b8 | ||
|
|
82fe6a7648 | ||
|
|
be8ef93e3a | ||
|
|
9473856800
|
||
|
|
2f072a3236
|
||
|
|
c579639697
|
||
|
|
7b197c702b | ||
|
|
b2529c57e1 | ||
|
|
b68fe2ef19 | ||
|
|
981e625ca1 | ||
|
|
289ab47e51 | ||
|
|
eee61f67a0 | ||
|
|
381ac8799a | ||
|
|
ef4af06158 | ||
|
|
b5517f05c9 | ||
|
|
732e6364b0 | ||
|
|
57e5cae1b8 | ||
|
|
06b141c63c | ||
|
|
0741867294 | ||
|
|
b91f6504d9 | ||
|
|
94c7e4ef47 | ||
|
|
802ba0fc35 | ||
|
|
20871c27dc | ||
|
|
6650aa6bf7 | ||
|
|
0cdc730461 | ||
|
|
ffb470cebc | ||
|
|
05b3769386 | ||
|
|
27b7618e86 | ||
|
|
1ad60f1b7e | ||
|
|
197c928998 | ||
|
|
eafb247ca7 | ||
|
|
af794fbd93 | ||
|
|
18f517fe5e | ||
|
|
32085564b1 | ||
|
|
4351fffaae | ||
|
|
501b9f2533 | ||
|
|
8bd1fc0aac | ||
|
|
2c40baf5c0 | ||
|
|
0c6e5bc85d | ||
|
|
3743cfbfe0 | ||
|
|
ff95578f48 | ||
|
|
017b07232c |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
# Local secrets for `wrangler dev` — copy to .dev.vars (git-ignored).
|
||||
# Cloudflare's always-pass Turnstile TEST secret; pairs with the test
|
||||
# sitekey the gate uses on localhost (src/lib/turnstile.ts). Production uses
|
||||
# a runtime secret set in the dashboard, never a file.
|
||||
TURNSTILE_SECRET=1x0000000000000000000000000000000AA
|
||||
@@ -0,0 +1,18 @@
|
||||
# Normalise line endings to LF in the repo AND the working tree, on every OS.
|
||||
# Without this, Windows checkouts with core.autocrlf=true get CRLF files and
|
||||
# Prettier (endOfLine: lf) fails locally while CI on Linux passes.
|
||||
* text=auto eol=lf
|
||||
|
||||
# Binary assets — never touch.
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.jpeg binary
|
||||
*.gif binary
|
||||
*.webp binary
|
||||
*.avif binary
|
||||
*.ico binary
|
||||
*.woff binary
|
||||
*.woff2 binary
|
||||
*.ttf binary
|
||||
*.otf binary
|
||||
*.pdf binary
|
||||
@@ -0,0 +1,14 @@
|
||||
# docs/12 §8 — T6: a malicious PR must not be able to alter what runs.
|
||||
#
|
||||
# Gitea reads this file from the repository root, docs/ or .gitea/ only, and
|
||||
# treats each pattern as a regular expression matched against the path (a
|
||||
# pattern without `*` is NOT a glob). Branch protection on `main` does not
|
||||
# REQUIRE an approval (single-maintainer repository); what it requires is a PR
|
||||
# and the `CI / build (*)` and `CI / gates (*)` checks — see docs/12 §8. The
|
||||
# highest-risk paths are still named, so a review request always reaches the
|
||||
# owner for them.
|
||||
.* @poli0981
|
||||
^\.gitea/.* @poli0981
|
||||
^scripts/.* @poli0981
|
||||
^src/data/.* @poli0981
|
||||
^worker/.* @poli0981
|
||||
@@ -0,0 +1,279 @@
|
||||
# docs/12 §2 — self-contained, deliberately.
|
||||
#
|
||||
# It once called `poli0981/.github` → `reusable-web-react.yml`, which ran
|
||||
# lint / typecheck / test only *if a matching package script existed* — rename
|
||||
# a script and CI quietly stops checking while still going green. This
|
||||
# project's gates ARE the product, and it has shipped silent no-ops before (a
|
||||
# dead set:html lint rule, workbox globs matching nothing, an unregistered
|
||||
# service worker, CSP-dropped inline styles). The duplicated "logic" is a
|
||||
# handful of pnpm invocations: a fair price for a gate that fails loudly.
|
||||
#
|
||||
# Gitea Actions since 2026-11-24 (D38, runbook `docs/GITEA-MIGRATION.md` in
|
||||
# poli0981/.github): one runner on the maintainer's PC, jobs in Docker
|
||||
# (`docker.gitea.com/runner-images`, as root). Branch protection on `main`
|
||||
# requires `CI / build (*)` and `CI / gates (*)` — Gitea names a check
|
||||
# `<workflow> / <job> (<event>)`, so renaming either breaks the rule.
|
||||
#
|
||||
# Every `uses:` is pinned to a full commit SHA with the release in a comment;
|
||||
# Renovate (renovate.json) bumps both together.
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
# How the bots' pull requests get their checks: an event caused by the job
|
||||
# token starts no workflow, so quarantine.yml and vt-recheck.yml dispatch
|
||||
# this one on their branch, and `record` below turns the dispatched run's
|
||||
# results into the statuses protection asks for (docs/12 §4).
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
# No `version:` — the action reads package.json `packageManager`, so CI
|
||||
# and laptops run the same pnpm.
|
||||
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
|
||||
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Lint & format
|
||||
run: pnpm lint
|
||||
- name: Types
|
||||
run: pnpm check
|
||||
# `coverage` IS the unit run (vitest run --coverage): one pass, and it
|
||||
# fails below the thresholds in vitest.config.ts.
|
||||
- name: Unit tests (with coverage thresholds)
|
||||
run: pnpm coverage
|
||||
# `pnpm build` is the SAME command the `deploy` job runs, and it carries
|
||||
# its own gates: data + i18n before `astro build`, the CSP, asset,
|
||||
# service-worker and feed checks on dist/ after it (package.json).
|
||||
- name: Build (with data, i18n, CSP and service-worker gates)
|
||||
run: pnpm build
|
||||
# Bundles worker/ and validates wrangler.jsonc (bindings, assets,
|
||||
# run_worker_first) exactly as a deploy would, without credentials. A
|
||||
# config error then fails here instead of in production.
|
||||
- name: Worker bundle (wrangler deploy --dry-run)
|
||||
env:
|
||||
WRANGLER_SEND_METRICS: 'false'
|
||||
run: pnpm exec wrangler deploy --dry-run --outdir "$RUNNER_TEMP/worker"
|
||||
- name: Dead code
|
||||
run: pnpm knip
|
||||
|
||||
# End-to-end on the build above (docs/11): every page type in both
|
||||
# locales and colour schemes, desktop + mobile, failing on any console
|
||||
# error, CSP violation or axe finding. The browser download is ~150 MB
|
||||
# and versioned with @playwright/test, so it is cached per version; on a
|
||||
# hit only the OS libraries still need installing. The servers bind
|
||||
# 127.0.0.1 explicitly (playwright.config.ts): in the job container
|
||||
# `localhost` can resolve to ::1 for a server and 127.0.0.1 for a client.
|
||||
- name: Playwright version
|
||||
id: pw
|
||||
run: echo "version=$(pnpm exec playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
id: pw-cache
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ steps.pw.outputs.version }}
|
||||
- name: Install Chromium
|
||||
if: steps.pw-cache.outputs.cache-hit != 'true'
|
||||
run: pnpm exec playwright install --with-deps chromium
|
||||
- name: Install Chromium system libraries
|
||||
if: steps.pw-cache.outputs.cache-hit == 'true'
|
||||
run: pnpm exec playwright install-deps chromium
|
||||
- name: End-to-end (Playwright + axe on the built site)
|
||||
run: pnpm e2e
|
||||
# The route from the runner to the server's artifact store has dropped
|
||||
# uploads mid-way (ticktune, 2026-11-23): a lost report must never turn
|
||||
# a red run into a confusing one.
|
||||
- name: Keep the Playwright report
|
||||
if: failure()
|
||||
continue-on-error: true
|
||||
uses: christopherhx/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 7
|
||||
|
||||
gates:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
OSV_SCANNER_VERSION: v2.7.1
|
||||
OSV_SCANNER_SHA256: fb7dab19a8bd9bbe5c3189f09d4b7ee1820c9553a23bac202648a56efd2f6ee8 # osv-scanner_linux_amd64
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: 0 # the changed-links step diffs against the PR base
|
||||
persist-credentials: false
|
||||
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
|
||||
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Data rules (L2)
|
||||
run: pnpm validate:data
|
||||
- name: EN/VI key parity (hard rule 6)
|
||||
run: pnpm i18n:check
|
||||
|
||||
# The same pinned, checksum-verified binary the ops repo's security.yml
|
||||
# runs, here because this gate is REQUIRED: an advisory against the
|
||||
# lockfile blocks the merge (docs/09 §7). osv-scanner.toml, beside the
|
||||
# lockfile, holds the time-boxed exceptions. Renovate does not see this
|
||||
# pin: bump version and checksum together, by hand.
|
||||
- name: Install osv-scanner ${{ env.OSV_SCANNER_VERSION }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
bin="$RUNNER_TEMP/osv-scanner/osv-scanner"
|
||||
mkdir -p "$(dirname "$bin")"
|
||||
curl --proto '=https' -fsSL --retry 3 -o "$bin" \
|
||||
"https://github.com/google/osv-scanner/releases/download/${OSV_SCANNER_VERSION}/osv-scanner_linux_amd64"
|
||||
echo "${OSV_SCANNER_SHA256} $bin" | sha256sum -c -
|
||||
chmod +x "$bin"
|
||||
echo "$RUNNER_TEMP/osv-scanner" >> "$GITHUB_PATH"
|
||||
- name: Vulnerability scan
|
||||
run: osv-scanner scan source --lockfile=pnpm-lock.yaml
|
||||
- name: Audit production deps
|
||||
run: pnpm audit --prod
|
||||
|
||||
# PR-time link check over the links a PR adds or edits — the URLs on the
|
||||
# diff's added lines — not every link in every touched file: a re-check
|
||||
# PR that rewrote 198 security blocks once had to re-verify ~700
|
||||
# unrelated vendor links, and one vendor's bad minute blocked it.
|
||||
# link-check.yml owns the weekly full sweep (docs/12 §5). git runs HERE,
|
||||
# under pipefail, so a failed diff stops the job instead of silently
|
||||
# narrowing the check.
|
||||
- name: Collect changed official links
|
||||
id: urls
|
||||
if: github.event_name == 'pull_request'
|
||||
env:
|
||||
BASE_REF: ${{ github.base_ref }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git diff -U0 "origin/${BASE_REF}...HEAD" -- src/data/apps \
|
||||
| node scripts/extract-urls.mjs --added > /tmp/urls.txt
|
||||
count=$(grep -c . /tmp/urls.txt || true)
|
||||
echo "count=$count" >> "$GITHUB_OUTPUT"
|
||||
echo "$count changed URL(s) to check"
|
||||
# Accepting 403/429 is about bot mitigation, not about being lenient.
|
||||
# Seeding the catalogue put ~1 150 vendor URLs through here and 14 came
|
||||
# back 403 from sites that are plainly alive (winehq.org, dolphin-emu.org,
|
||||
# rpcs3.net, gitlab.com, MSI, Nexus Mods, Epic, Enpass). A checker that
|
||||
# cries wolf on a seventh of the catalogue teaches everyone to ignore it.
|
||||
# 404/500/connection failures — the codes that actually mean "gone" —
|
||||
# still fail the build.
|
||||
#
|
||||
# Do NOT add `--user-agent`: spoofing a browser cleared the 403s but made
|
||||
# gitlab.gnome.org answer 406 and whatsapp.com 400, both of which pass on
|
||||
# lychee's default agent.
|
||||
#
|
||||
# Skipped when the PR changes no app data — lychee treats an empty input
|
||||
# as a configuration error. A skipped step is visible in the run, where a
|
||||
# green "0 links" would be exactly the kind of quiet pass this repo keeps
|
||||
# getting caught by.
|
||||
- name: Link check
|
||||
if: github.event_name == 'pull_request' && steps.urls.outputs.count != '0'
|
||||
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0
|
||||
with:
|
||||
args: >-
|
||||
--max-concurrency 4 --retry-wait-time 5 --max-retries 4 --timeout 45
|
||||
--accept '200..=299,403,429'
|
||||
/tmp/urls.txt
|
||||
|
||||
# A dispatched run writes no commit status on Gitea 28.4 (runbook §6), so a
|
||||
# bot PR whose checks came from `workflow_dispatch` would never meet the
|
||||
# protection rule. This job records build's and gates' results on the
|
||||
# commit under the names the rule matches (`CI / build (*)`).
|
||||
record:
|
||||
needs: [build, gates]
|
||||
if: always() && github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
contents: write # commit statuses
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- name: Record build and gates as commit statuses
|
||||
env:
|
||||
GITEA_API: ${{ github.api_url }}
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
SHA: ${{ github.sha }}
|
||||
BUILD: ${{ needs.build.result }}
|
||||
GATES: ${{ needs.gates.result }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
node scripts/gitea.mjs status "$SHA" 'CI / build (workflow_dispatch)' "$BUILD" "$RUN_URL"
|
||||
node scripts/gitea.mjs status "$SHA" 'CI / gates (workflow_dispatch)' "$GATES" "$RUN_URL"
|
||||
|
||||
# D38 — production deploys from here. Cloudflare Workers Builds pulled from
|
||||
# the GitHub repository and stopped with it; nothing else deploys, and pull
|
||||
# requests get no preview versions (the Cloudflare token stays out of every
|
||||
# job a branch can run). CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID are
|
||||
# user-level Gitea Actions secrets. The Worker's runtime secret
|
||||
# (TURNSTILE_SECRET) lives on the Worker and survives a deploy.
|
||||
deploy:
|
||||
needs: [build, gates]
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
|
||||
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
- name: Deploy to Cloudflare Workers
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
WRANGLER_SEND_METRICS: 'false'
|
||||
run: pnpm exec wrangler deploy --message "main ${GITHUB_SHA:0:7}"
|
||||
# /api/apps.json carries the build's own timestamp: production serves
|
||||
# THIS build once it answers with the one in dist/. The query string
|
||||
# skips any cached copy (the file is cached for 5 minutes, _headers).
|
||||
- name: Live
|
||||
run: |
|
||||
want=$(node -p "require('./dist/api/apps.json').generatedAt")
|
||||
for i in $(seq 1 30); do
|
||||
live=$(curl -fsS "https://softharbor.net/api/apps.json?deploy=${GITHUB_SHA}" \
|
||||
| node -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{try{console.log(JSON.parse(s).generatedAt)}catch{console.log("")}})' || true)
|
||||
if [ "$live" = "$want" ]; then echo "live: $live"; exit 0; fi
|
||||
sleep 5
|
||||
done
|
||||
echo "::error::production still serves ${live:-nothing}, not this build's $want"
|
||||
exit 1
|
||||
@@ -0,0 +1,64 @@
|
||||
# docs/12 §5 — weekly full sweep of every official link in the dataset.
|
||||
# PR-time checking covers only the links a PR adds, inside ci.yml's `gates`.
|
||||
#
|
||||
# ONE tracking issue, not one per week: the open issue is refreshed in place,
|
||||
# and closed automatically the first week the sweep comes back clean
|
||||
# (scripts/gitea.mjs `link-rot`; it once left 12 duplicates open on GitHub).
|
||||
#
|
||||
# Monday 14:43 UTC (21:43 Vietnam): scheduled jobs run only inside
|
||||
# 13:00–16:00 UTC, on a slot no other repository uses (cron registry in
|
||||
# poli0981/.github docs/migration/README.md). If the maintainer's PC is off,
|
||||
# the run waits and starts when the runner comes back (cancelled after 24 h).
|
||||
name: link-check
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '43 14 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: link-check
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
lychee:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write # the tracking issue
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
# extract-urls.mjs and gitea.mjs are plain Node, but they should run on
|
||||
# the project's Node (.nvmrc), not whatever the runner image ships.
|
||||
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
- run: node scripts/extract-urls.mjs > /tmp/urls.txt
|
||||
|
||||
- id: lychee
|
||||
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0
|
||||
with:
|
||||
# Kept in step with ci.yml's PR sweep — see the note there for why
|
||||
# 403/429 are accepted. More retries with a longer wait: vendor
|
||||
# sites blip, and a weekly job has the time to ride that out.
|
||||
args: >-
|
||||
--max-concurrency 4 --retry-wait-time 10 --max-retries 5 --timeout 45
|
||||
--accept '200..=299,403,429'
|
||||
/tmp/urls.txt
|
||||
output: ./lychee/out.md
|
||||
# Link rot is triage, not a build break — it updates an issue instead.
|
||||
fail: false
|
||||
|
||||
- name: Refresh the tracking issue
|
||||
env:
|
||||
GITEA_API: ${{ github.api_url }}
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
EXIT_CODE: ${{ steps.lychee.outputs.exit_code }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: node scripts/gitea.mjs link-rot "$EXIT_CODE" ./lychee/out.md "$RUN_URL"
|
||||
@@ -0,0 +1,37 @@
|
||||
# docs/12 §2 — a published release → Discord.
|
||||
#
|
||||
# Publish the Gitea release BY HAND (Releases → the tag → Publish), as docs/13
|
||||
# §3 says: an event caused by the job token starts no workflow, so a release a
|
||||
# workflow created would never announce itself. Re-announce with
|
||||
# Actions → notify → Run workflow and the tag.
|
||||
#
|
||||
# Scope note: announce-release.yml reaches DISCORD ONLY. The multi-platform
|
||||
# notify.py cross-poster consumes /rss.xml on its own schedule (docs/03 §7,
|
||||
# docs/13 §5), so per-app announcements need no workflow here — only a valid,
|
||||
# deterministic feed.
|
||||
name: notify
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: Release tag to (re-)announce, e.g. v1.5.0
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
announce:
|
||||
permissions:
|
||||
contents: read
|
||||
uses: poli0981/.github/.gitea/workflows/announce-release.yml@8e6582af9a5846b4d8995b26b1421488d29d761b # ops v2026.11.2
|
||||
with:
|
||||
tag_override: ${{ inputs.tag || '' }}
|
||||
# The notifier script is loaded from the same commit as the workflow.
|
||||
ops_ref: 8e6582af9a5846b4d8995b26b1421488d29d761b
|
||||
# Only what the announcement needs, never `secrets: inherit`.
|
||||
secrets:
|
||||
DISCORD_RELEASES_WEBHOOK: ${{ secrets.DISCORD_RELEASES_WEBHOOK }}
|
||||
@@ -0,0 +1,38 @@
|
||||
# docs/12 §2 — Qodana (D35): JetBrains' WebStorm-based analysis. Scope and the
|
||||
# quality gate live in qodana.yaml (qodana-js, native mode, any finding fails).
|
||||
#
|
||||
# Since D38 it runs through the ops repo's reusable workflow (the Qodana CLI,
|
||||
# pinned and checksum-verified): JetBrains/qodana-action needs GitHub's APIs,
|
||||
# and Gitea has no code-scanning UI. The findings live in Qodana Cloud
|
||||
# (project `softharbor`) and in the run's `qodana-report` artifact.
|
||||
#
|
||||
# Deliberately NOT a required check: a Qodana Cloud outage, or a licence that
|
||||
# lapses (the Ultimate licence runs to 2026-12-31), must never block a merge.
|
||||
# Runs started by renovate-bot skip the scan (the reusable's own guard): Gitea
|
||||
# gives same-repo pull requests the secrets, and such a run installs the very
|
||||
# update under review.
|
||||
name: Qodana
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
jobs:
|
||||
qodana:
|
||||
permissions:
|
||||
contents: read
|
||||
uses: poli0981/.github/.gitea/workflows/reusable-qodana.yml@8e6582af9a5846b4d8995b26b1421488d29d761b # ops v2026.11.2
|
||||
with:
|
||||
package-manager: pnpm # native mode resolves imports against this install
|
||||
node-version-file: .nvmrc
|
||||
prepare-command: pnpm exec astro sync # .astro/ types, which tsconfig includes
|
||||
secrets:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
@@ -0,0 +1,89 @@
|
||||
# docs/12 §4 — enforces hard rule 5 mechanically.
|
||||
#
|
||||
# Runs on data pushes AND daily. The daily run re-checks main so a flagged
|
||||
# entry that slipped past review is moved within a day — as a PR, not a push
|
||||
# to main, so a human stays in the loop and branch protection still applies.
|
||||
#
|
||||
# On Gitea (D38):
|
||||
# - The bot commits to `quarantine/auto` and pushes with the job token, then
|
||||
# opens or updates the PR through the API (scripts/gitea.mjs). Its commits
|
||||
# are unsigned — Gitea has no API that signs them — which is why branch
|
||||
# protection does not require signed commits.
|
||||
# - A push or PR the job token makes starts no workflow, so this job
|
||||
# dispatches ci.yml and security.yml on the branch; ci.yml's `record` job
|
||||
# turns the dispatched results into the statuses protection asks for.
|
||||
# - `[quarantine] <slug>` issues are created only when none is open.
|
||||
# - Step outputs never reach `run:` bodies through `${{ }}` (expression
|
||||
# injection); they pass through `env:`, and gitea.mjs validates slugs.
|
||||
# - Daily at 13:17 UTC (20:17 Vietnam), inside the runner's 13:00–16:00 UTC
|
||||
# window, on a slot from the cron registry (poli0981/.github
|
||||
# docs/migration/README.md).
|
||||
name: quarantine
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths: ['src/data/apps/**']
|
||||
schedule:
|
||||
- cron: '17 13 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: quarantine
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
sweep:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: write # push quarantine/auto
|
||||
pull-requests: write # open or update the PR
|
||||
issues: write # one tracking issue per slug
|
||||
actions: write # dispatch the checks onto the PR branch
|
||||
steps:
|
||||
# No persisted token while repository code (quarantine.mjs) runs; the
|
||||
# push below authenticates on its own.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- id: sweep
|
||||
run: node scripts/quarantine.mjs
|
||||
|
||||
- name: Commit and push quarantine/auto
|
||||
id: push
|
||||
if: steps.sweep.outputs.moved != ''
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
MOVED: ${{ steps.sweep.outputs.moved }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name 'SoftHarbor bot'
|
||||
git config user.email 'actions@noreply.git.poli0981.dev'
|
||||
git switch -c quarantine/auto
|
||||
git add -A src/data/apps data/quarantine
|
||||
git commit -q -m "data: quarantine ${MOVED}"
|
||||
auth=$(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)
|
||||
git -c "http.extraheader=AUTHORIZATION: basic ${auth}" push -q --force origin HEAD:refs/heads/quarantine/auto
|
||||
printf 'Automated sweep: entries with `security.status: "flagged"` were\nmoved to `data/quarantine/`, which is outside the content glob, so\nthey stop rendering on the next build (docs/03 §5).\n\nNothing was deleted. Restoring is a `git mv` plus a status edit;\nthe reason and evidence live in the linked tracking issue.\n' > "$RUNNER_TEMP/pr-body.md"
|
||||
echo "pushed=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Open the PR, run its checks, open the tracking issues
|
||||
if: steps.push.outputs.pushed == 'true'
|
||||
env:
|
||||
GITEA_API: ${{ github.api_url }}
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
MOVED: ${{ steps.sweep.outputs.moved }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
node scripts/gitea.mjs pr quarantine/auto 'data: quarantine flagged entries' "$RUNNER_TEMP/pr-body.md" 'security,quarantine'
|
||||
node scripts/gitea.mjs dispatch quarantine/auto ci.yml security.yml
|
||||
# shellcheck disable=SC2086 # one argument per slug, on purpose
|
||||
node scripts/gitea.mjs quarantine-issues $MOVED
|
||||
@@ -0,0 +1,32 @@
|
||||
# docs/12 §2 — the ops repo's security checks (D38), replacing CodeQL, which
|
||||
# Gitea does not have:
|
||||
#
|
||||
# secrets gitleaks over the whole history (.gitleaksignore lists the public
|
||||
# identifiers it would otherwise flag)
|
||||
# sast Opengrep with pinned community rules for JavaScript/TypeScript;
|
||||
# report-only, SARIF kept as an artifact
|
||||
# deps osv-scanner over pnpm-lock.yaml (osv-scanner.toml applies)
|
||||
#
|
||||
# Not a required check (ci.yml `gates` is the one that blocks on advisories).
|
||||
# Weekly slot `37 15 * * 2` — Tuesday 22:37 Vietnam — from the cron registry
|
||||
# in poli0981/.github docs/migration/README.md: the runner only takes
|
||||
# scheduled jobs inside 13:00–16:00 UTC.
|
||||
name: Security
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '37 15 * * 2'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
permissions:
|
||||
contents: read
|
||||
uses: poli0981/.github/.gitea/workflows/security.yml@8e6582af9a5846b4d8995b26b1421488d29d761b # ops v2026.11.2
|
||||
with:
|
||||
node: true
|
||||
@@ -0,0 +1,185 @@
|
||||
# docs/12 §4b — VirusTotal re-check (docs/09 §6 step 5, assisted).
|
||||
#
|
||||
# Daily on main: scripts/vt-recheck.mjs re-scans the entries whose check is
|
||||
# due and the bot opens — or updates — ONE pull request, `vt/recheck`. While
|
||||
# that PR is open, each run first carries its results over, so the next day
|
||||
# continues with the next entries instead of re-scanning the same stalest
|
||||
# ones (main still shows them as stale until the PR merges). A detection
|
||||
# never flags anything: a `clean` entry becomes `unverified` and gets a
|
||||
# tracking issue, and the maintainer decides (quarantine stays a reviewed
|
||||
# `pnpm quarantine`, hard rule 5).
|
||||
#
|
||||
# Dispatched on any other branch it is a PREVIEW: it scans only the listed
|
||||
# slugs — or, with none, the entries that were never scanned, i.e. a data
|
||||
# PR's new apps — prints the patched `security` blocks in the log and keeps
|
||||
# the files as the `vt-preview` artifact, for the maintainer to review and
|
||||
# commit. No PR, no issues.
|
||||
#
|
||||
# VirusTotal's Public API allows 4 requests a minute and 500 a day (reset at
|
||||
# 00:00 UTC). The script paces itself, spends at most the `budget`, and stops
|
||||
# cleanly at the quota; the next run continues. The concurrency group keeps
|
||||
# two runs from sharing the key's per-minute limit.
|
||||
#
|
||||
# On Gitea (D38): daily at 13:59 UTC (20:59 Vietnam), inside the runner's
|
||||
# 13:00–16:00 UTC window (cron registry in poli0981/.github
|
||||
# docs/migration/README.md). The PR, its checks and the issues go through
|
||||
# scripts/gitea.mjs with the job token — see quarantine.yml for why the
|
||||
# checks are dispatched and the commits unsigned.
|
||||
name: vt-recheck
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '59 13 * * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
slugs:
|
||||
description: 'Slugs to scan first, space or comma separated (on a branch other than main: only these, or the never-scanned when empty)'
|
||||
required: false
|
||||
default: ''
|
||||
promote:
|
||||
description: "Slugs to move unverified → clean IF their scan comes back clean — the maintainer's docs/09 §6 call"
|
||||
required: false
|
||||
default: ''
|
||||
max_age:
|
||||
description: 'Re-scan checks older than this many days'
|
||||
required: false
|
||||
default: '90'
|
||||
budget:
|
||||
description: 'VirusTotal requests this run may spend (500/day; each URL costs at least 2)'
|
||||
required: false
|
||||
default: '440'
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: vt-recheck
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
recheck:
|
||||
runs-on: ubuntu-latest
|
||||
# 440 requests at 15.5 s each is about two hours.
|
||||
timeout-minutes: 150
|
||||
permissions:
|
||||
contents: write # push vt/recheck
|
||||
pull-requests: write # open or update the PR
|
||||
issues: write # one tracking issue per detection
|
||||
actions: write # dispatch the checks onto the PR branch
|
||||
env:
|
||||
GITEA_API: ${{ github.api_url }}
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
steps:
|
||||
# No persisted token while repository code runs; the push below
|
||||
# authenticates on its own.
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
# Only an OPEN pull request's results are carried: merged branches are
|
||||
# deleted, and a PR closed without merging was a rejection, never to be
|
||||
# re-adopted.
|
||||
- name: Is a re-check PR open?
|
||||
id: open
|
||||
if: github.ref == 'refs/heads/main'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
run: node scripts/gitea.mjs pr-open vt/recheck
|
||||
- name: Carry the open re-check PR
|
||||
id: carry
|
||||
if: steps.open.outputs.open == 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git fetch --no-tags --depth=1 origin vt/recheck
|
||||
mkdir -p "$RUNNER_TEMP/carry"
|
||||
git archive FETCH_HEAD src/data/apps | tar -x -C "$RUNNER_TEMP/carry"
|
||||
echo "dir=$RUNNER_TEMP/carry/src/data/apps" >> "$GITHUB_OUTPUT"
|
||||
echo "tree=$(git rev-parse 'FETCH_HEAD^{tree}')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Everything reaches the script through env (never `${{ }}` inside
|
||||
# `run:`); it validates slugs and numbers itself.
|
||||
- name: Re-check on VirusTotal
|
||||
id: scan
|
||||
env:
|
||||
VT_API_KEY: ${{ secrets.VT_API_KEY }}
|
||||
VT_SLUGS: ${{ inputs.slugs }}
|
||||
VT_PROMOTE: ${{ inputs.promote }}
|
||||
VT_MAX_AGE: ${{ inputs.max_age }}
|
||||
VT_BUDGET: ${{ inputs.budget }}
|
||||
VT_ONLY_LISTED: ${{ github.ref != 'refs/heads/main' && '1' || '' }}
|
||||
VT_CARRY: ${{ steps.carry.outputs.dir }}
|
||||
VT_SUMMARY: ${{ runner.temp }}/vt-summary.md
|
||||
VT_REVIEW_JSON: ${{ runner.temp }}/vt-review.json
|
||||
run: node scripts/vt-recheck.mjs
|
||||
|
||||
- name: Job summary
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f "$RUNNER_TEMP/vt-summary.md" ]; then
|
||||
cat "$RUNNER_TEMP/vt-summary.md" >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
|
||||
# ── preview (any branch but main) ─────────────────────────────────────
|
||||
# The diff in the log is the review copy: an artifact needs a signed-in
|
||||
# download, the log does not. Only the `security` blocks may be copied
|
||||
# into the data PR (docs/12 §4b) — a whole file from the dispatch commit
|
||||
# would revert later edits.
|
||||
- name: Collect the preview
|
||||
if: github.ref != 'refs/heads/main' && steps.scan.outputs.changed != '0'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git --no-pager diff -- src/data/apps
|
||||
mkdir -p "$RUNNER_TEMP/vt-preview"
|
||||
git diff --name-only -- src/data/apps | while read -r f; do
|
||||
cp --parents "$f" "$RUNNER_TEMP/vt-preview/"
|
||||
done
|
||||
cp "$RUNNER_TEMP/vt-summary.md" "$RUNNER_TEMP/vt-preview/"
|
||||
- name: Keep the preview
|
||||
if: github.ref != 'refs/heads/main' && steps.scan.outputs.changed != '0'
|
||||
continue-on-error: true # the log above already holds the result
|
||||
uses: christopherhx/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4
|
||||
with:
|
||||
name: vt-preview
|
||||
path: ${{ runner.temp }}/vt-preview/
|
||||
retention-days: 7
|
||||
|
||||
# ── main: one accumulating PR ─────────────────────────────────────────
|
||||
# Pushed only when the branch would actually change: with a PR open, the
|
||||
# carried results alone make `changed` non-zero every day.
|
||||
- name: Commit and push vt/recheck
|
||||
id: push
|
||||
if: github.ref == 'refs/heads/main' && steps.scan.outputs.changed != '0'
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
OLD_TREE: ${{ steps.carry.outputs.tree }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name 'SoftHarbor bot'
|
||||
git config user.email 'actions@noreply.git.poli0981.dev'
|
||||
git switch -c vt/recheck
|
||||
git add src/data/apps
|
||||
git commit -q -m 'data: refresh VirusTotal scans'
|
||||
if [ "$(git rev-parse 'HEAD^{tree}')" = "$OLD_TREE" ]; then
|
||||
echo "vt/recheck already holds these results — nothing to push."
|
||||
exit 0
|
||||
fi
|
||||
auth=$(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)
|
||||
git -c "http.extraheader=AUTHORIZATION: basic ${auth}" push -q --force origin HEAD:refs/heads/vt/recheck
|
||||
echo "pushed=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Open or update the PR and run its checks
|
||||
if: steps.push.outputs.pushed == 'true'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
node scripts/gitea.mjs pr vt/recheck 'data: VirusTotal re-check' "$RUNNER_TEMP/vt-summary.md" security
|
||||
node scripts/gitea.mjs dispatch vt/recheck ci.yml security.yml
|
||||
|
||||
- name: Open one tracking issue per entry with detections
|
||||
if: github.ref == 'refs/heads/main' && steps.scan.outputs.review != ''
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
run: node scripts/gitea.mjs vt-issues "$RUNNER_TEMP/vt-review.json"
|
||||
@@ -1,7 +0,0 @@
|
||||
# docs/12 §8 — T6: a malicious PR must not be able to alter what runs.
|
||||
* @poli0981
|
||||
|
||||
# Highest-risk paths, called out explicitly so a review is always required.
|
||||
/.github/** @poli0981
|
||||
/scripts/** @poli0981
|
||||
/src/data/** @poli0981
|
||||
@@ -0,0 +1,51 @@
|
||||
name: Accessibility barrier
|
||||
description: Something on the site is hard or impossible to use with your setup
|
||||
labels: [accessibility]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you — accessibility reports are treated as expertise, not complaints. You never
|
||||
need to tell us about a disability, and every field except the first two is optional.
|
||||
Prefer email? Write to accessibility@poli0981.dev (no account needed). English
|
||||
or Vietnamese is fine. What happens next: [ACCESSIBILITY.md](https://git.poli0981.dev/poli0981/softharbor/src/branch/main/ACCESSIBILITY.md#how-we-respond).
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: What were you trying to do, and what got in the way?
|
||||
description: For example "I could not reach the Filters button with Tab" or "NVDA reads the search box as 'edit' with no name".
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: page-url
|
||||
attributes:
|
||||
label: Page address
|
||||
placeholder: https://softharbor.net/apps
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
description: Optional. The keys you pressed or the commands you used, if you remember them.
|
||||
- type: input
|
||||
id: environment
|
||||
attributes:
|
||||
label: Device, operating system, browser and assistive technology
|
||||
description: Optional, with versions if you know them.
|
||||
placeholder: Windows 11, Firefox, NVDA
|
||||
- type: dropdown
|
||||
id: severity
|
||||
attributes:
|
||||
label: How much does it get in your way?
|
||||
description: Optional — we confirm severity during triage.
|
||||
options:
|
||||
- Critical — I cannot find an app, read a listing, or open its links
|
||||
- Serious — it is hard, but there is a way around it
|
||||
- Moderate — an annoyance or something inconsistent
|
||||
- Minor — barely affects me
|
||||
- type: textarea
|
||||
id: media
|
||||
attributes:
|
||||
label: Screenshot or recording
|
||||
description: Optional — drag a file here if you are comfortable sharing one.
|
||||
@@ -1,10 +1,12 @@
|
||||
name: Bug report
|
||||
description: Something on the site is broken
|
||||
description: Something on the site is broken or hard to use
|
||||
labels: [bug]
|
||||
body:
|
||||
# Field `id`s are load-bearing: they are the prefill query params used by
|
||||
# src/lib/issueUrl.ts (docs/05 §A6, docs/12 §7). Renaming one is a breaking
|
||||
# change to every already-shipped client.
|
||||
# The public reports bugs on the GitLab mirror (.gitlab/issue_templates/Bug.md,
|
||||
# which the site's "Report a bug" link prefills — src/lib/issueUrl.ts,
|
||||
# docs/05 §A6); Gitea, where only the maintainer can open issues, reads this
|
||||
# form. Keep the two in step (D38). The field `id`s were GitHub's prefill
|
||||
# params until then.
|
||||
- type: input
|
||||
id: page-url
|
||||
attributes:
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
# Gitea reads these forms (only the maintainer can open issues there:
|
||||
# registration is closed). The public files issues on the GitLab mirror, from
|
||||
# .gitlab/issue_templates/ — keep the two sets in step. The Discussions and
|
||||
# private-advisory links went with the GitHub account (D38).
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Questions & discussion
|
||||
url: https://github.com/poli0981/softharbor/discussions
|
||||
about: General questions, suggestions and anything that is not a bug or an app request.
|
||||
- name: Question or idea
|
||||
url: mailto:code@poli0981.dev
|
||||
about: Questions, and anything that is not a bug, an app request or a listing change. New features are not taken (maintenance mode).
|
||||
- name: Accessibility statement
|
||||
url: https://softharbor.net/legal/accessibility
|
||||
about: What the site aims for, what is known, and how accessibility reports are handled (also by email — no account needed).
|
||||
- name: Report a security issue
|
||||
url: https://github.com/poli0981/softharbor/security/advisories/new
|
||||
about: Private vulnerability reporting — please do NOT open a public issue.
|
||||
url: https://git.poli0981.dev/poli0981/softharbor/src/branch/main/SECURITY.md
|
||||
about: By e-mail to security@poli0981.dev — please do NOT open a public issue.
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Listing change
|
||||
description: Remove or correct a listed app, or ask for its security check to be re-run
|
||||
labels: [listing-change]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
A suspected **malicious or hijacked download** is a security report, not an issue —
|
||||
please report it privately ([SECURITY.md](https://git.poli0981.dev/poli0981/softharbor/src/branch/main/SECURITY.md)).
|
||||
Is it **your own app**? You can also write to takedown@poli0981.dev.
|
||||
- type: input
|
||||
id: app
|
||||
attributes:
|
||||
label: Which app?
|
||||
description: Its page on the site, or its name.
|
||||
placeholder: https://softharbor.net/apps/7-zip
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: change
|
||||
attributes:
|
||||
label: What should change?
|
||||
options:
|
||||
- Remove — it is now subscription-only, or no longer free / buy-once
|
||||
- Remove — abandoned, discontinued or unsafe to recommend
|
||||
- Correct a link — homepage, repository or download page moved
|
||||
- Correct a detail — pricing, licence, platforms, developer or summary
|
||||
- Re-check its security status (VirusTotal)
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: evidence
|
||||
attributes:
|
||||
label: Evidence
|
||||
description: Links to the developer's own pages, an announcement, a changelog or a scan — the decision follows the evidence.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: details
|
||||
attributes:
|
||||
label: Anything else
|
||||
description: Optional.
|
||||
@@ -0,0 +1,41 @@
|
||||
<!-- Title: Conventional Commits, lowercase, imperative — it becomes the squash
|
||||
commit and the changelog line (CONTRIBUTING.md). One logical change per PR;
|
||||
for data, one app per PR unless a decision-log entry says otherwise.
|
||||
Maintenance mode (D36): fixes, data and upkeep only — feature PRs are closed. -->
|
||||
|
||||
## What and why
|
||||
|
||||
<!-- One or two sentences. Link the issue: "Closes #123". -->
|
||||
|
||||
## Checks
|
||||
|
||||
- [ ] A fix, a data change or upkeep — not a new feature
|
||||
([maintenance mode](../CONTRIBUTING.md#maintenance-mode))
|
||||
- [ ] `pnpm lint && pnpm check && pnpm coverage && pnpm build && pnpm knip && pnpm e2e` pass locally
|
||||
- [ ] Docs that describe the changed behaviour are updated (`docs/`, README, CHANGELOG for
|
||||
visitor-facing changes)
|
||||
- [ ] Every new UI string exists in both `src/i18n/en.json` and `src/i18n/vi.json`
|
||||
|
||||
## Accessibility ([ACCESSIBILITY.md](../ACCESSIBILITY.md))
|
||||
|
||||
Tick what applies, or write "no UI change".
|
||||
|
||||
- [ ] Keyboard only: every control reachable in a sensible order, focus always visible,
|
||||
no traps, Esc closes what it opened
|
||||
- [ ] Names and states: each control's accessible name matches its visible label;
|
||||
expanded / selected / checked states are announced
|
||||
- [ ] Screen-reader spot check (Narrator, NVDA or VoiceOver) for new or changed components
|
||||
- [ ] Nothing by colour alone; contrast holds in light and dark; forced colours still
|
||||
show the state
|
||||
- [ ] 200 % zoom and 320 px width: nothing cut off, no sideways scroll outside tables
|
||||
- [ ] Motion respects reduced-motion (system and the display menu)
|
||||
|
||||
## Data PRs only
|
||||
|
||||
- [ ] Checked against the inclusion criteria (docs/00 §3) and the vetting checklist
|
||||
(docs/09 §6)
|
||||
- [ ] Summaries written from scratch in English **and** Vietnamese
|
||||
- [ ] New entries start `unverified` with `evidence: null`; only the maintainer moves one
|
||||
to `clean`
|
||||
- [ ] Links are the developer's own domain or official repository — no portals, no
|
||||
tracking parameters
|
||||
@@ -1,136 +0,0 @@
|
||||
# docs/12 §2 — self-contained, deliberately.
|
||||
#
|
||||
# This called `poli0981/.github` → `reusable-web-react.yml` and every run ended
|
||||
# in `startup_failure`. Two reasons, both worth recording:
|
||||
#
|
||||
# 1. That workflow's Pages-deploy job declares `pages: write` and
|
||||
# `id-token: write`. A called workflow may not request permissions the
|
||||
# caller lacks, so GitHub rejects the ENTIRE run before anything executes —
|
||||
# even though the job is skipped by `deploy-pages: false`. Granting them
|
||||
# would mean handing a Workers-deployed site the ability to mint OIDC
|
||||
# tokens it never uses.
|
||||
#
|
||||
# 2. It runs lint / typecheck / test only *if a matching package script
|
||||
# exists*. Rename a script and CI quietly stops checking while still going
|
||||
# green. This project's gates ARE the product — and this repo has already
|
||||
# shipped four separate silent no-ops (a dead set:html lint rule, workbox
|
||||
# globs matching nothing, an unregistered service worker, CSP-dropped
|
||||
# inline styles). A silently-skipping CI is the wrong tool here.
|
||||
#
|
||||
# The duplicated "logic" is six pnpm invocations. That is a fair price for a
|
||||
# gate that fails loudly.
|
||||
name: ci
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
# Explicit — a workflow without its own block defaults every scope to `none`.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: pnpm/action-setup@v6
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Lint & format
|
||||
run: pnpm lint
|
||||
- name: Types
|
||||
run: pnpm check
|
||||
- name: Unit tests
|
||||
run: pnpm test
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
# Must run AFTER build — it inspects dist/. CSP style-src drops inline
|
||||
# style attributes silently, so this is the only thing that catches them.
|
||||
- name: No inline style attributes
|
||||
run: pnpm check:styles
|
||||
# Also post-build, and for the same reason: every service-worker failure
|
||||
# this project has had was silent (docs/08 Part D).
|
||||
- name: Service worker shape
|
||||
run: pnpm check:sw
|
||||
- name: Dead code
|
||||
run: pnpm knip
|
||||
|
||||
gates:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0 # extract-urls --changed diffs against origin/main
|
||||
- uses: pnpm/action-setup@v6
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Data rules (L2)
|
||||
run: pnpm validate:data
|
||||
- name: EN/VI key parity (hard rule 6)
|
||||
run: pnpm i18n:check
|
||||
|
||||
# The action lives in a SUBDIRECTORY of the repo and there is no rolling
|
||||
# `v2` tag — only full versions. `…/osv-scanner-action@v2` does not
|
||||
# resolve. Renovate keeps this pinned version current.
|
||||
- name: Vulnerability scan
|
||||
uses: google/osv-scanner-action/osv-scanner-action@v2.3.8
|
||||
with:
|
||||
scan-args: |-
|
||||
--lockfile=pnpm-lock.yaml
|
||||
- name: Audit production deps
|
||||
run: pnpm audit --prod
|
||||
|
||||
# PR-time link check over changed data files only; link-check.yml owns
|
||||
# the weekly full sweep (docs/12 §5).
|
||||
- name: Collect changed official links
|
||||
id: urls
|
||||
if: github.event_name == 'pull_request'
|
||||
run: |
|
||||
node scripts/extract-urls.mjs --changed > /tmp/urls.txt
|
||||
count=$(grep -c . /tmp/urls.txt || true)
|
||||
echo "count=$count" >> "$GITHUB_OUTPUT"
|
||||
echo "$count changed URL(s) to check"
|
||||
# Accepting 403/429 is about bot mitigation, not about being lenient.
|
||||
# Seeding the catalogue put ~1 150 vendor URLs through here and 14 came
|
||||
# back 403 from sites that are plainly alive (winehq.org, dolphin-emu.org,
|
||||
# rpcs3.net, gitlab.com, MSI, Nexus Mods, Epic, Enpass). A checker that
|
||||
# cries wolf on a seventh of the catalogue teaches everyone to ignore it,
|
||||
# which costs more than the 403 it would one day be right about.
|
||||
# 404/500/connection failures — the codes that actually mean "gone" —
|
||||
# still fail the build.
|
||||
#
|
||||
# Do NOT add `--user-agent`. Spoofing a browser was tried and made things
|
||||
# worse, not better: it cleared the 403s but gitlab.gnome.org started
|
||||
# answering 406 and whatsapp.com 400, both of which pass fine on lychee's
|
||||
# default agent. There is no single UA every vendor is happy with, so the
|
||||
# status-code accepts carry this on their own.
|
||||
#
|
||||
# Skipped when the PR changes no app data — lychee treats an empty input
|
||||
# as a configuration error and fails. A code-only PR legitimately has
|
||||
# zero URLs to check, and this gate had failed every one of them since it
|
||||
# was written; nothing noticed because every PR until now touched data.
|
||||
# Skipping rather than `failIfEmpty: false` keeps the zero visible: a
|
||||
# skipped step is obvious in the checks list, whereas a green "0 links"
|
||||
# is exactly the kind of quiet pass this repo keeps getting caught by.
|
||||
- name: Link check
|
||||
if: github.event_name == 'pull_request' && steps.urls.outputs.count != '0'
|
||||
uses: lycheeverse/lychee-action@v2
|
||||
with:
|
||||
args: >-
|
||||
--max-concurrency 4 --retry-wait-time 2 --max-retries 3 --timeout 45
|
||||
--accept '200..=299,403,429'
|
||||
/tmp/urls.txt
|
||||
@@ -1,28 +0,0 @@
|
||||
# docs/12 §2. reusable-codeql.yml DOES exist in the ops repo (verified).
|
||||
name: codeql
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
schedule:
|
||||
- cron: '31 3 * * 1'
|
||||
|
||||
# Required matrix — security-events: write is what lets results upload.
|
||||
# Must be a SUPERSET of what the reusable workflow's jobs declare — a called
|
||||
# workflow cannot request a permission the caller lacks, and the run is
|
||||
# rejected at startup if it tries. `packages: read` is the easy one to miss:
|
||||
# it is there so CodeQL can fetch internal query packs.
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
packages: read
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
codeql:
|
||||
uses: poli0981/.github/.github/workflows/reusable-codeql.yml@main
|
||||
with:
|
||||
# A JSON ARRAY STRING, not a bare value — the reusable workflow feeds it
|
||||
# to fromJSON() for its matrix. `javascript-typescript` on its own throws
|
||||
# and the run dies with startup_failure before any step executes.
|
||||
languages: '["javascript-typescript"]'
|
||||
@@ -1,40 +0,0 @@
|
||||
# docs/12 §5 — weekly full sweep of every official link in the dataset.
|
||||
# PR-time checking covers only changed files, inside ci.yml's `gates` job.
|
||||
name: link-check
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '43 4 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
lychee:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- run: node scripts/extract-urls.mjs > /tmp/urls.txt
|
||||
|
||||
- id: lychee
|
||||
uses: lycheeverse/lychee-action@v2
|
||||
with:
|
||||
# Kept in step with ci.yml's PR sweep — see the note there for why
|
||||
# 403/429 are accepted. The weekly run covers the whole catalogue
|
||||
# (~1 150 URLs), so a false-positive rate that looks tolerable per-PR
|
||||
# turns into an unreadable issue every Monday.
|
||||
args: >-
|
||||
--max-concurrency 4 --retry-wait-time 2 --max-retries 3 --timeout 45
|
||||
--accept '200..=299,403,429'
|
||||
/tmp/urls.txt
|
||||
# Link rot is triage, not a build break — it opens an issue instead.
|
||||
fail: false
|
||||
|
||||
- if: steps.lychee.outputs.exit_code != 0
|
||||
uses: peter-evans/create-issue-from-file@v5
|
||||
with:
|
||||
title: 'link-check: broken official links'
|
||||
content-filepath: ./lychee/out.md
|
||||
labels: link-rot
|
||||
@@ -1,24 +0,0 @@
|
||||
# docs/12 §2 — tagged release → Discord.
|
||||
#
|
||||
# Scope note: announce-release.yml reaches DISCORD ONLY. The multi-platform
|
||||
# notify.py cross-poster consumes /rss.xml on its own cron in its own repo
|
||||
# (docs/03 §7, docs/13 §5), so per-app announcements need no workflow here —
|
||||
# only a valid, deterministic feed.
|
||||
name: notify
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
announce:
|
||||
uses: poli0981/.github/.github/workflows/announce-release.yml@main
|
||||
secrets: inherit
|
||||
@@ -1,72 +0,0 @@
|
||||
# docs/12 §4 — enforces hard rule 5 mechanically.
|
||||
#
|
||||
# Runs on data pushes AND nightly. The nightly cron is the point: it guarantees
|
||||
# a flagged entry never survives more than 24 h even if a reviewer missed it.
|
||||
# It opens a PR rather than pushing to main, so a human stays in the loop.
|
||||
name: quarantine
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths: ['src/data/apps/**']
|
||||
schedule:
|
||||
- cron: '17 2 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
sweep:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- id: sweep
|
||||
run: node scripts/quarantine.mjs
|
||||
|
||||
# NOTE: requires Settings → Actions → General → "Allow GitHub Actions to
|
||||
# create and approve pull requests" (action item H10). Without it this
|
||||
# step fails even with the permissions block above.
|
||||
- if: steps.sweep.outputs.moved != ''
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
branch: quarantine/auto
|
||||
title: 'data: quarantine flagged entries'
|
||||
commit-message: 'data: quarantine ${{ steps.sweep.outputs.moved }}'
|
||||
labels: security, quarantine
|
||||
body: |
|
||||
Automated sweep: entries with `security.status: "flagged"` were
|
||||
moved to `data/quarantine/`, which is outside the content glob, so
|
||||
they stop rendering on the next build (docs/03 §5).
|
||||
|
||||
Nothing was deleted. Restoring is a `git mv` plus a status edit;
|
||||
the reason and evidence live in the linked tracking issue.
|
||||
|
||||
- if: steps.sweep.outputs.moved != ''
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
for (const slug of `${{ steps.sweep.outputs.moved }}`.trim().split(/\s+/)) {
|
||||
if (!slug) continue;
|
||||
await github.rest.issues.create({ ...context.repo,
|
||||
title: `[quarantine] ${slug}`,
|
||||
labels: ['security', 'quarantine'],
|
||||
body: [
|
||||
`\`${slug}\` was flagged and moved to \`data/quarantine/\`.`,
|
||||
'',
|
||||
'Record here before closing:',
|
||||
'- [ ] Reason it was flagged',
|
||||
'- [ ] Evidence link (VirusTotal / vendor advisory)',
|
||||
'- [ ] Date checked',
|
||||
'- [ ] Whether users were plausibly exposed (docs/13 §7)',
|
||||
'',
|
||||
'Restoring is a reviewed PR: status back to `clean`/`unverified`,',
|
||||
'a fresh `checkedAt`, and the file moved back (docs/03 §5).',
|
||||
].join('\n') });
|
||||
}
|
||||
@@ -14,6 +14,9 @@ worker-configuration.d.ts
|
||||
|
||||
# Test & tooling output
|
||||
coverage/
|
||||
playwright-report/
|
||||
test-results/
|
||||
blob-report/
|
||||
.vitest/
|
||||
lychee/
|
||||
*.tsbuildinfo
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<!-- GitLab version of .github/ISSUE_TEMPLATE/accessibility.yml. Thank you — accessibility reports
|
||||
are treated as expertise, not complaints. You never need to tell us about a disability, and
|
||||
everything but the first two sections is optional. Prefer e-mail? Write to
|
||||
accessibility@poli0981.dev (no account needed). English or Vietnamese is fine. What happens next:
|
||||
https://git.poli0981.dev/poli0981/softharbor/src/branch/main/ACCESSIBILITY.md#how-we-respond -->
|
||||
|
||||
### What were you trying to do, and what got in the way?
|
||||
|
||||
<!-- e.g. "I could not reach the Filters button with Tab", or "NVDA reads the search box as
|
||||
'edit' with no name". -->
|
||||
|
||||
### Page address
|
||||
|
||||
<!-- https://softharbor.net/apps -->
|
||||
|
||||
### Steps to reproduce (optional)
|
||||
|
||||
### Device, operating system, browser and assistive technology (optional)
|
||||
|
||||
<!-- e.g. Windows 11, Firefox, NVDA -->
|
||||
|
||||
### How much does it get in your way? (optional)
|
||||
|
||||
- [ ] Critical — I cannot find an app, read a listing, or open its links
|
||||
- [ ] Serious — it is hard, but there is a way around it
|
||||
- [ ] Moderate — an annoyance or something inconsistent
|
||||
- [ ] Minor — barely affects me
|
||||
|
||||
### Screenshot or recording (optional)
|
||||
|
||||
/label ~accessibility
|
||||
@@ -0,0 +1,29 @@
|
||||
<!-- GitLab version of .github/ISSUE_TEMPLATE/app_request.yml. Suggest one app per issue. An
|
||||
accepted suggestion is credited in the README's Acknowledgements — say here if you would rather
|
||||
not be named. Inclusion criteria: https://git.poli0981.dev/poli0981/softharbor/src/branch/main/docs/00_PROJECT_OVERVIEW.md -->
|
||||
|
||||
### App name
|
||||
|
||||
### Official homepage (https)
|
||||
|
||||
<!-- The developer's own domain or official repository — not a download portal. -->
|
||||
|
||||
### Pricing
|
||||
|
||||
- [ ] Free
|
||||
- [ ] Free + optional one-time purchase
|
||||
- [ ] One-time purchase
|
||||
|
||||
### Platforms
|
||||
|
||||
- [ ] Windows
|
||||
- [ ] macOS
|
||||
- [ ] Linux
|
||||
|
||||
### Inclusion criteria (docs/00 §3)
|
||||
|
||||
- [ ] Not subscription-only — the free tier is self-sufficient, or it is a one-time purchase
|
||||
- [ ] The links above are the developer's official pages
|
||||
- [ ] Actively maintained, or stable-and-finished
|
||||
|
||||
/label ~app-request
|
||||
@@ -0,0 +1,23 @@
|
||||
<!-- GitLab version of .github/ISSUE_TEMPLATE/bug_report.yml (Gitea reads that one); keep both in
|
||||
step. The site's "Report a bug" link fills in this layout for you (src/lib/issueUrl.ts).
|
||||
Bugs are about this site — problems with a listed app go to its own developer. -->
|
||||
|
||||
### Page URL
|
||||
|
||||
<!-- https://softharbor.net/… -->
|
||||
|
||||
### What happened / expected
|
||||
|
||||
<!-- What did you do, what did you expect, and what happened instead? -->
|
||||
|
||||
### Browser & OS
|
||||
|
||||
<!-- e.g. Windows 11, Firefox 145 -->
|
||||
|
||||
### Console output
|
||||
|
||||
```shell
|
||||
(filled in by the site's "Report a bug" link; feel free to trim)
|
||||
```
|
||||
|
||||
/label ~bug
|
||||
@@ -0,0 +1,25 @@
|
||||
<!-- GitLab version of .github/ISSUE_TEMPLATE/listing_change.yml.
|
||||
A suspected MALICIOUS or HIJACKED download is a security report, not an issue: e-mail
|
||||
security@poli0981.dev (https://git.poli0981.dev/poli0981/softharbor/src/branch/main/SECURITY.md). Your own app? You can also write to
|
||||
takedown@poli0981.dev. -->
|
||||
|
||||
### Which app?
|
||||
|
||||
<!-- Its page on the site, or its name, e.g. https://softharbor.net/apps/7-zip -->
|
||||
|
||||
### What should change?
|
||||
|
||||
- [ ] Remove — it is now subscription-only, or no longer free / buy-once
|
||||
- [ ] Remove — abandoned, discontinued or unsafe to recommend
|
||||
- [ ] Correct a link — homepage, repository or download page moved
|
||||
- [ ] Correct a detail — pricing, licence, platforms, developer or summary
|
||||
- [ ] Re-check its security status (VirusTotal)
|
||||
|
||||
### Evidence
|
||||
|
||||
<!-- Links to the developer's own pages, an announcement, a changelog or a scan — the decision
|
||||
follows the evidence. -->
|
||||
|
||||
### Anything else
|
||||
|
||||
/label ~listing-change
|
||||
@@ -0,0 +1,43 @@
|
||||
<!-- GitLab version of .github/PULL_REQUEST_TEMPLATE.md. GitLab CI does not run on this mirror:
|
||||
the maintainer applies an accepted merge request on Gitea (https://git.poli0981.dev/poli0981/softharbor)
|
||||
and runs CI there; the mirror then shows it merged (or closed, with a link to the commit).
|
||||
Title: Conventional Commits, lowercase, imperative. One logical change per MR; for data, one
|
||||
app per MR unless a decision-log entry says otherwise. Maintenance mode (D36): fixes, data and
|
||||
upkeep only — feature MRs are closed. -->
|
||||
|
||||
## What and why
|
||||
|
||||
<!-- One or two sentences. Link the issue: "Closes #123". -->
|
||||
|
||||
## Checks
|
||||
|
||||
- [ ] A fix, a data change or upkeep — not a new feature
|
||||
([maintenance mode](https://git.poli0981.dev/poli0981/softharbor/src/branch/main/CONTRIBUTING.md#maintenance-mode))
|
||||
- [ ] `pnpm lint && pnpm check && pnpm coverage && pnpm build && pnpm knip && pnpm e2e` pass locally
|
||||
- [ ] Docs that describe the changed behaviour are updated (`docs/`, README, CHANGELOG for
|
||||
visitor-facing changes)
|
||||
- [ ] Every new UI string exists in both `src/i18n/en.json` and `src/i18n/vi.json`
|
||||
|
||||
## Accessibility ([ACCESSIBILITY.md](https://git.poli0981.dev/poli0981/softharbor/src/branch/main/ACCESSIBILITY.md))
|
||||
|
||||
Tick what applies, or write "no UI change".
|
||||
|
||||
- [ ] Keyboard only: every control reachable in a sensible order, focus always visible,
|
||||
no traps, Esc closes what it opened
|
||||
- [ ] Names and states: each control's accessible name matches its visible label;
|
||||
expanded / selected / checked states are announced
|
||||
- [ ] Screen-reader spot check (Narrator, NVDA or VoiceOver) for new or changed components
|
||||
- [ ] Nothing by colour alone; contrast holds in light and dark; forced colours still
|
||||
show the state
|
||||
- [ ] 200 % zoom and 320 px width: nothing cut off, no sideways scroll outside tables
|
||||
- [ ] Motion respects reduced-motion (system and the display menu)
|
||||
|
||||
## Data MRs only
|
||||
|
||||
- [ ] Checked against the inclusion criteria (docs/00 §3) and the vetting checklist
|
||||
(docs/09 §6)
|
||||
- [ ] Summaries written from scratch in English **and** Vietnamese
|
||||
- [ ] New entries start `unverified` with `evidence: null`; only the maintainer moves one
|
||||
to `clean`
|
||||
- [ ] Links are the developer's own domain or official repository — no portals, no
|
||||
tracking parameters
|
||||
@@ -0,0 +1,13 @@
|
||||
# gitleaks, run by the ops repo's security.yml, scans every commit with its
|
||||
# default rules (docs/12 §2). Each line below is one finding that is NOT a
|
||||
# secret, as commit:file:rule:line, with the reason above it. A real secret
|
||||
# never goes here: it is rotated, and the history is dealt with. Describe a
|
||||
# finding in words here — quoting it would be a finding of its own.
|
||||
|
||||
# The SonarQube Cloud project key on line 5 of sonar-project.properties — a
|
||||
# public identifier shown in every Sonar URL, not a credential. The file left
|
||||
# with SonarQube Cloud (D38); the history keeps it.
|
||||
4351fffaaee75328b53a8cc1a97f5dbeb04bfd7a:sonar-project.properties:generic-api-key:5
|
||||
|
||||
# The first version of this file quoted that same key in its comment.
|
||||
f404c6eaab82862e7e4d5ace4b744d4875a42118:.gitleaksignore:generic-api-key:6
|
||||
@@ -1,9 +1,10 @@
|
||||
# Deliberately NO `ignore-scripts=true` — see docs/09 §7.
|
||||
#
|
||||
# pnpm >= 10 already blocks dependency lifecycle scripts by default and
|
||||
# requires an explicit `pnpm.onlyBuiltDependencies` allowlist in package.json.
|
||||
# That is a strictly better version of what ignore-scripts bought us: the
|
||||
# allowlist is reviewable, per-package, and committed. Setting ignore-scripts
|
||||
# on top of it is worse than redundant — it also suppresses the allowlist, so
|
||||
# esbuild never links its native binary and `pnpm build` cannot run at all
|
||||
# (found in spike S1, 2026-07-27).
|
||||
# pnpm >= 10 already blocks dependency lifecycle scripts by default, and pnpm 11
|
||||
# takes the explicit allowlist from `allowBuilds` in pnpm-workspace.yaml (the
|
||||
# old `pnpm.onlyBuiltDependencies` field in package.json is ignored there).
|
||||
# That allowlist is a strictly better version of what ignore-scripts bought us:
|
||||
# reviewable, per-package, and committed. Setting ignore-scripts on top of it
|
||||
# is worse than redundant — it also suppresses the allowlist, so esbuild never
|
||||
# links its native binary and `pnpm build` cannot run at all (found in spike
|
||||
# S1, 2026-07-27).
|
||||
@@ -0,0 +1,150 @@
|
||||
# Accessibility
|
||||
|
||||
SoftHarbor exists so that anyone setting up a computer can find official software
|
||||
quickly. That has to include people who use only a keyboard, a screen reader,
|
||||
magnification, voice control or a high-contrast theme — and people with those needs
|
||||
who want to contribute.
|
||||
|
||||
This file is the project's accessibility statement for contributors: what we aim
|
||||
for, what the site already does, how changes are kept accessible, and how to report
|
||||
a barrier. The visitor-facing version, in English and Vietnamese, is
|
||||
**[softharbor.net/legal/accessibility](https://softharbor.net/legal/accessibility)**.
|
||||
Keep the two in step (docs/14 §3g).
|
||||
|
||||
## Priorities
|
||||
|
||||
- **Target: [WCAG 2.2](https://www.w3.org/TR/WCAG22/) level AA.** It guides the work;
|
||||
it is **not** a claim of verified conformance. No independent audit has been done,
|
||||
and we will not claim conformance without one that names its scope, date, method
|
||||
and evaluator.
|
||||
- **Keyboard first.** Everything is reachable and operable with the keyboard, in a
|
||||
logical order, with a visible focus indicator and no traps.
|
||||
- **Screen readers.** Semantic HTML, a heading per page and a logical outline,
|
||||
landmarks, real lists and tables, and `lang` on every page and every passage in the
|
||||
other language, so English and Vietnamese are pronounced correctly.
|
||||
- **Readable everywhere.** Contrast that holds in both themes, nothing conveyed by
|
||||
colour alone, text that zooms to 200 % and reflows to 320 CSS px.
|
||||
- **Respect the visitor's settings.** Reduced motion and forced colours (Windows
|
||||
contrast themes) from the system, plus the site's own display menu.
|
||||
|
||||
## What the site does today
|
||||
|
||||
| Area | How | Where |
|
||||
| ---------------- | -------------------------------------------------------------------------------------------- | ----------------------------------------- |
|
||||
| Skip link | "Skip to content" is the first stop on every page | `src/layouts/Base.astro` |
|
||||
| Landmarks | `header`, labelled `nav`s, `main`, `footer`, breadcrumb `nav`/`ol` | `ShHeader`, `ShFooter`, `AppDetailPage` |
|
||||
| Language | `<html lang>`, hreflang alternates, `lang` on every passage in the other language | `Base.astro`, `ShLangSwitch` |
|
||||
| Focus | Global `:focus-visible` ring, whole-card ring on app cards, visible on selected segments too | `src/styles/global.css`, `ShPrefs` |
|
||||
| Dialogs | Native `<dialog>` (`showModal`) and `popover`: focus handling and Esc from the browser | `ShLegalGate`, `ShFilterSheet`, `ShPrefs` |
|
||||
| Status messages | Result count in an `aria-live` region; search errors in a persistent `role="status"` | `AppsPage.astro`, `ShSearch` |
|
||||
| Contrast | Tokens tested: ink ≥ 7:1, text ≥ 4.5:1, control edges ≥ 3:1, light and dark | `src/styles/contrast.test.ts` |
|
||||
| Not colour alone | Security status has its own icon shape; current section underlined | `ShAppCard`, `ShHeader` |
|
||||
| Display menu | Theme, scrollbar, reduced motion, and **"/" shortcut on/off** (WCAG 2.1.4) | `ShPrefs`, `src/scripts/theme.js` |
|
||||
| Forced colours | Current section, selected segments and focus stay visible | `ShHeader`, `ShPrefs`, `ShLangSwitch` |
|
||||
| Images | No images of text; logos are decorative and the name is always text | `ShAppCard`, `ShIcon` |
|
||||
| Targets | Buttons 44 px, header controls 38–40 px, inline category links 24 px | `global.css`, `ShAppCard` |
|
||||
| Tables | `caption`, `scope="col"`, keyboard-scrollable region on narrow screens | `src/components/legal/` |
|
||||
| New tabs | The one link that opens a new tab says so to screen readers | `ShBugReport` |
|
||||
|
||||
## Contributor expectations
|
||||
|
||||
Every user-facing change keeps these guardrails. The
|
||||
[pull request template](.github/PULL_REQUEST_TEMPLATE.md) carries the checklist.
|
||||
|
||||
**Automated — CI blocks the merge.**
|
||||
|
||||
- `pnpm e2e` runs axe (`@axe-core/playwright`, WCAG 2.0/2.1/2.2 A and AA rules) on the
|
||||
main pages in both themes, on Desktop Chrome and a Pixel 7 viewport, plus the open
|
||||
legal gate, filter sheet and display menu (`e2e/smoke.spec.ts`, `e2e/a11y.spec.ts`).
|
||||
Critical, serious and moderate findings fail.
|
||||
- The same suite checks the skip link, focus return from dialogs, the shortcut switch,
|
||||
reflow at 320 px and forced colours; `pnpm test` pins contrast and the islands'
|
||||
names, roles and states.
|
||||
- If a violation genuinely cannot be fixed, say why in the PR description — never
|
||||
disable a rule silently.
|
||||
|
||||
**By hand, for anything interactive.**
|
||||
|
||||
- One keyboard-only pass: Tab / Shift+Tab reaches every control in a sensible order,
|
||||
focus is always visible, Enter / Space / arrows / Esc do what they should, and you
|
||||
can get into and out of every dialog and menu.
|
||||
- A screen-reader spot check (Narrator, NVDA or VoiceOver): headings and landmarks
|
||||
navigate, every control has a name that matches its visible label, state changes
|
||||
(expanded, selected, checked) are announced, dynamic updates are read out.
|
||||
- Zoom to 200 % and narrow to 320 px: nothing is cut off and nothing scrolls sideways
|
||||
except data tables.
|
||||
|
||||
**Content.** Logical heading levels, real lists, descriptive link text (never "click
|
||||
here"), no colour-only meaning, alternative text where an image carries meaning, and
|
||||
both languages for every UI string (hard rule 6).
|
||||
|
||||
## Reporting an accessibility barrier
|
||||
|
||||
We treat accessibility reports as expertise, not complaints. You never need to tell us
|
||||
about a disability.
|
||||
|
||||
- **Email:** accessibility@poli0981.dev — no account needed.
|
||||
- **GitLab:** an issue on the project's mirror, with the
|
||||
[Accessibility template](https://gitlab.com/poli0981/softharbor/-/issues/new?issuable_template=Accessibility)
|
||||
(needs a GitLab account).
|
||||
|
||||
If you can, include the page address, what you were trying to do, what happened
|
||||
instead, and your operating system, browser and assistive technology with versions. A
|
||||
screenshot or recording is welcome and never required. English or Vietnamese.
|
||||
|
||||
### Severity
|
||||
|
||||
Maintainers assign or confirm it during triage; reporters do not have to.
|
||||
|
||||
- **Critical** — stops a core task: finding an app, reading its listing, or opening its
|
||||
official links.
|
||||
- **Serious** — significant difficulty, but a workaround exists.
|
||||
- **Moderate** — an annoyance or an inconsistent experience.
|
||||
- **Minor** — little effect on use.
|
||||
|
||||
### How we respond
|
||||
|
||||
SoftHarbor is maintained by one person; these are commitments that can be kept.
|
||||
|
||||
- A reply within **7 days**, with the severity and the next step.
|
||||
- Targets from the day the report arrives: **Critical 30 days**, **Serious 60 days**,
|
||||
**Moderate and Minor 90 days**.
|
||||
- A workaround while a fix is in progress, where one exists.
|
||||
- If a target slips: the reason, a revised date, and an update on the issue.
|
||||
- We may ask you to confirm the fix before closing.
|
||||
|
||||
## Ownership
|
||||
|
||||
Accessibility is owned by the maintainer, [poli0981](https://git.poli0981.dev/poli0981):
|
||||
triaging reports, tracking known barriers, keeping this file and the site statement
|
||||
current, and re-reading both at each release.
|
||||
|
||||
## Supported environments
|
||||
|
||||
**Tested by hand** (owner, 2026-11-09): keyboard only, and the Narrator screen reader, on
|
||||
Windows 11 with Chrome, Brave and Firefox — no barriers found.
|
||||
|
||||
**Tested automatically** on every change: Chromium (Playwright Desktop Chrome and a
|
||||
Pixel 7 viewport), light and dark themes, forced colours, 320 px reflow.
|
||||
|
||||
**Intended, not yet tested by hand:** the current and previous major versions of
|
||||
Chrome, Edge, Firefox and Safari; NVDA and JAWS on Windows; VoiceOver on macOS and iOS;
|
||||
TalkBack on Android. Reports from these are especially welcome.
|
||||
|
||||
## Known limitations
|
||||
|
||||
- **Bot check.** After the legal notice is accepted, Cloudflare Turnstile runs. It is a
|
||||
third-party widget whose accessibility we do not control; if it cannot finish, the
|
||||
gate lets the visitor in anyway (after 10 s, or 120 s once it asks for a click —
|
||||
docs/14 Part 2).
|
||||
- **Vendor sites.** Every listing links to the developer's own site and installer;
|
||||
their accessibility is outside this project.
|
||||
- **Card summaries** are clamped to two lines; the full text is on the app's page.
|
||||
- **Vietnamese legal pages** are translations; the English text is canonical.
|
||||
- **No formal pass yet** with NVDA, JAWS or VoiceOver, and Lighthouse CI is not wired
|
||||
(docs/13 §2, docs/15 §2 item 8).
|
||||
|
||||
## Feedback
|
||||
|
||||
Accessibility is ongoing work. Suggestions for this statement or for how the project
|
||||
works are welcome as an issue, a discussion or a pull request.
|
||||
@@ -0,0 +1,300 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to SoftHarbor. The site is continuously deployed; a
|
||||
version marks a release announced in the repository (docs/13). Dates are
|
||||
UTC.
|
||||
|
||||
## [1.5.0] — 2026-11-24
|
||||
|
||||
SoftHarbor's repository has moved from GitHub to the maintainer's own Gitea.
|
||||
The site now points there, bug reports go to the public GitLab mirror, and
|
||||
the legal notice asks you once more because the Privacy Policy changed.
|
||||
|
||||
### Privacy — what changed
|
||||
|
||||
- **"Report a bug" opens an issue on GitLab instead of GitHub.** The link
|
||||
still carries the page's address, your browser's user-agent string and
|
||||
recent error lines from this site, and now **GitLab** receives them as soon
|
||||
as you open it; nothing is filed until you review and submit the issue. The
|
||||
Privacy Policy and the Third-party page name GitLab instead of GitHub, so
|
||||
the legal notice asks everyone to accept it again.
|
||||
|
||||
### Changed
|
||||
|
||||
- **The source moved** (decision D38): the repository is
|
||||
`git.poli0981.dev/poli0981/softharbor`, and outside issues and merge
|
||||
requests go to its mirror, `gitlab.com/poli0981/softharbor`. The footer
|
||||
("Source code", "Releases"), the Contact page, the Accessibility
|
||||
Statement, the Disclaimer, Trademarks and Terms, the data licence,
|
||||
`security.txt` and the attribution in `/api/apps.json` all point there.
|
||||
Security problems are reported by e-mail only, to security@poli0981.dev.
|
||||
- Behind the scenes: production now deploys from the project's own CI once
|
||||
every check has passed; Renovate keeps dependencies current; gitleaks,
|
||||
Opengrep and osv-scanner replace CodeQL; SonarQube Cloud is gone. Nothing
|
||||
you see depends on this.
|
||||
- Dependencies: Astro 7.4.13, Svelte 5.59.1, Wrangler 4.166, Vitest 5.1.1,
|
||||
pnpm 11.29.0 and others. The one advisory exception the build carried
|
||||
(deepmerge) is gone: the advisory was withdrawn.
|
||||
|
||||
The same day, 15 apps joined the catalogue — Windows essentials such as
|
||||
qBittorrent, ScreenToGif, QuickLook and Flow Launcher, and Local AI tools
|
||||
such as AnythingLLM and Comfy Desktop (D39). As always, the RSS feed is
|
||||
where new apps are announced.
|
||||
|
||||
## [1.4.1] — 2026-11-15
|
||||
|
||||
SoftHarbor is now in **maintenance mode**: it does what it set out to do, so
|
||||
from here on it is maintained, not extended.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Maintenance mode** (decision D36). The catalogue keeps growing and being
|
||||
corrected, every download page is still re-scanned at least every 90 days,
|
||||
and bugs, UI/UX problems and accessibility barriers still get fixed;
|
||||
dependencies are kept current, out of schedule when a security advisory
|
||||
calls for it. New features are no longer taken on. What to send where is in
|
||||
the [announcement](https://github.com/poli0981/softharbor/discussions/75) and in CONTRIBUTING.md.
|
||||
- A **Listing change** issue form, for asking that an app be removed,
|
||||
corrected or have its security check re-run.
|
||||
- **Qodana** joins CodeQL and SonarQube Cloud: JetBrains' inspections run on
|
||||
every change and report to GitHub code scanning.
|
||||
|
||||
### Fixed
|
||||
|
||||
- What Qodana's first run found: the human-check endpoint and the VirusTotal
|
||||
re-check script no longer use exceptions for ordinary control flow, and two
|
||||
regular expressions and one filter condition are simpler. Nothing a visitor
|
||||
sees changes.
|
||||
|
||||
## [1.4.0] — 2026-11-09
|
||||
|
||||
Accessibility: a public statement of what the site aims for and how to
|
||||
report a barrier, a round of fixes, and a new category of assistive
|
||||
software.
|
||||
|
||||
### Privacy — what changed
|
||||
|
||||
- The display menu has a new switch for the "/" search shortcut. Your
|
||||
choice is remembered in your browser as `sh:keys`, like the other display
|
||||
choices, and never sent anywhere. The Privacy Policy lists it, so the
|
||||
consent dialog asks you to accept once more.
|
||||
|
||||
### Added
|
||||
|
||||
- **[Accessibility Statement](https://softharbor.net/legal/accessibility)**
|
||||
in English and Vietnamese: the target (WCAG 2.2 level AA — a goal, not a
|
||||
claim that every page meets it), what the site does, how it is tested,
|
||||
what is known not to work yet, and how to report a barrier — by email to
|
||||
accessibility@poli0981.dev, no GitHub account needed, or with the new
|
||||
Accessibility issue form. `ACCESSIBILITY.md` in the repository says the
|
||||
same for contributors, and pull requests now come with an accessibility
|
||||
checklist.
|
||||
- **"Keyboard shortcut “/”: On / Off"** in the display menu, for anyone who
|
||||
sets it off by accident — with speech input, for example. Turned off, the
|
||||
"/" hints disappear too.
|
||||
- **An Accessibility category** with eight apps: the NVDA screen reader,
|
||||
Optikey for typing and controlling the computer with your eyes, Balabolka
|
||||
and eSpeak NG for speech, Thorium Reader and Bookworm for reading, and
|
||||
Colour Contrast Analyser and Accessibility Insights for checking your own
|
||||
work. Also new: Orkas, a desktop AI workspace, suggested by
|
||||
[@BlueSkyID666](https://github.com/BlueSkyID666) in
|
||||
[#65](https://github.com/poli0981/softharbor/issues/65). 15 categories in
|
||||
all.
|
||||
|
||||
### Changed
|
||||
|
||||
- On a narrow phone (320 px wide) or at a large zoom, the language and
|
||||
display buttons move to a second header row instead of off the screen,
|
||||
and whatever you tab to no longer hides under the header.
|
||||
- The focused choice in the display menu has a visible focus ring of its
|
||||
own, and the language switch no longer clips its ring.
|
||||
- With a Windows contrast theme, the current section, your display choices
|
||||
and the current language stay marked.
|
||||
- Category links on app cards are bigger targets; screen readers hear the
|
||||
filter button as "Filters 2 active" and a search error as soon as it
|
||||
happens; tables have captions and scroll with the keyboard; "Report a
|
||||
bug" says it opens a new tab.
|
||||
- The automated accessibility checks now also fail on moderate findings and
|
||||
cover every kind of page in both languages, plus the open dialogs.
|
||||
- The AI Disclosure names the model used for this release.
|
||||
|
||||
### Security status — what changed
|
||||
|
||||
- Every app still marked "Unverified" was scanned again. Twenty now show
|
||||
"No known warnings": eight came back with no detections, and twelve whose
|
||||
only warning came from one or two URL-reputation services were reviewed
|
||||
by the maintainer and judged false positives — their linked scans still
|
||||
show that warning. Nine stay "Unverified", each for a stated reason.
|
||||
364 of the 373 apps carry "No known warnings".
|
||||
|
||||
## [1.3.0] — 2026-10-26
|
||||
|
||||
Protection against floods: the site now limits how fast one network can
|
||||
ask for it, and says so plainly when it does.
|
||||
|
||||
### Privacy — what changed
|
||||
|
||||
- To keep floods and runaway scripts off the site, requests for its pages,
|
||||
feeds and data are now counted per network address for a few seconds,
|
||||
then forgotten. No address is kept. The Privacy Policy has a new section,
|
||||
"Rate limiting", so the consent dialog asks you to accept once more.
|
||||
|
||||
### Added
|
||||
|
||||
- **A rate limit for the whole site.** A browser or tool that asks for
|
||||
far more than anyone reading would — over 60 requests in ten seconds —
|
||||
gets a "Too many requests" page in English and Vietnamese for about ten
|
||||
seconds instead of the page asked for. The public dataset at
|
||||
`/api/apps.json` and the bot-check endpoint answer in JSON under the same
|
||||
limit, and the
|
||||
dataset's answer is readable from other sites, so tools see the refusal
|
||||
and when to retry. What a page loads — styles, scripts, fonts, icons — is
|
||||
never limited, so a page that loads, loads whole.
|
||||
|
||||
### Changed
|
||||
|
||||
- The "Too many requests" page says how long to wait and points tools at
|
||||
the dataset.
|
||||
- The end-to-end tests also run the site's Worker locally and flood it on
|
||||
purpose: the limit, the 429 page, and everyone let back in afterwards.
|
||||
- The AI Disclosure names the model used for this release.
|
||||
|
||||
## [1.2.0] — 2026-10-23
|
||||
|
||||
Upkeep of everything behind the list — security checks that keep
|
||||
themselves current, a newer toolchain, deeper code analysis — and the
|
||||
catalogue's second batch.
|
||||
|
||||
### Security status — what changed
|
||||
|
||||
- **Re-checks are automatic now.** Every app's download page is re-scanned
|
||||
on VirusTotal at least every 90 days, and the date on its security line
|
||||
moves with it. Any warning moves an app back to "Unverified" and opens an
|
||||
issue for the maintainer to look at; nothing is ever marked safe or
|
||||
removed automatically. The note under "No known warnings" now says what
|
||||
it rests on: the published checklist when the app was listed, and a scan
|
||||
of its download page on the date shown.
|
||||
- The first runs re-scanned 197 of the earlier apps, including eight whose
|
||||
linked scan was of an older download link. Nine of them — 7-Zip, Android
|
||||
Studio, DBeaver, DevToys, Helium, itch, KeePassXC, LuLu and Meld — drew a
|
||||
single warning from one engine and show "Unverified" until the maintainer
|
||||
has looked at each one. The remaining apps follow automatically from
|
||||
28 October.
|
||||
|
||||
### Added
|
||||
|
||||
- **38 apps** in a second batch — screenshot, clipboard and window tools,
|
||||
package managers, file sharing and remote access, emulators, local AI,
|
||||
CAD and 3D printing. The [RSS feed](https://softharbor.net/rss.xml) lists
|
||||
each one. 30 of them carry "No known warnings"; 8 stay "Unverified" for
|
||||
now, each for a stated reason.
|
||||
- **Two categories:** Local AI and CAD & 3D (14 in all).
|
||||
|
||||
### Changed
|
||||
|
||||
- The AI Disclosure describes the automatic re-check and names the model
|
||||
used for this release.
|
||||
- Built and tested on **Node.js 26**; TypeScript files are now also
|
||||
type-checked by **TypeScript 7**, beside the TypeScript 6 that Astro's
|
||||
checker still needs.
|
||||
- **SonarQube Cloud** analyses every change from CI, with test coverage —
|
||||
which now also measures the build scripts and the in-page scripts.
|
||||
|
||||
### Fixed
|
||||
|
||||
- A malformed date in an app's data stopped the build with an unhelpful
|
||||
error instead of naming the field.
|
||||
|
||||
## [1.1.0] — 2026-10-21
|
||||
|
||||
A full review of the site after launch: security advisories closed, real
|
||||
production bugs fixed, a new look, and two Cloudflare services added with a
|
||||
privacy policy rewritten to match.
|
||||
|
||||
### Privacy — read this if you read nothing else
|
||||
|
||||
v1.0 said "no analytics". That changed, deliberately and narrowly:
|
||||
|
||||
- **Cloudflare Web Analytics** (cookieless, nothing stored in your browser)
|
||||
now counts page views. It does **not load at all** if your browser sends
|
||||
**Global Privacy Control**, and never on preview or local hosts.
|
||||
- **Cloudflare Turnstile** runs once in the legal gate, **only after** you
|
||||
accept the terms, to tell people from bots. It usually needs no click. A
|
||||
pass is remembered for 48 hours. If it cannot run — blocked, offline, or our
|
||||
endpoint down — you are let in anyway.
|
||||
- The [Privacy Policy](https://softharbor.net/legal/privacy) was rewritten to
|
||||
say exactly what each of these sees and what we keep (nothing identifying),
|
||||
and the legal version was bumped, so everyone is asked to accept once more.
|
||||
|
||||
### Added
|
||||
|
||||
- **A new look ("Harbor")**: cool chart-paper light theme and a navy night
|
||||
theme, hairline rules, soft shadows, a frosted header, a home page with a
|
||||
live "manifest" of the catalogue and a category grid, redesigned app cards
|
||||
and detail pages, a five-column footer, and Lucide icons that move a little
|
||||
on hover or focus — and not at all if you ask for reduced motion.
|
||||
- **Display menu**: theme (system/light/dark), scrollbar (default, thin or
|
||||
hidden — scrolling still works), and motion (system or reduced). Applied
|
||||
before the first paint, so nothing flashes.
|
||||
- **Contact page** (`/contact`, `/vi/contact`) with one address per purpose:
|
||||
security, privacy, legal, copyright (DMCA), listing takedowns, licensing,
|
||||
Code of Conduct, press and collaboration — all `@poli0981.dev`.
|
||||
- **Shareable search**: the query, filters and sort are kept in the URL; a
|
||||
"Best match" order while searching; Vietnamese searches ignore diacritics.
|
||||
- **Installable app**: the PWA manifest is linked, with proper icons; the
|
||||
offline page now comes with its styles.
|
||||
- **Third-party notices** now list every package the site is built from,
|
||||
generated at build time.
|
||||
- **More "in this category"** on every app page, and a panel explaining what
|
||||
the security status does and does not mean.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Hashed assets were served with two contradictory `Cache-Control` values,
|
||||
so browsers revalidated them on every visit; the JSON feeds were never
|
||||
cached. Each now gets exactly one.
|
||||
- The legal gate could be dismissed with Esc in Chromium; its exemptions
|
||||
missed the real 404 and offline pages; its links looked like plain text.
|
||||
- Search: a late result could filter the grid after the box was cleared;
|
||||
"Clear all" left the search text in place; a Czech-locale browser sorted 81
|
||||
of the 326 apps differently; the page announced the count twice per key.
|
||||
- Small type (14 px and 12.5 px) was rendering at 16 px across the site.
|
||||
- The language switcher marked English as current on Vietnamese pages and
|
||||
linked VI to the home page; its accessible name now keeps the visible code.
|
||||
- Theme flicker on navigation, a growing pile of CSP tags and a sort menu that
|
||||
disagreed with the grid — all from the old soft-navigation router, now
|
||||
replaced by native page transitions.
|
||||
- Pages no longer overflow sideways on phones.
|
||||
- Error, 404 and offline pages are bilingual; "1 apps" is "1 app".
|
||||
|
||||
### Security & maintenance
|
||||
|
||||
- Every open Dependabot advisory closed (including a critical Astro RCE);
|
||||
dependencies refreshed; GitHub Actions pinned to commit SHAs; Dependabot
|
||||
configured (Renovate had never run).
|
||||
- A tiny Worker (`worker/`, `POST /api/verify`) is the only server code; every
|
||||
page is still served as a static asset.
|
||||
- The CSP now covers every script in the page head, and the build fails on
|
||||
anything the policy would silently refuse.
|
||||
- Data rules enforced at build time: official links only (download portals,
|
||||
tracking parameters, look-alike hosts and invisible characters rejected),
|
||||
real dates, evidence required for a security status.
|
||||
- Tests: 340+ unit, component, build-script and Worker tests (≈95 % coverage of
|
||||
shipped code, enforced), plus a Playwright + axe suite that loads every page
|
||||
type in both languages and both themes on desktop and mobile, and fails on
|
||||
any console error, CSP violation, accessibility violation or sideways
|
||||
overflow.
|
||||
|
||||
## [1.0.0] — 2026-07-30
|
||||
|
||||
First public release: 326 apps in 12 categories, English and Vietnamese,
|
||||
official links only, dated security statuses with their scans linked. See the
|
||||
[release notes](https://github.com/poli0981/softharbor/releases/tag/v1.0.0).
|
||||
|
||||
[1.5.0]: https://git.poli0981.dev/poli0981/softharbor/releases/tag/v1.5.0
|
||||
[1.4.1]: https://git.poli0981.dev/poli0981/softharbor/releases/tag/v1.4.1
|
||||
[1.4.0]: https://git.poli0981.dev/poli0981/softharbor/releases/tag/v1.4.0
|
||||
[1.3.0]: https://git.poli0981.dev/poli0981/softharbor/releases/tag/v1.3.0
|
||||
[1.2.0]: https://git.poli0981.dev/poli0981/softharbor/releases/tag/v1.2.0
|
||||
[1.1.0]: https://git.poli0981.dev/poli0981/softharbor/releases/tag/v1.1.0
|
||||
[1.0.0]: https://git.poli0981.dev/poli0981/softharbor/releases/tag/v1.0.0
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> Root instruction file for AI-assisted development (Claude Code).
|
||||
> Read this first. Detailed specs live in `docs/00–16`.
|
||||
> Suite version: 1.2 (2026-07-27) · Author: poli0981 / SkullMute
|
||||
> Suite version: 4.0 (2026-11-24, site v1.5.0) · Author: poli0981 / SkullMute
|
||||
|
||||
## What this project is
|
||||
|
||||
@@ -13,20 +13,54 @@ install (or macOS/Linux setup) you open one page, filter by category, and jump
|
||||
straight to each app's **official** homepage/repo/download page instead of
|
||||
googling every tool one by one.
|
||||
|
||||
- Repo: `poli0981/softharbor` · License: code **GPL-3.0-only**, data **CC BY-SA 4.0**
|
||||
- Repo: `poli0981/softharbor` on the owner's **Gitea**
|
||||
(`https://git.poli0981.dev/poli0981/softharbor`, see "Forge & CI" below) ·
|
||||
License: code **GPL-3.0-only**, data **CC BY-SA 4.0**
|
||||
- Hosting: **Cloudflare Workers Static Assets** on canonical
|
||||
**`https://softharbor.net`** (Free zone; `www` 301s to apex; workers.dev
|
||||
route disabled, PR previews only — see `docs/16`). No Worker script, no
|
||||
backend, no database.
|
||||
- Stack: Node 24 LTS · pnpm 10 · Astro 7 (static output) · Svelte 5 islands ·
|
||||
Tailwind CSS 4.3 · TypeScript strict · Wrangler 4 — full table in `docs/01`
|
||||
route disabled — see `docs/16`), deployed by the CI `deploy` job
|
||||
(`wrangler deploy`) when `main` changes. One tiny Worker runs the site-wide
|
||||
rate limit (D32) and answers `POST /api/verify` (D25); no backend, no
|
||||
database.
|
||||
- Stack: Node 26 · pnpm 11 · Astro 7 (static output) · Svelte 5 islands ·
|
||||
Tailwind CSS 4.3 · TypeScript strict (TS 7 `tsc` beside the TS 6 API that
|
||||
`astro check` needs — D28) · Wrangler 4 — full table in `docs/01`
|
||||
|
||||
## Maintenance mode (D36 — since 2026-11-15)
|
||||
|
||||
The project is **feature-frozen**: maintained, not extended. Work that is in
|
||||
scope — and nothing else:
|
||||
|
||||
1. **Catalogue** — add, correct or remove listings (one app per PR; the owner
|
||||
reviews the Vietnamese), VirusTotal re-checks, quarantine.
|
||||
2. **Fixes** — bugs, UI/UX defects and accessibility barriers.
|
||||
3. **Dependencies** — Renovate's PRs (grouped non-major, OSV security PRs);
|
||||
out of schedule for any advisory rated **High or Critical**, or a serious
|
||||
Node.js security release.
|
||||
4. **Major language / platform moves** — TypeScript (6 → 7), Astro, Svelte,
|
||||
Tailwind, Node, Cloudflare Workers / Wrangler majors, the forge and its CI
|
||||
(D38).
|
||||
5. **Incidents** — the site down, degraded or under attack.
|
||||
|
||||
**Out of scope:** new features, including the frozen feature items of
|
||||
`docs/15 §2`. Close an issue or PR that proposes one as *not planned* with the
|
||||
`wontfix` label, and never start one unless the owner lifts D36 first.
|
||||
Releases: a patch tag when a fix is worth announcing, a minor one for a
|
||||
platform major; data changes never tag (`docs/13 §1`).
|
||||
|
||||
## Hard rules (never violate)
|
||||
|
||||
1. **Static-first.** No `main` Worker script, no SSR, no server code, no
|
||||
database, no serverless functions. All interactivity is client-side Svelte
|
||||
islands. If a feature seems to need a server, redesign it or move it to a
|
||||
GitHub Actions workflow.
|
||||
1. **Static-first.** No SSR, no database, no serverless functions; all
|
||||
interactivity is client-side Svelte islands. The ONE exception is
|
||||
`worker/`, a minimal Worker that does exactly two things: the site-wide
|
||||
rate limit (D32 — over it, a 429; otherwise the request goes to the asset
|
||||
server untouched) and `POST /api/verify` (D25, the legal gate's Turnstile
|
||||
check). It runs only for the paths in `assets.run_worker_first`, never
|
||||
renders or rewrites a page, never withholds one from a person reading at
|
||||
a normal pace, and every failure on its side must fail OPEN. Anything else
|
||||
that seems to need a server: redesign it or move it to a Gitea Actions
|
||||
workflow — a second Worker route, or a change to what runs it first,
|
||||
needs a decision-log entry.
|
||||
2. **Data is law.** Every listed app is exactly one JSON file in
|
||||
`src/data/apps/<slug>.json`, validated by the Zod schema in
|
||||
`src/content.config.ts`. Invalid data must fail the build. Never bypass the
|
||||
@@ -46,14 +80,51 @@ googling every tool one by one.
|
||||
`src/i18n/en.json` and `src/i18n/vi.json`; every app has `summary.en` and
|
||||
`summary.vi`. A missing key in either language fails CI.
|
||||
7. **Self-host everything.** Fonts (Fontsource), logos (Simple Icons /
|
||||
`src/assets/logos/`), scripts, styles. Zero third-party requests at
|
||||
runtime. `Content-Security-Policy: default-src 'self'` must keep passing
|
||||
(`docs/09 §4`).
|
||||
`src/assets/logos/`), scripts, styles. The only third-party runtime
|
||||
requests are two Cloudflare services, each started by our own code:
|
||||
Web Analytics (`src/scripts/analytics.js` — never under Global Privacy
|
||||
Control, production host only; D26) and Turnstile (`src/lib/turnstile.ts`
|
||||
— only after the legal gate is accepted; D25). Adding a third needs a
|
||||
decision-log entry. The CSP (`default-src 'self'` plus exactly those
|
||||
origins, `docs/09 §4`) must keep passing `pnpm check:csp` and the e2e
|
||||
suite.
|
||||
8. **Official links only, original words only.** `links.*` must point to the
|
||||
developer's official domain or official repo. Summaries are written from
|
||||
scratch — never paste vendor marketing copy or Wikipedia text (data is
|
||||
CC BY-SA 4.0; provenance must be clean).
|
||||
|
||||
## Forge & CI (D38 — since 2026-11-24)
|
||||
|
||||
The GitHub account was suspended in November 2026. The repository lives on
|
||||
**Gitea**, `https://git.poli0981.dev/poli0981/softharbor`, as `origin`; the
|
||||
`github` remote is the old repository's — keep it, never push to it.
|
||||
|
||||
- **Outside issues and merge requests** arrive on the GitLab push mirror,
|
||||
`gitlab.com/poli0981/softharbor`, where no CI runs; patches come by e-mail
|
||||
to `code@`. Registration on the Gitea is closed.
|
||||
- **Workflows** are Gitea Actions in `.gitea/workflows/` (`ci`, `security`,
|
||||
`qodana`, `notify`, `quarantine`, `vt-recheck`, `link-check`) on one
|
||||
runner on the maintainer's PC: jobs run only while it is on, every cron
|
||||
sits inside **13:00–16:00 UTC** on a registered slot, and every action is
|
||||
pinned to a SHA. The ops repo's reusables are pinned by hand to an ops tag.
|
||||
- **Deploy** is `ci.yml`'s `deploy` job (`wrangler deploy` on pushes to
|
||||
`main`, Cloudflare secrets at user level); Workers Builds is gone and
|
||||
there are no PR previews.
|
||||
- **Bots** (quarantine, vt-recheck, link-check) talk to Gitea through
|
||||
`scripts/gitea.mjs` with the job token; they dispatch CI on their branch,
|
||||
and `ci.yml`'s `record` job writes the statuses a dispatched run lacks.
|
||||
- **Renovate** (`renovate.json` → `local>poli0981/renovate-config`) replaces
|
||||
Dependabot; the ops `security.yml` (gitleaks, Opengrep, osv-scanner)
|
||||
replaces CodeQL; Qodana runs through the ops `reusable-qodana.yml`;
|
||||
SonarQube Cloud and GitHub code scanning are gone.
|
||||
- **Rules:** branch protection on `main` requires `CI / build (*)` and
|
||||
`CI / gates (*)` (Gitea names a check `<workflow> / <job> (<event>)`, so
|
||||
renaming either breaks the rule); squash merges; signed commits are not
|
||||
required (the bots cannot sign).
|
||||
- **The migration runbook** is `docs/GITEA-MIGRATION.md` in
|
||||
`poli0981/.github` (`E:\.github` on the PC); for migration topics it wins
|
||||
over this file, and a conflict is reported. The details are in `docs/12`.
|
||||
|
||||
## Build phases
|
||||
|
||||
Work in order. Do not start a phase before the previous phase's exit
|
||||
@@ -66,31 +137,40 @@ criteria (`docs/15`) are met.
|
||||
| **P3 — Static pages** | Welcome, `/apps`, `/apps/[slug]`, `/categories/[id]`, layouts, tokens, fonts, dark mode (no JS yet) | 02, 06 |
|
||||
| **P4 — Islands** | Search/filter/sort (MiniSearch + nanostores), language switcher, theme toggle, legal gate | 05, 06, 07, 14 |
|
||||
| **P5 — Resilience & outputs** | 404/offline/PWA, dormant error templates, `/api/apps.json`, `/rss.xml`, bug-report button | 03, 05, 08 |
|
||||
| **P6 — Ship** | `_headers`, CI/CD wiring, deploy, seed the app catalogue (326 as of 2026-07-30), launch checklist | 09, 10, 12, 13 |
|
||||
| **P6 — Ship** | `_headers`, CI/CD wiring, deploy, seed the app catalogue (326 as of 2026-07-30; 364 after batch 2, 2026-10-23; 373 after batch 3, 2026-11-09; 390 after batch 4, 2026-11-24), launch checklist | 09, 10, 12, 13 |
|
||||
|
||||
All six phases are done — v1.0.0 shipped on 2026-07-30 — and no new phase
|
||||
opens: the project is in maintenance mode (above).
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
pnpm install # Node 24 LTS required (see .nvmrc / engines)
|
||||
pnpm install # Node 26 required (see .nvmrc / engines)
|
||||
pnpm dev # astro dev
|
||||
pnpm build # astro build → dist/
|
||||
pnpm preview # astro preview
|
||||
pnpm lint # eslint + prettier --check
|
||||
pnpm test # vitest run
|
||||
pnpm check # astro check (TS 6) + tsc --noEmit (TS 7)
|
||||
pnpm test # vitest run (unit, islands, scripts, worker)
|
||||
pnpm coverage # vitest run --coverage (thresholds in vitest.config.ts)
|
||||
pnpm e2e # playwright + axe against astro preview (build first)
|
||||
pnpm validate:data # node scripts/validate-data.mjs (L2 data rules)
|
||||
pnpm vt:recheck # VirusTotal re-check (needs VT_API_KEY; docs/12 §4b)
|
||||
pnpm i18n:check # node scripts/check-i18n-parity.mjs (EN/VI key parity)
|
||||
pnpm deploy # wrangler deploy (CI does this on main)
|
||||
pnpm deploy # build + wrangler deploy (CI's deploy job does this on main)
|
||||
```
|
||||
|
||||
## Naming & identifiers (locked)
|
||||
|
||||
- Component prefix `Sh*`: `ShAppCard.astro`, `ShSearch.svelte`,
|
||||
`ShLegalGate.svelte`, `ShFilterSheet.svelte`, `ShLangSwitch.svelte`,
|
||||
`ShThemeToggle.svelte`
|
||||
- CSS custom properties: `--sh-*` · localStorage keys: `sh:legal`, `sh:lang`,
|
||||
`sh:theme`
|
||||
- Worker name: `softharbor` · Data: `src/data/apps/` · Quarantine:
|
||||
`data/quarantine/`
|
||||
`ShPrefs.svelte` (display menu; replaced `ShThemeToggle`)
|
||||
- CSS custom properties: `--sh-*` · localStorage keys: `sh:legal`, `sh:human`,
|
||||
`sh:lang`, `sh:theme`, `sh:scrollbar`, `sh:motion`, `sh:keys`
|
||||
- Worker name: `softharbor` (code in `worker/`, endpoint `/api/verify`) ·
|
||||
Data: `src/data/apps/` · Quarantine: `data/quarantine/`
|
||||
- Contacts: one `@poli0981.dev` address per purpose — `src/lib/contacts.ts`
|
||||
(D27)
|
||||
|
||||
## Document map
|
||||
|
||||
@@ -108,7 +188,7 @@ pnpm deploy # wrangler deploy (CI does this on main)
|
||||
| `docs/09_SECURITY_PRIVACY.md` | Threat model, `_headers`/CSP, security.txt, data-vetting policy, privacy |
|
||||
| `docs/10_CODING_STANDARDS.md` | TS/ESLint/Prettier/Knip/lefthook, naming, commits, DoD |
|
||||
| `docs/11_TESTING.md` | Test pyramid, P0 spikes S1–S5, coverage targets |
|
||||
| `docs/12_CI_CD.md` | Workflows (validate/deploy/quarantine/link-check), `poli0981/.github` wiring, issue forms |
|
||||
| `docs/12_CI_CD.md` | Gitea Actions: ci (build, gates, record, deploy) / security / qodana / notify / quarantine / vt-recheck / link-check, `scripts/gitea.mjs`, Renovate, issue templates, branch protection |
|
||||
| `docs/13_RELEASE.md` | Launch checklist, seed list, versioning, notify.py announcement |
|
||||
| `docs/14_LEGAL.md` | Licensing model, legal-gate spec, bilingual drafts (Disclaimer/Privacy/Terms/Trademarks/Third-party) |
|
||||
| `docs/15_ROADMAP.md` | Milestones, post-v1 backlog, decision log, open questions |
|
||||
|
||||
@@ -6,7 +6,7 @@ Please read it there; it applies in full and is not restated here.
|
||||
It covers every project space — issues, pull requests, commit messages,
|
||||
discussions — and any place someone is representing the project.
|
||||
|
||||
Reports go to **contact@softharbor.net**. They are read by the maintainer
|
||||
Reports go to **code@poli0981.dev**. They are read by the maintainer
|
||||
(@poli0981) and are not shared further. If your report concerns the
|
||||
maintainer, say so and you will get a plain answer about what can be done,
|
||||
rather than a process that reviews itself.
|
||||
|
||||
@@ -9,11 +9,58 @@ under **GPL-3.0-only**, dataset entries under **CC BY-SA 4.0**.
|
||||
|
||||
- Code of Conduct: [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)
|
||||
- Security vulnerabilities: [SECURITY.md](SECURITY.md) — **never** a public issue
|
||||
- Contact: **contact@softharbor.net**
|
||||
- Accessibility: [ACCESSIBILITY.md](ACCESSIBILITY.md) — the guardrails every
|
||||
user-facing change keeps, and how barriers are reported
|
||||
- Contact: Code of Conduct reports **code@poli0981.dev**, licensing questions
|
||||
**copyright@poli0981.dev**; anything else, open an issue
|
||||
|
||||
## Where the project lives
|
||||
|
||||
- **Source:** [git.poli0981.dev/poli0981/softharbor](https://git.poli0981.dev/poli0981/softharbor), the canonical
|
||||
repository. It is read-only for everyone but the maintainer: registration on
|
||||
that Gitea is closed.
|
||||
- **Issues and merge requests:** the mirror,
|
||||
[gitlab.com/poli0981/softharbor](https://gitlab.com/poli0981/softharbor).
|
||||
Gitea pushes to it, so it is always current. Pick a template when you open an
|
||||
issue (App request, Listing change, Bug, Accessibility).
|
||||
- **Patches by e-mail:** `git format-patch` / `git send-email` to
|
||||
**code@poli0981.dev**, which is also the address for questions.
|
||||
|
||||
The maintainer applies an accepted change on Gitea; the mirror then updates
|
||||
GitLab, and the merge request shows as merged (or is closed, with a link to the
|
||||
commit, if its commits were squashed). **CI does not run on GitLab merge
|
||||
requests** — the mirror has its CI switched off. The maintainer runs CI on
|
||||
Gitea, so a merge request is checked when it is applied there.
|
||||
|
||||
The project moved from GitHub in November 2026 (D38); its old issues,
|
||||
discussions and pull requests did not move with the code.
|
||||
|
||||
## Maintenance mode
|
||||
|
||||
Since 2026-11-15 SoftHarbor is **maintained, not extended** — decision D36 in
|
||||
[docs/15 §4](docs/15_ROADMAP.md).
|
||||
|
||||
**Accepted** — issues and pull requests that:
|
||||
|
||||
- **add** an app (after its App request is accepted), or **remove** or
|
||||
**correct** a listed one
|
||||
- ask for or record a **security re-check** of a listing (VirusTotal)
|
||||
- fix a **bug**, or a **UI/UX** or **accessibility** problem on the site
|
||||
|
||||
The maintainer also keeps the platform current: dependency updates as
|
||||
Renovate proposes them — and out of schedule for a dependency with a
|
||||
**High or Critical** CVE or a serious Node.js security release — major
|
||||
language and platform updates (TypeScript, Astro, Cloudflare Workers /
|
||||
Wrangler), and incidents: the site down, degraded or under attack.
|
||||
|
||||
**Not accepted** — **new features**, and issues or pull requests that propose
|
||||
one. They are closed as _not planned_ (label `wontfix`). That is not a verdict
|
||||
on the idea: the scope is frozen, and reviewing features would take the time
|
||||
the catalogue needs.
|
||||
|
||||
## Suggesting an app
|
||||
|
||||
Open an **App request** issue. Do not open a pull request for a new app before
|
||||
Open an **App request** issue on the GitLab mirror. Do not open a pull request for a new app before
|
||||
the request is accepted — the answer is a curation judgement, and a rejected PR
|
||||
wastes more of your time than a rejected issue.
|
||||
|
||||
@@ -28,11 +75,28 @@ An app is listable only when all of these hold ([docs/00 §3](docs/00_PROJECT_OV
|
||||
- Maintained, or finished and stable. Not abandonware with open vulnerabilities
|
||||
- No bundled adware in the official installer; nothing piracy-adjacent
|
||||
|
||||
An accepted suggestion is credited in the README's Acknowledgements — tell us
|
||||
in the request if you would rather not be named.
|
||||
|
||||
## Removing or correcting a listing
|
||||
|
||||
Open a **Listing change** issue when an app went subscription-only, was
|
||||
abandoned, moved its official pages or has a wrong detail — or when you want
|
||||
its security check re-run. Link the evidence; the decision follows it. A
|
||||
suspected **malicious or hijacked download** is a security report, not an
|
||||
issue ([SECURITY.md](SECURITY.md)). If it is **your own app**, you can also
|
||||
write to **takedown@poli0981.dev**.
|
||||
|
||||
A removal is reviewed like an addition. An app that turns out harmful is
|
||||
quarantined rather than deleted (docs/03 §5), so the record of why stays.
|
||||
|
||||
## Reporting a bug
|
||||
|
||||
Use the **Bug report** form, or the "Report a bug" button on any app page —
|
||||
it pre-fills the details. Bugs are about _this site_. We cannot help with the
|
||||
software we link to; take that to its own developer.
|
||||
Use the **Bug** issue template on the GitLab mirror, or the "Report a bug"
|
||||
link in the site's footer — it pre-fills the details. Bugs are about _this site_. We cannot help with the
|
||||
software we link to; take that to its own developer. Something that is hard to
|
||||
use counts too: UI/UX problems and accessibility barriers
|
||||
([ACCESSIBILITY.md](ACCESSIBILITY.md)) are bugs here.
|
||||
|
||||
## Changing code or data
|
||||
|
||||
@@ -41,15 +105,19 @@ software we link to; take that to its own developer.
|
||||
3. Conventional Commits, lowercase, imperative — `feat:`, `fix:`, `data:`,
|
||||
`docs:`, `chore:`, `ci:`, `refactor:`, `test:`. The squash title becomes the
|
||||
changelog entry, so it has to stand alone.
|
||||
4. Run every gate before pushing. CI runs the same ones and they are not
|
||||
advisory:
|
||||
4. Fill in the pull request template — its accessibility checklist applies to
|
||||
any change a visitor can see or operate.
|
||||
5. Run every gate before sending it. CI runs the same ones on Gitea and they
|
||||
are not advisory:
|
||||
|
||||
```bash
|
||||
pnpm lint && pnpm i18n:check && pnpm validate:data && pnpm test && pnpm check && pnpm build && pnpm check:styles && pnpm check:sw && pnpm knip
|
||||
pnpm lint && pnpm check && pnpm coverage && pnpm build && pnpm knip && pnpm e2e
|
||||
```
|
||||
|
||||
`check:styles` and `check:sw` inspect `dist/`, so they must run **after**
|
||||
`build`.
|
||||
`pnpm build` already runs the data and i18n gates before Astro and the
|
||||
`dist/` gates after it (`check:csp`, `check:assets`, `check:sw`,
|
||||
`check:feed`); `pnpm e2e` needs that build, and a one-time
|
||||
`pnpm exec playwright install chromium`.
|
||||
|
||||
Data lives in `src/data/apps/<slug>.json`, one file per app, validated by the
|
||||
Zod schema in `src/content.config.ts`. Summaries are written **from scratch**
|
||||
@@ -57,8 +125,16 @@ in both English and Vietnamese — that is what lets the dataset carry CC BY-SA
|
||||
at all. Vietnamese is reviewed by a native speaker; machine translation is not
|
||||
accepted.
|
||||
|
||||
If you are unsure whether something is wanted, open a discussion first. A
|
||||
short question costs everyone less than a large rejected PR.
|
||||
A new entry starts as `"security": { "status": "unverified", "evidence": null,
|
||||
"checkedAt": "<today>" }`. You do not need a VirusTotal key: the maintainer
|
||||
dispatches `vt-recheck.yml` on the PR branch, which scans the new entry's
|
||||
download page and records the permalink, and only the maintainer moves an
|
||||
entry to `clean` (docs/09 §6). If you change an existing entry's
|
||||
`links.download`, the old scan no longer describes it — say so in the PR.
|
||||
|
||||
If you are unsure whether something is wanted, ask by e-mail (code@) first. A
|
||||
short question costs everyone less than a large rejected PR — and new features
|
||||
are not wanted while the project is in [maintenance mode](#maintenance-mode).
|
||||
|
||||
## Closed without discussion
|
||||
|
||||
@@ -69,8 +145,8 @@ blocked:
|
||||
|
||||
**Malicious or deceptive**
|
||||
|
||||
- **Code that appears to plant anything malicious.** If CodeQL and Dependabot
|
||||
find nothing but the change still looks wrong, the maintainer reviews it by
|
||||
- **Code that appears to plant anything malicious.** If the security checks
|
||||
(gitleaks, Opengrep, osv-scanner) find nothing but the change still looks wrong, the maintainer reviews it by
|
||||
hand and takes as long as that needs. Confirmed — **permanent ban, no
|
||||
exceptions.**
|
||||
- **Invisible or confusable characters** — zero-width joiners, bidirectional
|
||||
@@ -97,6 +173,9 @@ blocked:
|
||||
output unread is not. This project discloses its own AI use at
|
||||
[/legal/ai-disclosure](https://softharbor.net/legal/ai-disclosure), and holds
|
||||
contributions to the same standard it holds itself.
|
||||
- **Feature work** of any size while the project is in
|
||||
[maintenance mode](#maintenance-mode) — including a feature presented as a
|
||||
fix.
|
||||
- **Drive-by or automated PRs** — whitespace, reformatting, badge additions,
|
||||
dependency bumps Renovate already owns, or bulk submissions for contribution
|
||||
counts.
|
||||
@@ -117,7 +196,7 @@ blocked:
|
||||
**Conduct**
|
||||
|
||||
- Anything contrary to the
|
||||
[GitHub Acceptable Use Policies](https://docs.github.com/site-policy/acceptable-use-policies/github-acceptable-use-policies)
|
||||
[GitLab Acceptable Use Policy](https://handbook.gitlab.com/handbook/legal/acceptable-use-policy/)
|
||||
or our [Code of Conduct](CODE_OF_CONDUCT.md) — harassment, slurs, spam,
|
||||
impersonation, or pressure of any kind.
|
||||
|
||||
|
||||
@@ -7,7 +7,11 @@ Creative Commons Attribution-ShareAlike 4.0 International license
|
||||
(CC BY-SA 4.0): https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
**Attribution format:** "SoftHarbor contributors —
|
||||
https://github.com/poli0981/softharbor (CC BY-SA 4.0)".
|
||||
https://git.poli0981.dev/poli0981/softharbor (CC BY-SA 4.0)".
|
||||
|
||||
The project moved from GitHub to its own Gitea in November 2026. An
|
||||
attribution made before then names `https://github.com/poli0981/softharbor`;
|
||||
that remains a valid attribution of the same dataset.
|
||||
|
||||
You may copy, redistribute, and adapt the dataset, including commercially,
|
||||
provided you give the attribution above, link the license, indicate
|
||||
@@ -18,3 +22,5 @@ structure). It does **not** cover the listed applications, their names, or
|
||||
their logos, which belong to their respective owners (see /legal/trademarks).
|
||||
Everything in this repository outside `src/data/` is licensed under
|
||||
GPL-3.0-only — see `LICENSE`.
|
||||
|
||||
Questions about this license or how to attribute: copyright@poli0981.dev.
|
||||
@@ -1,5 +1,13 @@
|
||||
# SoftHarbor
|
||||
|
||||
[](#project-status)
|
||||
[](https://git.poli0981.dev/poli0981/softharbor/actions?workflow=ci.yml)
|
||||
[](https://git.poli0981.dev/poli0981/softharbor/actions?workflow=security.yml)
|
||||
[](https://git.poli0981.dev/poli0981/softharbor/actions?workflow=qodana.yml)
|
||||
[](https://git.poli0981.dev/poli0981/softharbor/releases)
|
||||
[](LICENSE)
|
||||
[](LICENSE-DATA.md)
|
||||
|
||||
**[softharbor.net](https://softharbor.net)** — a bilingual (EN/VI) directory of
|
||||
desktop software that is **free**, or **buy-once**. Never subscription-only.
|
||||
|
||||
@@ -9,9 +17,26 @@ filter by category and platform, and go straight to every **official** source.
|
||||
|
||||
The site hosts **no binaries**. It is a map, not a mirror.
|
||||
|
||||
## Project status
|
||||
|
||||
**Maintenance mode since 2026-11-15 (v1.4.1).** SoftHarbor does what it set
|
||||
out to do, so from here on it is maintained, not extended (decision D36 in
|
||||
[docs/15](docs/15_ROADMAP.md); the announcement was a GitHub discussion, which
|
||||
went with the repository's move to Gitea — see [Where things live](#where-things-live)).
|
||||
|
||||
- **Still happening:** apps added, corrected and removed; every download page
|
||||
re-scanned at least every 90 days; bug, UI/UX and accessibility fixes;
|
||||
dependency updates on a schedule — and out of schedule for a High or
|
||||
Critical CVE, a serious Node.js security release, a major TypeScript, Astro
|
||||
or Cloudflare Workers update, or anything that puts the site at risk.
|
||||
- **Not accepted:** new features. Issues and pull requests that propose one
|
||||
are closed as _not planned_.
|
||||
|
||||
What to send where: [CONTRIBUTING.md → Maintenance mode](CONTRIBUTING.md#maintenance-mode).
|
||||
|
||||
## What is in it
|
||||
|
||||
**326 apps** across 12 categories, each one file in `src/data/apps/`. Every
|
||||
**390 apps** across 15 categories, each one file in `src/data/apps/`. Every
|
||||
entry carries:
|
||||
|
||||
- original two-line summaries in English _and_ Vietnamese — written from
|
||||
@@ -22,17 +47,30 @@ entry carries:
|
||||
- a **dated** security status with the scan permalink behind it
|
||||
|
||||
On security the site says _"no known warnings as of <date>"_ and never
|
||||
more than that. 320 entries are `clean`; 6 are held at `unverified` because at
|
||||
least one scanner flagged something, and holding them is more honest than
|
||||
explaining it away. The scan is linked either way — judge it yourself.
|
||||
more than that. 379 entries are `clean`; 11 are held at `unverified` — a
|
||||
scanner flagged something, an advisory or an unsigned build is still open, or
|
||||
the app is too new to have a track record — and holding them is more honest
|
||||
than explaining it away. The scan is linked
|
||||
either way — judge it yourself.
|
||||
|
||||
## How it is built
|
||||
|
||||
Fully static. No server, no database, no backend, no tracking, and no
|
||||
third-party request at runtime — fonts, icons and scripts are all self-hosted.
|
||||
Static. No database, no accounts, no cookies; fonts, icons and scripts are
|
||||
self-hosted. The exceptions are deliberate and small: one tiny Worker
|
||||
(`worker/`) that rate-limits floods — over the limit you get a "Too many
|
||||
requests" page for a few seconds — and checks the legal gate's Cloudflare
|
||||
Turnstile token (the gate lets you in even if the check cannot run), and
|
||||
cookieless Cloudflare Web
|
||||
Analytics, which does not load at all when your browser sends Global Privacy
|
||||
Control. The [Privacy Policy](https://softharbor.net/legal/privacy) has the
|
||||
details.
|
||||
|
||||
Astro 7 (static) · Svelte 5 islands · Tailwind CSS 4 · TypeScript strict ·
|
||||
Node 24 · pnpm 10 · deployed to Cloudflare Workers Static Assets.
|
||||
Node 26 · pnpm 11 · Cloudflare Workers Static Assets (+ one small Worker).
|
||||
Tested with Vitest (unit, islands, build scripts, the Worker) and Playwright +
|
||||
axe on the built site; analysed by Qodana and by gitleaks, Opengrep and
|
||||
osv-scanner. CI runs on Gitea Actions, and its `deploy` job publishes every
|
||||
change to `main` with Wrangler.
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
@@ -49,22 +87,54 @@ pnpm i18n:check # EN/VI key parity
|
||||
pnpm validate:data # cross-file data rules the schema cannot see
|
||||
pnpm test # vitest
|
||||
pnpm check # astro check
|
||||
pnpm build
|
||||
pnpm check:styles # every emitted style is allowed by the page CSP
|
||||
pnpm check:sw # the service worker matches its spec
|
||||
pnpm build # includes the dist/ gates: CSP, assets, service worker, feed
|
||||
pnpm coverage # unit, island, build-script and Worker tests, with thresholds
|
||||
pnpm e2e # Playwright + axe against the built site
|
||||
pnpm knip # dead code and unused deps
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Suggest an app or report a bug with the
|
||||
[issue forms](https://github.com/poli0981/softharbor/issues/new/choose).
|
||||
Read **[CONTRIBUTING.md](CONTRIBUTING.md)** before opening a pull request — it
|
||||
lists the inclusion criteria and what gets closed on sight.
|
||||
Suggest an app, ask for a listing to be removed, corrected or re-checked, or
|
||||
report a bug with an
|
||||
[issue on the GitLab mirror](https://gitlab.com/poli0981/softharbor/-/issues/new)
|
||||
(pick a template) — feature requests are not taken in maintenance mode. Read
|
||||
**[CONTRIBUTING.md](CONTRIBUTING.md)** before opening a pull request — it
|
||||
lists the inclusion criteria and what gets closed on sight. Everyone taking
|
||||
part follows the [Code of Conduct](CODE_OF_CONDUCT.md).
|
||||
|
||||
Something on the site gets in your way — with a keyboard, a screen reader,
|
||||
zoom or a contrast theme? [ACCESSIBILITY.md](ACCESSIBILITY.md) says what we aim
|
||||
for and how reports are handled (the
|
||||
[site statement](https://softharbor.net/legal/accessibility) is in English and
|
||||
Vietnamese).
|
||||
|
||||
Found a security problem? [SECURITY.md](SECURITY.md) — please do not open a
|
||||
public issue.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Thank you to everyone whose suggestion became a listing:
|
||||
|
||||
- [@BlueSkyID666](https://github.com/BlueSkyID666) — Orkas (GitHub issue #65)
|
||||
- [CiselSoft](https://www.ciselsoft.com/) — Cisel Media (#80) and CloneSift
|
||||
(#81), suggested by email
|
||||
- [Aurelio Avila](https://pctweaker.app/) — PC Tweaker (#7), suggested by
|
||||
email
|
||||
|
||||
Issue numbers before 2026-11-24 are the GitHub repository's; its issues did not
|
||||
move to Gitea with the code.
|
||||
|
||||
## Where things live
|
||||
|
||||
Source: [`git.poli0981.dev/poli0981/softharbor`](https://git.poli0981.dev/poli0981/softharbor) (canonical; clone
|
||||
`https://git.poli0981.dev/poli0981/softharbor.git`). Mirror for issues and merge requests:
|
||||
[`gitlab.com/poli0981/softharbor`](https://gitlab.com/poli0981/softharbor).
|
||||
Patches and questions: `code@poli0981.dev`. Security: `security@poli0981.dev`
|
||||
(see [SECURITY.md](SECURITY.md)). The repository moved from GitHub in
|
||||
November 2026; links to `github.com/poli0981/softharbor` no longer lead
|
||||
anywhere.
|
||||
|
||||
## Documentation
|
||||
|
||||
The full specification lives in [`docs/`](docs/) (00–16): architecture, data
|
||||
@@ -85,4 +155,18 @@ AI was used to build this project; where and how is disclosed at
|
||||
|
||||
## Contact
|
||||
|
||||
**contact@softharbor.net** · maintained by [@poli0981](https://github.com/poli0981)
|
||||
Maintained by [poli0981](https://git.poli0981.dev/poli0981). One address per
|
||||
purpose, so a message reaches the right queue:
|
||||
|
||||
| About | Address |
|
||||
| --------------------------------------------------- | -------------------------- |
|
||||
| A vulnerability, or a hijacked or malicious listing | security@poli0981.dev |
|
||||
| Privacy | privacy@poli0981.dev |
|
||||
| An accessibility barrier on the site | accessibility@poli0981.dev |
|
||||
| Terms, disclaimer, other legal | legal@poli0981.dev |
|
||||
| A copyright complaint | dmca@poli0981.dev |
|
||||
| Changing or removing your app's listing or logo | takedown@poli0981.dev |
|
||||
| Licensing of the code or the dataset | copyright@poli0981.dev |
|
||||
| Code of Conduct | code@poli0981.dev |
|
||||
| Press | press@poli0981.dev |
|
||||
| Collaboration | collab@poli0981.dev |
|
||||
@@ -6,10 +6,20 @@ The **latest deploy** of `https://softharbor.net` is the only supported
|
||||
target. This is a continuously deployed static site; there are no released
|
||||
versions to patch (docs/13 §1).
|
||||
|
||||
The project is in **maintenance mode** since 2026-11-15
|
||||
([CONTRIBUTING.md](CONTRIBUTING.md#maintenance-mode)): no new features, but
|
||||
security fixes are part of maintenance, not an exception to it. A dependency
|
||||
with a High or Critical advisory, a serious Node.js security release or an
|
||||
attack on the site is handled out of schedule.
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
Please use **GitHub's private vulnerability reporting** on this repository
|
||||
(Security → Report a vulnerability), or email `contact@softharbor.net`.
|
||||
**Report by e-mail to `security@poli0981.dev` — and do not open a public
|
||||
issue for a security problem, on the GitLab mirror or anywhere else.** E-mail is
|
||||
the only private channel: the repository moved from GitHub to a self-hosted
|
||||
Gitea in November 2026, and GitHub's private vulnerability reporting went with
|
||||
it. A report that arrives as a public GitLab issue is made confidential there
|
||||
and continued by e-mail.
|
||||
|
||||
Acknowledgement within **72 hours**. Machine-readable contact details are in
|
||||
[`/.well-known/security.txt`](https://softharbor.net/.well-known/security.txt).
|
||||
@@ -18,7 +28,7 @@ Acknowledgement within **72 hours**. Machine-readable contact details are in
|
||||
|
||||
**In scope**
|
||||
|
||||
- The site, its build, and its GitHub Actions workflows.
|
||||
- The site, its build, and its Gitea Actions workflows (`.gitea/workflows/`).
|
||||
- **The dataset.** Reports that a listed app is malicious, that a download
|
||||
link has been hijacked or typosquatted, or that an entry points somewhere
|
||||
other than the developer's official page are explicitly welcome — that is
|
||||
@@ -32,8 +42,11 @@ Acknowledgement within **72 hours**. Machine-readable contact details are in
|
||||
- Vulnerabilities in the **listed third-party applications themselves**.
|
||||
Report those to their vendors — but please tell us too, so we can flag the
|
||||
entry while it is unresolved.
|
||||
- Anything requiring a server: there is no backend, no database, no accounts,
|
||||
no cookies, and no user input parsing (docs/09 §3).
|
||||
- Server-side issues beyond the one small Worker: the site is static except
|
||||
for `worker/`, which rate-limits requests (D32) and answers
|
||||
`POST /api/verify`, the legal gate's Turnstile check (D25) — both **are**
|
||||
in scope. There is no database, no accounts and no cookies (docs/09 §3).
|
||||
- An already-compromised Cloudflare, Gitea or GitLab account.
|
||||
|
||||
## What we do not claim
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
|
||||
import { createHash } from 'node:crypto';
|
||||
import { defineConfig } from 'astro/config';
|
||||
import svelte from '@astrojs/svelte';
|
||||
import sitemap from '@astrojs/sitemap';
|
||||
import AstroPWA from '@vite-pwa/astro';
|
||||
import { AstroPWAIntegration } from '@vite-pwa/astro';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import Icons from 'unplugin-icons/vite';
|
||||
import { VIEW_TRANSITION_OPT_IN } from './src/lib/inlineCss';
|
||||
|
||||
// Reachable but meaningless in SERPs — noindex'd (docs/16 §7) AND kept out of
|
||||
// the sitemap, or GSC reports "Submitted URL marked noindex" forever.
|
||||
@@ -31,38 +33,31 @@ export default defineConfig({
|
||||
// html_handling: "drop-trailing-slash" in wrangler.jsonc, /apps/ redirects
|
||||
// to /apps and the canonical URL is the one that serves.
|
||||
trailingSlash: 'never',
|
||||
// `inlineStylesheets: 'never'` is a CSP decision, not a perf one.
|
||||
// `inlineStylesheets: 'never'` began as a CSP fix and stays as a cache one.
|
||||
//
|
||||
// Astro's default inlines small stylesheets, and its CSP hashes them into
|
||||
// the meta tag of the page that carries them. That is fine on a hard load
|
||||
// and broken under `<ClientRouter />`: a soft navigation never re-applies
|
||||
// the meta CSP, so the policy in force stays the one from the page you
|
||||
// STARTED on. Arriving at a page with a style the origin page lacked means
|
||||
// the browser refuses it.
|
||||
//
|
||||
// That is exactly what happened to `/apps`. It alone carried ShAppCard's
|
||||
// scoped CSS — the stretched-link `::after{inset:0}` and `.sr-only` — so
|
||||
// navigating there from any detail page silently dropped the whole-card
|
||||
// click target and unhid screen-reader-only text.
|
||||
//
|
||||
// External stylesheets are covered by `style-src 'self'` with no hash at
|
||||
// all, so every page's policy accepts them and the class of bug disappears.
|
||||
// They also cache once across ~700 pages instead of shipping per page.
|
||||
// Under the former `<ClientRouter />`, a soft navigation never re-applied
|
||||
// the meta CSP, so a small stylesheet Astro had inlined (and hashed into ONE
|
||||
// page's policy) was refused on arrival from any page that lacked it — which
|
||||
// silently dropped ShAppCard's stretched link and `.sr-only` on /apps.
|
||||
// ClientRouter is gone since v1.1 (every navigation is a real document load
|
||||
// with its own policy), but external stylesheets are still the better
|
||||
// shape: covered by `style-src 'self'` with no hash at all, and cached once
|
||||
// across ~700 pages instead of shipping inside each one.
|
||||
build: { format: 'file', inlineStylesheets: 'never' },
|
||||
|
||||
// OFF because the platform refuses it, not because it is unwanted.
|
||||
// `<ClientRouter />` turns prefetching on by default and hovering a link
|
||||
// then issues a speculative GET carrying `Sec-Purpose: prefetch`. Cloudflare
|
||||
// answers those with a bare **503** and the header
|
||||
// `Cf-Speculation-Refused: prefetch refused: disabled for worker requests` —
|
||||
// reproducible on demand, and nothing to do with rate limiting:
|
||||
// OFF because the platform refuses it, not because it is unwanted. A
|
||||
// speculative GET carrying `Sec-Purpose: prefetch` is answered by Cloudflare
|
||||
// with a bare **503** and `Cf-Speculation-Refused: prefetch refused:
|
||||
// disabled for worker requests` — reproducible on demand, and nothing to do
|
||||
// with rate limiting:
|
||||
//
|
||||
// curl -I -H 'Sec-Purpose: prefetch' https://softharbor.net/apps → 503
|
||||
// curl -I https://softharbor.net/apps → 200
|
||||
//
|
||||
// So every hover cost a failed request and a red console line while
|
||||
// delivering no prefetch at all. Real navigations were never affected.
|
||||
// Revisit if Cloudflare ever allows speculation on Worker routes.
|
||||
// So prefetching would cost a failed request and a red console line per
|
||||
// hover while delivering nothing. (The zone's Speed Brain feature hits the
|
||||
// same refusal and should be off — docs/16 §9.) Revisit if Cloudflare ever
|
||||
// allows speculation on Worker routes.
|
||||
prefetch: false,
|
||||
|
||||
i18n: {
|
||||
@@ -85,12 +80,35 @@ export default defineConfig({
|
||||
"default-src 'self'",
|
||||
"img-src 'self' data:",
|
||||
"font-src 'self'",
|
||||
"connect-src 'self'",
|
||||
// Cloudflare Web Analytics posts its beacon to cloudflareinsights.com
|
||||
// (src/scripts/analytics.js; skipped under GPC).
|
||||
"connect-src 'self' https://cloudflareinsights.com",
|
||||
// The Turnstile widget is an iframe (legal gate step 2, after consent).
|
||||
'frame-src https://challenges.cloudflare.com',
|
||||
"manifest-src 'self'",
|
||||
"base-uri 'none'",
|
||||
"form-action 'none'",
|
||||
"object-src 'none'",
|
||||
],
|
||||
// The two third-party script origins, both loaded by our own code
|
||||
// rather than by markup: the analytics beacon (src/scripts/analytics.js)
|
||||
// and Turnstile's api.js (src/lib/turnstile.ts). `resources` REPLACES
|
||||
// Astro's default, so 'self' must be listed or every same-origin
|
||||
// script — islands included — is refused (docs/09 §4).
|
||||
scriptDirective: {
|
||||
resources: [
|
||||
"'self'",
|
||||
'https://static.cloudflareinsights.com',
|
||||
'https://challenges.cloudflare.com',
|
||||
],
|
||||
},
|
||||
// The one `is:inline` <style> (src/lib/inlineCss.ts) — Astro hashes
|
||||
// only what it bundles, so this hash is ours to supply.
|
||||
styleDirective: {
|
||||
hashes: [
|
||||
`sha256-${createHash('sha256').update(VIEW_TRANSITION_OPT_IN).digest('base64')}` as const,
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -100,7 +118,16 @@ export default defineConfig({
|
||||
i18n: { defaultLocale: 'en', locales: { en: 'en', vi: 'vi' } },
|
||||
filter: (page) => !NON_INDEXED.test(page),
|
||||
}),
|
||||
AstroPWA({
|
||||
// @vite-pwa/astro 2 (on @unplugin-pwa) since 2026-11-09. Under pnpm it
|
||||
// needs four packages as DIRECT dependencies. Without `rolldown` or
|
||||
// `magicast` the SW build stops with an error. Without
|
||||
// `@vite-pwa/workbox-swkit` the classic sw.js keeps bare ES imports and an
|
||||
// empty precache; without `@vite-pwa/workbox-window` registerSW.js starts
|
||||
// with an ES import the page cannot run as a classic script — and in both
|
||||
// cases the build reports success (docs/09 §7; `check:sw` catches them).
|
||||
// The two workbox packages must resolve to the version
|
||||
// @vite-pwa/workbox-build pins (`pnpm why @vite-pwa/workbox-swkit`).
|
||||
AstroPWAIntegration({
|
||||
registerType: 'autoUpdate',
|
||||
// MUST be explicit. Without it the build still emits registerSW.js but
|
||||
// never references it from any page, so the service worker never
|
||||
@@ -110,41 +137,80 @@ export default defineConfig({
|
||||
// plus hashes Astro generates, and a PWA-injected inline snippet is not
|
||||
// one of them (docs/09 §4, D20).
|
||||
injectRegister: 'script',
|
||||
// Unminified on purpose: `check:sw` asserts the SW by the names in it
|
||||
// (NetworkOnly, precacheAndRoute, skipWaiting), which minification
|
||||
// mangles. Cost: ~1.6 kB sw.js plus a ~38 kB workbox runtime chunk,
|
||||
// both compressed in transit.
|
||||
minify: false,
|
||||
// 1.x never precached the manifest icons; 2.x defaults to doing so.
|
||||
// Keep the precache to what the offline page needs (16 entries).
|
||||
includeManifestIcons: false,
|
||||
manifest: {
|
||||
id: '/',
|
||||
name: 'SoftHarbor',
|
||||
short_name: 'SoftHarbor',
|
||||
description: 'Free & buy-once desktop software, one page.',
|
||||
theme_color: '#f7f4ee',
|
||||
background_color: '#f7f4ee',
|
||||
// The existing SVG, used as-is. A single scalable icon covers every
|
||||
// size, and `purpose: 'any maskable'` lets platforms that crop to a
|
||||
// shape do so without a separate asset. Browsers with no SVG-manifest
|
||||
// support simply fall back to the favicon — strictly better than the
|
||||
// empty array that shipped in M5, which suppressed the install prompt
|
||||
// entirely. Raster PNGs remain the eventual upgrade (docs/13 §2).
|
||||
lang: 'en',
|
||||
// The tile colour of the mark (scripts/gen-icons.mjs), so the install
|
||||
// splash and title bar match the icon rather than the page.
|
||||
theme_color: '#0B4F7A',
|
||||
background_color: '#0B4F7A',
|
||||
// Raster icons generated from one vector mark (`pnpm icons`). Until
|
||||
// v1.1 the only icon was the SVG favicon drawn in currentColor —
|
||||
// black in launchers — declared 'any maskable' with no safe zone.
|
||||
icons: [
|
||||
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
|
||||
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any' },
|
||||
{
|
||||
src: '/favicon.svg',
|
||||
sizes: 'any',
|
||||
type: 'image/svg+xml',
|
||||
purpose: 'any maskable',
|
||||
src: '/icons/maskable-512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
purpose: 'maskable',
|
||||
},
|
||||
{ src: '/favicon.svg', sizes: 'any', type: 'image/svg+xml', purpose: 'any' },
|
||||
],
|
||||
},
|
||||
workbox: {
|
||||
// `generateSW` (1.x called it `workbox`; the old key still works but is
|
||||
// deprecated).
|
||||
generateSW: {
|
||||
// These globs are coupled to build.format — 'file' emits offline.html,
|
||||
// 'directory' would emit offline/index.html. And fonts are
|
||||
// content-hashed into _astro/, never a /fonts/ directory. Both of the
|
||||
// original patterns ('offline/**', 'fonts/*.woff2') matched nothing,
|
||||
// which is a silent failure: the build succeeds and the offline page
|
||||
// simply is not there (found in M1 and S5).
|
||||
globPatterns: ['offline.html', '_astro/*.woff2', 'favicon.svg'],
|
||||
//
|
||||
// What the offline page actually needs, and nothing more:
|
||||
// - its stylesheets. Missing until v1.1 — once inlineStylesheets went
|
||||
// 'never', /offline linked CSS the SW never cached, so it rendered
|
||||
// unstyled exactly when it was needed;
|
||||
// - the two pre-paint scripts it loads (errors.js, theme.js);
|
||||
// - the latin + Vietnamese body and display faces. Precaching all 13
|
||||
// font files (211 KB, latin-ext and mono included) on a visitor's
|
||||
// first page view was a lot of bandwidth for a fallback page; the
|
||||
// rest falls back to system fonts.
|
||||
globPatterns: [
|
||||
'offline.html',
|
||||
'_astro/*.css',
|
||||
'_astro/{errors,theme,analytics}.*.js',
|
||||
'_astro/be-vietnam-pro-{latin,vietnamese}-400-normal.*.woff2',
|
||||
'_astro/bricolage-grotesque-{latin,vietnamese}-wght-normal.*.woff2',
|
||||
'favicon.svg',
|
||||
],
|
||||
|
||||
// skipWaiting is already true under registerType 'autoUpdate', but
|
||||
// clientsClaim is not — without it the SW controls only pages loaded
|
||||
// AFTER activation, so a first-time visitor who loses connection mid
|
||||
// A new SW takes over as soon as it is installed. registerSW.js never
|
||||
// posts SKIP_WAITING, so without this a fixed SW waited until every
|
||||
// SoftHarbor tab was closed (an older comment here wrongly claimed
|
||||
// 'autoUpdate' implied it).
|
||||
skipWaiting: true,
|
||||
// Without clientsClaim the SW controls only pages loaded AFTER
|
||||
// activation, so a first-time visitor who loses connection mid
|
||||
// session gets the browser's error page instead of ours (S5).
|
||||
clientsClaim: true,
|
||||
// Explicit since 2.x: 1.x emitted cleanupOutdatedCaches() by default,
|
||||
// 2.x does not, so caches left by older Workbox precache formats would
|
||||
// stay on visitors' disks.
|
||||
cleanupOutdatedCaches: true,
|
||||
|
||||
// `navigateFallback: ''` DISABLES it. Leaving the key out does not:
|
||||
// vite-plugin-pwa's `defaultWorkbox` sets `navigateFallback:
|
||||
@@ -179,9 +245,9 @@ export default defineConfig({
|
||||
],
|
||||
|
||||
vite: {
|
||||
plugins: [tailwindcss(), Icons({ compiler: 'astro' })],
|
||||
// `~icons/<set>/<name>` imports compile to Svelte 5 components: usable in
|
||||
// islands, and in .astro files (rendered to static SVG at build time).
|
||||
// Data-driven icons (app logos, category icons) go through src/lib/icon.ts.
|
||||
plugins: [tailwindcss(), Icons({ compiler: 'svelte' })],
|
||||
},
|
||||
|
||||
// No CSP config: nothing inline ships, so `script-src 'self'` in
|
||||
// public/_headers is the whole story — docs/09 §4, decision D18.
|
||||
});
|
||||
@@ -1,9 +1,10 @@
|
||||
# 00 — Project Overview
|
||||
|
||||
> **Project:** SoftHarbor
|
||||
> **Doc suite version:** 1.2 (2026-07-27)
|
||||
> **Doc suite version:** 4.0 (2026-11-24, site v1.5.0)
|
||||
> **Author:** poli0981 / SkullMute · **License:** code GPL-3.0-only · data CC BY-SA 4.0
|
||||
> **Platform:** Web (static), Cloudflare Workers Static Assets, canonical `https://softharbor.net`
|
||||
> — plus one Worker: the site-wide rate limit (D32) and `POST /api/verify` (D25)
|
||||
|
||||
## 1. Elevator pitch
|
||||
|
||||
@@ -30,8 +31,14 @@ is a curated map, not a mirror.
|
||||
3. **Trust through transparency, not promises.** License is shown as an SPDX
|
||||
badge when open source; security status is shown as *"no known warnings —
|
||||
checked <date>"*, never as a guarantee.
|
||||
4. **Zero tracking.** No analytics, no cookies, no third-party requests in
|
||||
v1. localStorage holds only user preferences.
|
||||
4. **No tracking of individuals.** No cookies, no ads, no accounts, nothing
|
||||
sold. *(v1.0 said "no analytics, no third-party requests"; amended
|
||||
2026-10-21.)* The only third-party requests are two Cloudflare services,
|
||||
both started by our own code and disclosed in the Privacy Policy:
|
||||
cookieless Web Analytics, which never loads under Global Privacy Control
|
||||
(D26), and the legal gate's Turnstile check, loaded only after the
|
||||
documents are accepted (D25). localStorage holds preferences and the
|
||||
gate's two records only (docs/09 §8).
|
||||
5. **Fast and tiny.** Static HTML, one small search island, self-hosted
|
||||
fonts. Target: < 80 KB JS on `/apps`, LCP < 1.5 s on mid-range mobile.
|
||||
6. **Bilingual parity.** EN and VI are equal citizens — every string, every
|
||||
@@ -79,37 +86,50 @@ consistent over time.
|
||||
| D4 | Data license | **CC BY-SA 4.0** (`src/data/**`) | 2026-07-15 | Copyleft spirit for the curated dataset; see docs/14 §1 |
|
||||
| D5 | Framework | Astro 7 static + Svelte 5 islands | 2026-07-15 | Zod-validated content collections, built-in i18n routing, ~0 JS baseline |
|
||||
| D6 | Styling | Tailwind CSS 4.3.x | 2026-07-15 | Current stable line |
|
||||
| D7 | Runtime | Node 24 LTS (Krypton) | 2026-07-15 | Active LTS; Node 26 not LTS until 2026-10 |
|
||||
| D7 | Runtime | Node 24 LTS (Krypton) — *amended 2026-10-23: **Node 26** (`.nvmrc` `26`, engines `>=26 <27`, `@types/node` 26), taken five days before its LTS promotion on 2026-10-28 at the owner's request; Node 24 entered maintenance on 2026-10-20* | 2026-07-15 | Active LTS; Node 26 not LTS until 2026-10 |
|
||||
| D8 | Search | MiniSearch, client-side, VN-insensitive normalizer | 2026-07-15 | Lightweight; dataset ≤ ~1 000 entries |
|
||||
| D9 | Fonts | Bricolage Grotesque (display) · Be Vietnam Pro (body) · IBM Plex Mono (badges) | 2026-07-15 | All ship Vietnamese subsets; distinctive, non-generic |
|
||||
| D10 | Security field | `status/evidence/checkedAt` model — never boolean "virus: no" | 2026-07-15 | Legal defensibility; honesty |
|
||||
| D11 | Flagged handling | Quarantine folder + issue, never delete | 2026-07-15 | Audit trail, restorable |
|
||||
| D12 | Legal gate | First-visit overlay, `sh:legal` versioned in localStorage | 2026-07-15 | CommandForge pattern adapted to web |
|
||||
| D12 | Legal gate | First-visit overlay, `sh:legal` versioned in localStorage — *amended 2026-10-21: a second step, the Turnstile human check (D25), `sh:human`* | 2026-07-15 | CommandForge pattern adapted to web |
|
||||
| D13 | Locale routing | `en` default unprefixed, `vi` at `/vi/…`, **no auto-redirect** | 2026-07-15 | SEO-safe; a dismissible banner suggests VI instead (docs/07 §5) |
|
||||
| D14 | Analytics | None in v1 | 2026-07-15 | Simplest honest privacy policy |
|
||||
| D14 | Analytics | None in v1 | 2026-07-15 | ⛔ **superseded 2026-10-21 by D26** — Simplest honest privacy policy |
|
||||
| D15 | Cross-island state | nanostores — **`nanostores` alone** (amended 2026-07-27: `@nanostores/svelte` does not exist and is not needed; atoms already satisfy Svelte's store contract) | 2026-07-27 | Astro-recommended, ~1 KB |
|
||||
| D16 | `developer` field | **Required** in the schema and rendered on the detail page | 2026-07-27 | Lets a reader match "who makes this" against the domain they're about to click — the same trust proposition as "official links only" (docs/04 §2, docs/06 §5) |
|
||||
| D17 | Package manager | **pnpm 10** kept, though sibling org projects use npm | 2026-07-27 | `reusable-web-react.yml` accepts `package-manager: pnpm`, so nothing is lost; docs/09 §7's `ignore-scripts` + `--frozen-lockfile` posture stays intact |
|
||||
| D17 | Package manager | **pnpm 10** kept, though sibling org projects use npm — *amended: the line is **pnpm 11** since P1 (`packageManager: pnpm@11.15.1`); `ignore-scripts` was dropped for `allowBuilds` (docs/09 §7)* | 2026-07-27 | `reusable-web-react.yml` accepts `package-manager: pnpm`, so nothing is lost; docs/09 §7's `ignore-scripts` + `--frozen-lockfile` posture stays intact |
|
||||
| D18 | CSP / inline scripts | Zero inline scripts → plain `script-src 'self'` | 2026-07-27 | ⛔ **superseded by D20 the same week** — S1 proved it unachievable: Astro's island hydration emits inline scripts on any page with a `client:*` directive |
|
||||
| D20 | CSP (actual) | **Split policy.** `script-src`/`style-src` come from Astro's `security.csp` per-page `<meta>` with generated hashes; `_headers` carries **only** `frame-ancestors 'none'` | 2026-07-27 | Header CSP and meta CSP are enforced as two policies and a resource must pass both — so `_headers` must not also declare script-src or the intersection kills Astro's hashes. Theme snippet still externalised to `public/theme.js`. Verified by recomputing every inline hash against the emitted policy (docs/09 §4) |
|
||||
| D21 | TypeScript major | **Hold at 6.x**; do not adopt TS 7 | 2026-07-27 | TS 7's native compiler does not expose the API `astro check` needs, so `pnpm check` fails on it (docs/01 §2) |
|
||||
| D20 | CSP (actual) | **Split policy.** `script-src`/`style-src` come from Astro's `security.csp` per-page `<meta>` with generated hashes; `_headers` carries **only** `frame-ancestors 'none'` — *amended 2026-10-21: the meta tag is moved first in `<head>`, the head scripts are hashed `/_astro/` files from `src/scripts/`, the policy adds exactly the two Cloudflare origins of D25/D26 and one style hash, and `check:csp` gates the build* | 2026-07-27 | Header CSP and meta CSP are enforced as two policies and a resource must pass both — so `_headers` must not also declare script-src or the intersection kills Astro's hashes. Theme snippet still externalised to `public/theme.js` (since v1.1: `src/scripts/theme.js`). Verified by recomputing every inline hash against the emitted policy (docs/09 §4) |
|
||||
| D21 | TypeScript major | **Hold at 6.x**; do not adopt TS 7 — *amended 2026-10-23: TS 6 and TS 7 side by side. `typescript` is the `@typescript/typescript6` wrapper — the TS 6 API that `astro check`, typescript-eslint and svelte2tsx load — and `@typescript/native` is TS 7, whose `tsc --noEmit` checks every `.ts` file in `pnpm check` (docs/01 §2)* | 2026-07-27 | TS 7's native compiler does not expose the API `astro check` needs, so `pnpm check` fails on it (docs/01 §2) |
|
||||
| D22 | Search fuzziness | `FUZZY = 0.25`; the `gmip → GIMP` vector is retired | 2026-07-27 | Measured, not guessed: `gmip` needs 2 edits on 4 chars (fuzzy ≥ 0.375), and at that setting the *correctly spelled* query `gimp` stops being exact. Precision on correct spellings beats one contrived typo (docs/05 §A2) |
|
||||
| D19 | Suite correctness | Spec claims about external systems are **verified against the real system** before they enter the docs | 2026-07-27 | The 2026-07-27 audit found two ops-repo workflows that never existed and four stale tool majors — all cheap to catch on paper, all expensive to catch in CI |
|
||||
| D23 | Logo fallback | Third `logo` form `monogram` (initials) when no brand mark is available | 2026-07-29 | Simple Icons covers only part of the catalogue; docs/14 §3d sanctions no other source than the vendor's own assets (docs/15 §4) |
|
||||
| D24 | Seed import | The seed batch was exempt from one-app-per-PR | 2026-07-29 | 286 machine-uniform files; the rule resumes for every later entry (docs/15 §4) |
|
||||
| D25 | Server code | **One Worker, for `POST /api/verify` only** (amends hard rule 1): the legal gate's step 2 — Turnstile after acceptance, token checked server-side, rate-limited, everything fails **open**; `run_worker_first` keeps pages and assets on the unbilled asset path — *amended 2026-10-26 by D32: the Worker now runs first for pages, feeds and data too, for the site-wide rate limit; content-hashed assets stay asset-first* | 2026-10-21 | Consent-first human check on a public site without ever locking a person out (docs/09 §4a, docs/08 Part E) |
|
||||
| D26 | Analytics | **Cloudflare Web Analytics, honouring Global Privacy Control** (supersedes D14; amends hard rule 7): cookieless beacon, never under GPC, production host only | 2026-10-21 | Knowing whether the site works and is used, with the least data and a privacy signal honoured (docs/09 §8) |
|
||||
| D27 | Contacts | **One address per purpose at `@poli0981.dev`** — `src/lib/contacts.ts`; `contact@softharbor.net` retired; mail hosted by Google | 2026-10-21 | A message reaches the right queue; `sponsor@` deliberately unused (docs/14 Part 2) |
|
||||
| D28 | Toolchain | **Node 26 + TypeScript 6/7 side by side** (amends D7 and D21) — `.nvmrc` 26; `typescript` = the `@typescript/typescript6` API wrapper, `@typescript/native` = TS 7, whose `tsc --noEmit` now type-checks every `.ts` file in `pnpm check` | 2026-10-23 | Node 24 entered maintenance 2026-10-20; TS 7 ships no API yet, which astro check, typescript-eslint and svelte2tsx need (docs/01 §2) |
|
||||
| D32 | Rate limiting | **Site-wide rate limit in the Worker** (amends hard rule 1 and D25): `run_worker_first` is `/*` minus the files a page loads (`/_astro/*`, icons, service worker); every request it routes spends one unit of `SITE_LIMITER` — 60 per 10 s per IPv4 or IPv6 /64, per location — and over it gets the branded `/errors/429` page (JSON under `/api/`), `Retry-After: 10`; fails **open** | 2026-10-26 | A flood or a runaway scraper gets refused cheaply with our own page instead of the Free zone's default; configured and tested in the repo (wrangler.jsonc, e2e/worker.spec.ts), not in a dashboard (docs/08 Part F) |
|
||||
| D29 | Code analysis | ~~**SonarQube Cloud CI-based analysis with coverage** (`ci.yml` `sonar` job, not a required check)~~ — **superseded 2026-11-24 by D38**: SonarQube Cloud left with GitHub | 2026-10-23 | Automatic Analysis cannot import coverage; a CI scan measured the same lcov the ratchet gates (docs/12 §2, docs/11 §1) |
|
||||
| D33 | Accessibility | **WCAG 2.2 AA as a target, never a conformance claim**; `ACCESSIBILITY.md` + its twin `/legal/accessibility`; contact `accessibility@`; the "/" shortcut can be turned off (`sh:keys`, WCAG 2.1.4) | 2026-11-09 | GitHub's community profile asked for it, and an audit found barriers the manual pass did not (focus on the checked display choice, the header at 320 px, forced colours); axe now fails on moderate findings and covers the open dialogs (docs/15 D33) |
|
||||
| D35 | Code analysis | **Qodana as an analyser** (beside CodeQL and SonarQube Cloud until D38; beside the ops Opengrep SAST since): `qodana-js` (Ultimate licence) in native mode, profile `qodana.recommended`, any finding fails the job; since D38 through the ops `reusable-qodana.yml`, findings in Qodana Cloud — **not a required check** (`qodana.yml`, `qodana.yaml`) | 2026-11-15 | WebStorm's inspections catch a different class of problem than CodeQL (security) and Sonar (maintainability); not required for D29's reason — an outside service must never block a merge |
|
||||
| D38 | Forge & CI | **The repository lives on the owner's Gitea** (`git.poli0981.dev`), CI is Gitea Actions on the owner's runner, issues and merge requests come through the GitLab mirror, production deploys from the CI `deploy` job (`wrangler deploy`, no PR previews), Renovate replaces Dependabot, the ops `security.yml` (gitleaks, Opengrep, osv-scanner) replaces CodeQL; SonarQube Cloud dropped | 2026-11-24 | The GitHub account was suspended in November 2026, taking the repository, Workers Builds' source, CodeQL and Dependabot with it; every repository of the owner moved by one runbook (`poli0981/.github` `docs/GITEA-MIGRATION.md`; docs/12) |
|
||||
| D36 | Project status | **Maintenance mode** — maintained, not extended: catalogue work, bug, UI/UX and accessibility fixes, dependency upkeep (out of schedule for a High or Critical advisory or a serious Node.js security release), major language and platform updates, incidents; **new features are not accepted** and docs/15 §2's feature items are frozen | 2026-11-15 | The site does what it set out to do; review time belongs to the catalogue's accuracy, which is the product |
|
||||
|
||||
## 6. Identifiers (locked)
|
||||
|
||||
| Identifier | Value |
|
||||
|---|---|
|
||||
| Repo slug | `poli0981/softharbor` |
|
||||
| Repo slug | `poli0981/softharbor` — `https://git.poli0981.dev/poli0981/softharbor` (Gitea, canonical since D38); public mirror `https://gitlab.com/poli0981/softharbor` |
|
||||
| Canonical origin | `https://softharbor.net` (apex; `www` 301s to it) |
|
||||
| Worker name | `softharbor` (workers.dev route disabled; versioned preview URLs only — docs/16 §3) |
|
||||
| Contact email | `contact@softharbor.net` via Cloudflare Email Routing (docs/16 §6) |
|
||||
| Component prefix | `Sh*` |
|
||||
| Worker name | `softharbor` — code in `worker/`: the site-wide rate limit (D32) and one endpoint, `POST /api/verify` (D25); workers.dev route disabled; no preview versions since D38 (docs/16 §3) |
|
||||
| Contact email | One address per purpose at `@poli0981.dev` — `src/lib/contacts.ts`, page `/contact` (D27; `contact@softharbor.net` retired) |
|
||||
| Component prefix | `Sh*` (islands: `ShLegalGate`, `ShSearch`, `ShFilterSheet`, `ShLangSwitch`, `ShPrefs`, `ShBugReport`) |
|
||||
| CSS custom property prefix | `--sh-*` |
|
||||
| localStorage keys | `sh:legal`, `sh:lang`, `sh:theme` |
|
||||
| localStorage keys | `sh:legal`, `sh:human`, `sh:lang`, `sh:theme`, `sh:scrollbar`, `sh:motion`, `sh:keys` |
|
||||
| App data path | `src/data/apps/<slug>.json` (filename = slug) |
|
||||
| Quarantine path | `data/quarantine/<slug>.json` |
|
||||
| Public data endpoints | `/api/apps.json`, `/rss.xml`, `/sitemap-index.xml` |
|
||||
| Runtime secret | `TURNSTILE_SECRET` (Worker runtime secret, never in the repo — docs/08 Part E) |
|
||||
|
||||
## 7. Non-goals (v1)
|
||||
|
||||
@@ -118,7 +138,11 @@ binary · automatic scraping of vendor metadata (all entries are hand-written)
|
||||
· mobile-app listings · package-manager command snippets (winget/brew —
|
||||
post-v1 backlog) · zone security add-ons kept deliberately OFF at launch:
|
||||
rate limiting, Bot Fight Mode, paid Custom Errors (reasons & activation
|
||||
recipes in docs/16 §9) · a third locale (JP is a v1.2 candidate, docs/15).
|
||||
recipes in docs/16 §9 — the Worker's own rate limits, site-wide since
|
||||
D32, are not a zone feature) · server-rendered or gated pages of any kind
|
||||
(D25 allows one verification endpoint and D32 one rate limit, nothing
|
||||
more: a flood gets a 429, a person reading never does) · a third
|
||||
locale (JP is a v1.2 candidate, docs/15).
|
||||
|
||||
## 8. Document map
|
||||
|
||||
@@ -129,13 +153,16 @@ See `CLAUDE.md` for the full table. Reading order for a new contributor:
|
||||
|
||||
| # | Action | Needed by |
|
||||
|---|---|---|
|
||||
| H1 | Create repo `poli0981/softharbor`, default branch `main`, add GPL-3.0 LICENSE via GitHub picker | P1 |
|
||||
| H1 | Create repo `poli0981/softharbor`, default branch `main`, add GPL-3.0 LICENSE via GitHub picker — the GitHub repository went with the suspended account; since 2026-11-24 the repository is on Gitea (D38) | P1 |
|
||||
| H2 | Onboard the `softharbor.net` zone: add to Cloudflare (Free plan), set nameservers at the registrar (skip if Cloudflare Registrar), enable DNSSEC + transfer lock + auto-renew (docs/16 §2) | P1 |
|
||||
| H3 | Create Cloudflare API token ("Edit Cloudflare Workers" template) and add `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` repo secrets | P6 |
|
||||
| H4 | Enable GitHub *Private vulnerability reporting* + *Issues* on the repo | P6 |
|
||||
| H5 | Set up Email Routing → `contact@softharbor.net` + DMARC record, then fill `<contact-email>` in docs/14 drafts and security.txt (docs/16 §6) | P6 |
|
||||
| H6 | Review & approve all legal drafts in docs/14 before first public deploy | P6 |
|
||||
| H3 | Cloudflare API token (Workers Scripts → Edit) as **user-level** Gitea Actions secrets `CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` — retired 2026-07-28 while Workers Builds deployed, **needed again since D38** (the CI `deploy` job, docs/12 §3) — ✅ set 2026-11-23 | v1.5 |
|
||||
| H4 | ~~Enable GitHub *Private vulnerability reporting* + *Issues*~~ — gone with GitHub; since D38 security reports are e-mail only (`security@`, SECURITY.md) and issues go to the GitLab mirror (set its notifications to **Watch**) | P6 |
|
||||
| H5 | ~~Set up Email Routing → `contact@softharbor.net` + DMARC~~ — **superseded 2026-10-21 by D27**: purpose addresses at `@poli0981.dev`, Google-hosted. Still open: decide whether softharbor.net keeps its Email Routing records (docs/16 §6) | v1.1 |
|
||||
| H6 | Review & approve all legal drafts in docs/14 before first public deploy — ✅ 2026-07-28; sign-off on the 2026-10-21 rewrite ⚠ verify (docs/14 Part 4) | P6 / v1.1 |
|
||||
| H7 | Approve the seed list — **326 apps imported 2026-07-29** (docs/13 §4, D24) | P6 |
|
||||
| H8 | Create the GSC **Domain property** for `softharbor.net` (DNS TXT verify) + enable Crawler Hints; submit sitemap & import to Bing at launch (docs/16 §8) | P6 |
|
||||
| H9 | Decide on HSTS phase P3 (`preload` submission — semi-irreversible, docs/16 §5) | post-launch |
|
||||
| H10 | Enable *Settings → Actions → General → **Allow GitHub Actions to create and approve pull requests*** — without it the nightly quarantine sweep cannot open its PR and hard rule 5 stops being enforced mechanically (docs/12 §4) | P6 |
|
||||
| H8 | Create the GSC **Domain property** for `softharbor.net` (DNS TXT verify) + enable Crawler Hints; submit sitemap & import to Bing at launch (docs/16 §8) — the verification TXT is published (observed 2026-10-21); the rest ⚠ verify | P6 |
|
||||
| H9 | Decide on HSTS phase P3 (`preload` submission — semi-irreversible, docs/16 §5) — the header already carries `preload` (observed 2026-10-21, docs/15 §5) | post-launch |
|
||||
| H10 | ~~Allow GitHub Actions to create and approve pull requests~~ — gone with GitHub. Since D38: Gitea **branch protection** on `main` (checks `CI / build (*)` and `CI / gates (*)`, no force push or deletion, owner-only push, signed commits **not** required) and the labels the bots use (`quarantine`, `link-rot`, `security`), docs/12 §4, §8 | v1.5 |
|
||||
| H11 | Set the Worker's runtime secret **`TURNSTILE_SECRET`** (dashboard → Variables and Secrets, or `wrangler secret put`) — without it every check answers 503 and the gate silently fails open for everyone (docs/08 Part E) — ✅ set (verified 2026-10-21: a junk token gets `403 rejected`); redo whenever the Worker is re-created | v1.1 |
|
||||
| H12 | Turn the zone's **Speed Brain** off — Cloudflare refuses speculative prefetch on Worker requests (503); production still sent a `Speculation-Rules` header on 2026-10-21 (docs/16 §9) | v1.1 |
|
||||
| H13 | **Recommended:** deploy the zone **rate-limiting rule as layer 1** in front of the Worker's limit — one rule, URI Path starts with `/` and not a verified bot, 150 requests per 10 s per IP, Block 10 s (step-by-step and a verification command: docs/16 §9.1). It is the layer that stops a many-connection flood, which the Worker's per-machine counters mostly miss (docs/08 Part F), and it blocks before the Worker is billed; nothing in the repository depends on it | v1.3 |
|
||||
@@ -1,8 +1,10 @@
|
||||
# 01 — Tech Stack (verified 2026-07-15 · re-verified 2026-07-27)
|
||||
# 01 — Tech Stack (verified 2026-07-15 · re-verified 2026-07-27 · updated 2026-10-21)
|
||||
|
||||
> All version lines below were checked against upstream release channels on
|
||||
> **2026-07-15**. Install the latest patch within each stated line. Renovate
|
||||
> keeps them current afterwards (§5).
|
||||
> **2026-07-15**. Install the latest patch within each stated line.
|
||||
> Renovate keeps them current afterwards (§5) — the owner's self-hosted
|
||||
> Renovate on Gitea since 2026-11-24 (D38); Dependabot did it from 2026-10-21
|
||||
> until the GitHub account was suspended.
|
||||
>
|
||||
> **Re-verified 2026-07-27** against `E:\poli0981-dev\package.json` — the
|
||||
> org's closest sibling project, already shipping Astro 7 on Cloudflare
|
||||
@@ -10,29 +12,83 @@
|
||||
> **TypeScript, ESLint, lefthook and knip were all a major behind** and have
|
||||
> been corrected below. Prefer that project's `package.json` as the reference
|
||||
> when scaffolding — it is a working install, not a claim.
|
||||
>
|
||||
> **Installed at v1.1 (2026-10-21, from `node_modules`):** Node 24.19 ·
|
||||
> pnpm 11.15.1 · Astro 7.4.1 · Svelte 5.57.2 · `@astrojs/svelte` 9.1.0 ·
|
||||
> Tailwind 4.3.3 · TypeScript 6.0.3 · MiniSearch 7.2.0 · nanostores 1.5.5 ·
|
||||
> `@vite-pwa/astro` 1.2.0 · `unplugin-icons` 24.0.0 · Vitest 5.0.5 ·
|
||||
> Playwright 1.64.1 · `@axe-core/playwright` 4.14.0 · happy-dom 21.0.3 ·
|
||||
> Wrangler 4.151.3 · ESLint 10.13 · `typescript-eslint` 8.72 · Prettier
|
||||
> 3.9 · knip 6.42 · lefthook 2.2.2. `package.json` is the authority; this
|
||||
> line is a snapshot.
|
||||
>
|
||||
> **Changed for v1.2 (2026-10-23):** Node 26.12 · `@types/node` 26.6 ·
|
||||
> TypeScript 7.0.2 (`tsc`, as `@typescript/native`) beside 6.0.3 (the API, via
|
||||
> `@typescript/typescript6` 6.0.2) · SonarScanner CLI 8.2 through
|
||||
> `sonarqube-scan-action` 8.3.
|
||||
>
|
||||
> **Upkeep 2026-11-04:** pnpm 11.28.9 · Astro 7.4.5 · Svelte 5.57.3 ·
|
||||
> `@astrojs/svelte` 9.1.2 · Tailwind 4.3.4 · Vitest 5.1.0 · Wrangler 4.156 ·
|
||||
> ESLint 10.14 · `typescript-eslint` 8.72.1 · knip 6.44 · `pnpm/action-setup`
|
||||
> 6.1.1 · `sonarqube-scan-action` 8.4.1 (CLI 8.3.1). `@vite-pwa/astro` stays
|
||||
> on 1.2.0 — 2.0.0 was tried and refused (docs/09 §7) — and pnpm stays on
|
||||
> the 11 line although 12 is out: a pnpm major is a decision, not an upkeep
|
||||
> bump.
|
||||
>
|
||||
> **Upkeep 2026-11-09:** pnpm 11.28.11 · Astro 7.4.7 (Rolldown 1.3.0) ·
|
||||
> Tailwind 4.3.5 · Wrangler 4.158 · Playwright 1.65.0 · knip 6.44.2 ·
|
||||
> `eslint-plugin-svelte` 3.24.1 · **`@vite-pwa/astro` 2.0.1** (on
|
||||
> `@unplugin-pwa` 0.0.4 and `@vite-pwa/workbox-*` 8.0.14), which needs
|
||||
> `rolldown`, `magicast`, `@vite-pwa/workbox-swkit` and
|
||||
> `@vite-pwa/workbox-window` as direct devDependencies under pnpm (docs/09 §7)
|
||||
> and drops workbox-build 7 with ~270 transitive packages. Node 26.13.0 is the
|
||||
> newest 26.x (LTS since 2026-10-28).
|
||||
>
|
||||
> **Upkeep 2026-11-16:** pnpm 11.28.12 (a security release) · Astro 7.4.12
|
||||
> (Rolldown 1.3.2) · `@astrojs/svelte` 9.1.6 · `@vite-pwa/astro` 2.0.2
|
||||
> (`@vite-pwa/workbox-*` 8.0.15) · Wrangler 4.162 · Playwright 1.65.1 ·
|
||||
> ESLint 10.15 · `typescript-eslint` 8.72.2 · Prettier 3.10 · knip 6.45 ·
|
||||
> `sonarqube-scan-action` 8.5.0 (CLI 8.4.0) · `osv-scanner-action` 2.7.1 ·
|
||||
> `create-pull-request` 8.1.3. Node 26.13.1 (a security release, 2026-11-10)
|
||||
> reaches CI and Workers Builds by itself through `.nvmrc` = `26`.
|
||||
>
|
||||
> **Forge move 2026-11-24 (D38):** CI on Gitea Actions; SonarQube Cloud, the
|
||||
> SonarScanner pin, CodeQL, `osv-scanner-action` (now the pinned osv-scanner
|
||||
> 2.7.1 binary), `create-pull-request` and `upload-artifact` (now
|
||||
> `christopherhx/gitea-upload-artifact` v4) left the workflows; Qodana runs
|
||||
> the CLI 2026.3.1 through the ops `reusable-qodana.yml`.
|
||||
>
|
||||
> **Upkeep 2026-11-24:** pnpm 11.29.0 · Astro 7.4.13 (Rolldown 1.3.3) ·
|
||||
> Svelte 5.59.1 · `@vite-pwa/astro` 2.0.4 · Wrangler 4.166 · Vitest 5.1.1 ·
|
||||
> `typescript-eslint` 8.73 · knip 6.48 · `prettier-plugin-svelte` 4.2. The
|
||||
> `minimatch` override and the astro2tsx `packageExtensions` retired (their
|
||||
> callers now ask for the right versions); the deepmerge advisory was
|
||||
> withdrawn, so `osv-scanner.toml` skips nothing (docs/09 §7). Node 26.13.1
|
||||
> is still the newest 26.x.
|
||||
|
||||
## 1. Runtime & toolchain
|
||||
|
||||
| Layer | Package | Line (2026-07-15) | Notes |
|
||||
|---|---|---|---|
|
||||
| Runtime | Node.js | **24 LTS "Krypton"** (24.x) | Active LTS; maintenance until 2028-04. Node 26 is Current only — do not use until it reaches LTS (2026-10). Pin via `.nvmrc` = `24` and `"engines": { "node": ">=24 <25" }`. |
|
||||
| Package manager | pnpm | **11.x** (`11.15.1` verified in P1) | `packageManager` field pinned. **Do not set `ignore-scripts`** — pnpm ≥ 10 already blocks dependency install scripts and wants an `allowBuilds` allowlist in `pnpm-workspace.yaml` instead (docs/09 §7). |
|
||||
| Deploy CLI | Wrangler | **4.x** (latest) | Only `deploy` / `versions upload` are used; no local Worker runtime needed (pure assets). |
|
||||
| Runtime | Node.js | **26** (26.12 at v1.2; was 24 LTS "Krypton" until 2026-10-23) | LTS from 2026-10-28, maintenance from 2027-10, end of life 2029-04. Taken five days before the LTS label at the owner's request (D7 amended) — Node 24 had entered maintenance on 2026-10-20, and CI, the e2e suite and a Workers Builds preview all passed on 26 first. Pin via `.nvmrc` = `26` and `"engines": { "node": ">=26 <27" }`; CI and the deploy job read `.nvmrc`, and `@types/node` majors are held to the same line (a Renovate rule, §5). **Node 25+ ships no Corepack**: a laptop whose `pnpm` came from Corepack needs `npm install -g corepack` (or a standalone pnpm) after upgrading, or `pnpm` and the lefthook hooks stop working. |
|
||||
| Package manager | pnpm | **11.x** (`11.29.0` since 2026-11-24, `packageManager`; `11.28.12` from 2026-11-16, `11.28.11` from 2026-11-09, `11.28.9` from 2026-11-04, `11.15.1` before) | `packageManager` field pinned; CI's `pnpm/action-setup` reads it (no `version:`), so CI, the deploy job, Renovate and laptops run the same pnpm. **Do not set `ignore-scripts`** — pnpm ≥ 10 already blocks dependency install scripts and wants an `allowBuilds` allowlist in `pnpm-workspace.yaml` instead (docs/09 §7). pnpm 11's default **24 h `minimumReleaseAge`** refuses day-old releases — Renovate's 3-day release age keeps every update PR installable (§5). |
|
||||
| Deploy CLI | Wrangler | **4.x** (4.151 at v1.1) | CI's `deploy` job runs `wrangler deploy` on pushes to `main` (D38; Workers Builds did until then, with `wrangler versions upload` previews for PRs); CI also runs `wrangler deploy --dry-run` to bundle `worker/` and validate `wrangler.jsonc`. Since D25 there **is** a Worker script (`worker/index.ts`), tested under Vitest in Node — the local `workerd` runtime stays blocked in `allowBuilds` (docs/09 §7). Types for the Worker are written by hand (`worker/env.ts`), not `@cloudflare/workers-types`. |
|
||||
|
||||
## 2. Framework & UI
|
||||
|
||||
| Layer | Package | Line | Notes |
|
||||
|---|---|---|---|
|
||||
| Framework | `astro` | **7.0.x** (≥ 7.0.9) | Static output. Ships Vite 8 + Rolldown (Rust bundler). Content Layer + Zod validation is the backbone of the data pipeline. |
|
||||
| Islands | `svelte` + `@astrojs/svelte` | Svelte **5.x** | Runes mode. Only 6 islands exist (docs/02 §5). |
|
||||
| Framework | `astro` | **7.x** (7.0.9 at P1; 7.4.1 at v1.1) | Static output. Ships Vite 8 + Rolldown (Rust bundler). Content Layer + Zod validation is the backbone of the data pipeline. `security.csp` provides the per-page meta policy (docs/09 §4); `<ClientRouter />` is **not** used — Astro does not support it with `security.csp` (docs/02 §6). |
|
||||
| Islands | `svelte` + `@astrojs/svelte` | Svelte **5.x** (5.57 at v1.1) | Runes mode. Only 6 islands exist (docs/02 §5). |
|
||||
| Styling | `tailwindcss` + `@tailwindcss/vite` | **4.3.x** (≥ 4.3.2) | CSS-first config via `@theme`; tokens in docs/06 §2. |
|
||||
| Language | `typescript` | **6.x — pinned, do not take 7** | `strict` + `noUncheckedIndexedAccess` (docs/10 §1). **TypeScript 7's native compiler does not expose the programmatic API `astro check` needs**, so `pnpm check` fails outright on it (reproduced in P1, 2026-07-27; upstream tracking: withastro/roadmap discussion 1321). Renovate must not bump this major until Astro says so — see §5.4. |
|
||||
| Language | `typescript` + `@typescript/native` | **6.x API + 7.x compiler, side by side** (since 2026-10-23) | `strict` + `noUncheckedIndexedAccess` (docs/10 §1). TypeScript 7's native compiler still ships no programmatic API, and `astro check` (its language server asserts `ts.findConfigFile`/`ts.sys`), typescript-eslint's project service and svelte2tsx all load one — so Microsoft's documented pair is used: `"typescript": "npm:@typescript/typescript6@^6"` (re-exports TS 6; bin `tsc6`) and `"@typescript/native": "npm:typescript@^7"` (bin `tsc`). `pnpm check` = `astro check` (TS 6, `.astro` files) **then** `tsc --noEmit` (TS 7, every `.ts` file — which nothing type-checked before: astro check reports `.astro` diagnostics only). `.svelte` script blocks are still checked by nothing. A TS 7-only setup waits on Astro (withastro/astro #18471, roadmap discussion 1321) and typescript-eslint (#10940). Dependabot ignores both majors (§5.4). |
|
||||
| State | `nanostores` **only** | 1.x | Cross-island filter/search state (~1 KB). **There is no `@nanostores/svelte` package** — it returns 404 on the registry (verified in P1, 2026-07-27). None is needed: a nanostores atom already satisfies Svelte's store contract (`.subscribe(cb)` fires immediately and returns an unsubscribe), so `$atom` auto-subscription works directly. Bindings exist for React/Vue/Solid/Preact/Lit/Angular precisely because those frameworks lack that contract. |
|
||||
| Search | `minisearch` | **7.x** | Client-side index; options in docs/05 §A2. |
|
||||
| Icons | `unplugin-icons` + `@iconify-json/simple-icons` + `@iconify-json/lucide` | latest | Simple Icons = app logos (SVG, CC0 set — trademark caveat in docs/14 §3d); Lucide = UI icons. Build-time inlined; nothing fetched at runtime. |
|
||||
| Fonts | `@fontsource-variable/bricolage-grotesque`, `@fontsource/be-vietnam-pro`, `@fontsource/ibm-plex-mono` | latest | Import `latin` + `vietnamese` subsets only. |
|
||||
| PWA / offline | `@vite-pwa/astro` | latest | Offline fallback page only — not a full precache PWA (docs/08 §D). |
|
||||
| Search | `minisearch` | **7.x** | Client-side index; options in docs/05 §A2. Loaded with a dynamic `import()` on first search, so it is not in any page's static bundle. |
|
||||
| Icons | `unplugin-icons` + `@iconify-json/simple-icons` + `@iconify-json/lucide` | latest | Simple Icons = app logos (SVG, CC0 set — trademark caveat in docs/14 §3d); Lucide = UI icons. In islands: `~icons/lucide/<name>` via `unplugin-icons` (`compiler: 'svelte'`). In `.astro`: `ShIcon.astro` / `src/lib/icon.ts`, which read the same vendored JSON at build time (data-driven names cannot be static imports). Nothing fetched at runtime. |
|
||||
| Fonts | `@fontsource-variable/bricolage-grotesque`, `@fontsource/be-vietnam-pro`, `@fontsource/ibm-plex-mono` | latest | `latin` + `vietnamese` subsets only (Bricolage's single stylesheet relies on `unicode-range`, docs/06 §3). |
|
||||
| PWA / offline | `@vite-pwa/astro` | **2.x** (2.0.1 since 2026-11-09; 1.2.0 before) | Installable (manifest linked, PNG icons) with an offline fallback page — not a full precache PWA (docs/08 Part D). 2.x is a rewrite on `@unplugin-pwa` 0.0.x: named export `AstroPWAIntegration`, `generateSW` instead of `workbox`. Under pnpm it needs four direct devDependencies — `rolldown` and `magicast` (or the SW build stops) and `@vite-pwa/workbox-swkit` + `@vite-pwa/workbox-window` (or `sw.js`/`registerSW.js` keep bare ES imports a classic script cannot run, while the build reports success). The SW is emitted unminified so `check:sw` can read it. 2.0.0 was refused on 2026-11-04 for exactly those silent failures (docs/09 §7). |
|
||||
| Feeds & SEO | `@astrojs/rss`, `@astrojs/sitemap` | latest | `/rss.xml` (new apps) + sitemap with hreflang. |
|
||||
| Third-party runtime (not packages) | Cloudflare Web Analytics beacon · Cloudflare Turnstile `api.js` | — | Loaded by our own code from their origins — the only third-party requests (hard rule 7, D25/D26, docs/09 §4). |
|
||||
|
||||
## 3. Quality tooling
|
||||
|
||||
@@ -41,11 +97,13 @@
|
||||
| Lint | `eslint` **10.x** flat config + `typescript-eslint` 8.x + `eslint-plugin-astro` 3.x + `eslint-plugin-svelte` 3.x | latest |
|
||||
| Format | `prettier` 3.x + `prettier-plugin-astro` + `prettier-plugin-svelte` + `prettier-plugin-tailwindcss` | latest |
|
||||
| Dead code | `knip` | **6.x** |
|
||||
| Unit tests | `vitest` | latest line compatible with the toolchain (Vitest bundles its own Vite — no conflict with Astro's Vite 8; confirm in spike S1) |
|
||||
| Unit / island / script / Worker tests | `vitest` + `@vitest/coverage-v8` + `happy-dom` | **5.x** (5.1.0) — four projects, coverage ratchet (docs/11 §1) |
|
||||
| End-to-end + a11y | `@playwright/test` + `@axe-core/playwright` | 1.64 / 4.14 — Chromium, desktop + Pixel 7 (docs/11 §5) |
|
||||
| Icon generation | `sharp` (dev only, `pnpm icons`) | 0.35 — output committed, builds never need it |
|
||||
| Git hooks | `lefthook` | **2.x** |
|
||||
| Link checking (CI) | `lychee` via `lycheeverse/lychee-action` | v2 line |
|
||||
| Dep updates | Renovate app | config in docs/12 §6 |
|
||||
| CVE scan | `osv-scanner` action + `pnpm audit` | latest |
|
||||
| Link checking (CI) | `lychee` via `lycheeverse/lychee-action` | v2 line (v2.9.0) |
|
||||
| Dep updates | **Renovate** (`renovate.json` → `local>poli0981/renovate-config`, self-hosted on Gitea) | npm + action pins, daily 13:31 UTC, grouped non-major, OSV security PRs — docs/12 §6 (Dependabot until D38) |
|
||||
| CVE / code scanning | osv-scanner 2.7.1 (pinned binary) + `pnpm audit --prod` in `gates`; the ops `security.yml` — gitleaks, Opengrep, osv-scanner (replaced CodeQL, D38); Qodana `qodana-js`, CLI 2026.3.1, Ultimate licence, native mode (`qodana.yml`, D35). SonarQube Cloud dropped (D38) | latest |
|
||||
|
||||
## 4. Rationale for the contested picks
|
||||
|
||||
@@ -69,21 +127,36 @@ rendered HTML and is the right tool only if the dataset grows 10×.
|
||||
|
||||
**No `@astrojs/cloudflare` adapter.** The adapter exists for SSR on Workers.
|
||||
SoftHarbor is 100 % prerendered, so `astro build` → `dist/` → Workers Static
|
||||
Assets needs no adapter, no Worker script, and no runtime billing.
|
||||
Assets needs no adapter. The one Worker of D25 (`worker/`) is a small
|
||||
hand-written module that Wrangler bundles beside the assets; it runs only
|
||||
for `assets.run_worker_first` paths (`/api/verify`), so pages stay on the
|
||||
unbilled asset path and no SSR exists.
|
||||
|
||||
## 5. Version & CVE policy
|
||||
|
||||
1. **Install latest stable within each line above; never pre-releases.**
|
||||
2. Renovate runs weekly (grouped minor/patch, separate majors) and pins
|
||||
GitHub Actions to commit SHAs.
|
||||
3. `osv-scanner` + `pnpm audit --prod` run on every PR; a *critical* finding
|
||||
with no patched version blocks merge and opens a tracking issue.
|
||||
4. Node upgrades follow LTS promotions only (next window: Node 26 → LTS
|
||||
2026-10; adopt after CI passes on it). **TypeScript is exempt from rule 1
|
||||
until Astro supports TS 7** (§2) — hold at 6.x and keep the major on
|
||||
Renovate's dashboard-approval list.
|
||||
2. **Renovate** runs daily (13:31 UTC, the owner's runner), npm and the
|
||||
workflow actions, holding a new npm release for 3 days (also clearing
|
||||
pnpm 11's 24 h `minimumReleaseAge`); minor + patch are grouped, majors
|
||||
arrive one PR each, and OSV advisories open their own PRs without the
|
||||
wait. Actions stay pinned to commit SHAs with a version comment, and
|
||||
Renovate bumps both (docs/12 §6). The ops pins and the osv-scanner binary
|
||||
are bumped by hand.
|
||||
3. `osv-scanner` + `pnpm audit --prod` run on every PR and push to `main`
|
||||
(`ci.yml` `gates` job); a finding fails it. A finding with no patched
|
||||
release of the direct dependency is fixed with an `overrides` floor in
|
||||
`pnpm-workspace.yaml`, the advisory ids in a comment (docs/09 §7), or a
|
||||
tracking issue.
|
||||
4. Node upgrades follow LTS lines, adopted once CI, the e2e suite and a
|
||||
deploy pass on them; `@types/node` moves with `.nvmrc` and Renovate
|
||||
proposes no majors of it in between. (Node 26 was taken on
|
||||
2026-10-23, five days before its LTS promotion — the owner's call, D7.)
|
||||
**TypeScript is exempt from rule 1 while Astro needs the TS 6 API** (§2):
|
||||
`typescript` stays the TS 6 wrapper and `@typescript/native` is TS 7;
|
||||
Renovate proposes neither major (D21).
|
||||
5. Every dependency bump that touches Astro/Vite/Tailwind majors must re-run
|
||||
spike S1 (docs/11 §3) before merge.
|
||||
spike S1 (docs/11 §3) before merge — in practice, the full CI including
|
||||
the e2e suite on the built site.
|
||||
|
||||
## 6. Known risk — Astro 7 freshness
|
||||
|
||||
@@ -93,3 +166,8 @@ weekly. Risk: a plugin in §2 misbehaves under Rolldown.
|
||||
- **Mitigation:** spike S1 compiles the *entire* integration set on day one.
|
||||
- **Fallback (pre-approved):** pin `astro@6.5.x` + its bundled Vite; no other
|
||||
stack change. Record the fallback in the decision log if taken.
|
||||
- **Outcome:** S1 passed on 7.1.3 (2026-07-27); the fallback was never
|
||||
needed, and the site runs 7.4.1 at v1.1. One Astro behaviour shaped the
|
||||
architecture since: `<ClientRouter />` is unsupported together with
|
||||
`security.csp`, so v1.1 moved to native cross-document View Transitions
|
||||
(docs/02 §6).
|
||||
@@ -2,103 +2,180 @@
|
||||
|
||||
## 1. Shape of the system
|
||||
|
||||
Fully static. The repository *is* the database; a deploy *is* a data
|
||||
migration.
|
||||
Static-first. The repository *is* the database; a deploy *is* a data
|
||||
migration. Everything a visitor reads is a prebuilt static asset; since
|
||||
v1.1 one small Worker answers exactly one endpoint (D25), and since v1.3
|
||||
it also stands in front of every page as the site-wide rate limit (D32).
|
||||
|
||||
```
|
||||
maintainer PR ──▶ GitHub main ──▶ CI (astro build + checks)
|
||||
│ dist/
|
||||
maintainer PR ──▶ CI (Gitea Actions: build + gates, security) ──▶ squash to main
|
||||
│
|
||||
CI `deploy` job ◀───────────────────────┘
|
||||
(pnpm build → wrangler deploy; docs/12 §3, D38)
|
||||
│ dist/ + worker/
|
||||
▼
|
||||
wrangler deploy → Cloudflare Workers Static Assets
|
||||
│ (no Worker script, requests unbilled)
|
||||
Cloudflare Workers Static Assets — softharbor.net
|
||||
/_astro/*, icons, SW ─▶ asset server (unbilled)
|
||||
pages, feeds, /api/* ─▶ worker/index.ts: rate limit (D32)
|
||||
├─ over it → 429
|
||||
├─ POST /api/verify (D25)
|
||||
└─ else → asset server
|
||||
│
|
||||
▼
|
||||
Browser
|
||||
static HTML/CSS + 6 Svelte islands (client JS)
|
||||
search index & app JSON fetched from same origin
|
||||
third-party, started only by our own code (rule 7):
|
||||
Cloudflare Web Analytics beacon (D26, never under GPC)
|
||||
Cloudflare Turnstile (gate step 2, after acceptance)
|
||||
```
|
||||
|
||||
Consequences (accepted, documented):
|
||||
|
||||
- No server-side anything: no SSR, no API routes at runtime, no rate
|
||||
limiting of our own, no server logs beyond Cloudflare's dashboard metrics.
|
||||
- "Dynamic" behaviors are relocated: data mutation → Git + GitHub Actions;
|
||||
personalization → localStorage; search → client-side index.
|
||||
- 403/429 cannot originate from us in v1 — the zone's security features
|
||||
(rate limiting, Bot Fight Mode) are deliberately OFF (docs/16 §9);
|
||||
templates exist but are dormant (docs/08 §C).
|
||||
- No SSR, no database, no page ever produced by server code. The only
|
||||
server code is `worker/`, which runs for the paths in
|
||||
`assets.run_worker_first` — everything but the files a page loads — and
|
||||
does two things: the site-wide rate limit (D32) and `POST /api/verify`
|
||||
(the legal gate's Turnstile check, D25). Every page, asset and feed it
|
||||
lets through is served by the asset server unchanged (§7, docs/08
|
||||
Parts E and F).
|
||||
- "Dynamic" behaviors are relocated: data mutation → Git + Gitea Actions;
|
||||
personalization → localStorage; search → client-side index; shareable
|
||||
view state → the URL (docs/05 §A3).
|
||||
- Logs: Cloudflare's dashboard metrics for the site, plus Workers Logs for
|
||||
the Worker's own one-line JSON events (a verification's outcome and
|
||||
duration, a rate-limit refusal's kind — never an IP or a token;
|
||||
invocation logs off).
|
||||
- 429 comes from us since D32: our own `/errors/429` page for a page
|
||||
request over the site-wide limit, JSON under `/api/` (docs/08 Part F).
|
||||
403 still comes only as a JSON answer from `/api/verify`, which the gate
|
||||
consumes and fails open on. Page-level 403 cannot happen — Bot Fight Mode
|
||||
and the zone's WAF rules are off (docs/16 §9) — so `/errors/403` and
|
||||
`/errors/500` stay dormant (docs/08 Part C).
|
||||
|
||||
## 2. Project tree
|
||||
|
||||
```
|
||||
softharbor/
|
||||
├── CLAUDE.md # AI dev instructions
|
||||
├── LICENSE # GPL-3.0-only (GitHub picker)
|
||||
├── CLAUDE.md # AI dev instructions (hard rules)
|
||||
├── LICENSE # GPL-3.0-only
|
||||
├── LICENSE-DATA.md # CC BY-SA 4.0 for src/data/** (docs/14 §1)
|
||||
├── SECURITY.md # reporting policy (docs/09 §5)
|
||||
├── ACCESSIBILITY.md # a11y statement for contributors (D33; twin of /legal/accessibility)
|
||||
├── CONTRIBUTING.md / CODE_OF_CONDUCT.md
|
||||
├── CHANGELOG.md # Keep-a-Changelog, features only (docs/13 §1)
|
||||
├── README.md # bilingual EN/VI (written in P6)
|
||||
├── astro.config.ts
|
||||
├── wrangler.jsonc
|
||||
├── README.md # overview, commands, contacts
|
||||
├── astro.config.ts # §4
|
||||
├── wrangler.jsonc # §7
|
||||
├── vitest.config.ts / playwright.config.ts # docs/11
|
||||
├── package.json / pnpm-lock.yaml / .nvmrc / .npmrc
|
||||
├── pnpm-workspace.yaml # allowBuilds gate (docs/09 §7)
|
||||
├── pnpm-workspace.yaml # allowBuilds + overrides (docs/09 §7)
|
||||
├── eslint.config.js / prettier.config.mjs / .prettierignore
|
||||
├── knip.json / lefthook.yml
|
||||
├── renovate.json # dependency policy (docs/12 §6)
|
||||
├── .gitignore
|
||||
├── .github/
|
||||
│ ├── CODEOWNERS # * @poli0981 + .github/ scripts/ src/data/ (T6)
|
||||
│ ├── ISSUE_TEMPLATE/ # bug_report.yml · app_request.yml · config.yml
|
||||
│ └── workflows/ # docs/12: ci.yml · codeql.yml · notify.yml
|
||||
│ # quarantine.yml · link-check.yml
|
||||
│ # (NO deploy/preview — Cloudflare Workers
|
||||
│ # Builds owns deployment, docs/12 §3)
|
||||
├── knip.json / lefthook.yml # docs/10 §4
|
||||
├── .dev.vars.example # Turnstile TEST secret for `wrangler dev`
|
||||
├── qodana.yaml # Qodana scope + gate, native mode (docs/12 §2, D35)
|
||||
├── renovate.json # extends local>poli0981/renovate-config (docs/12 §6, D38)
|
||||
├── osv-scanner.toml # time-boxed OSV exceptions (docs/09 §7)
|
||||
├── .gitleaksignore # public identifiers gitleaks would flag (docs/12 §2)
|
||||
├── .gitattributes / .gitignore
|
||||
├── .gitea/ # the forge since D38 (docs/12)
|
||||
│ ├── CODEOWNERS # regex patterns: .* + .gitea/ scripts/ src/data/ worker/ (T6)
|
||||
│ └── workflows/ # ci.yml (build · gates · record · deploy)
|
||||
│ # security.yml · qodana.yml · notify.yml
|
||||
│ # quarantine.yml · link-check.yml · vt-recheck.yml
|
||||
├── .github/ # forms Gitea still reads (docs/12 §7)
|
||||
│ ├── PULL_REQUEST_TEMPLATE.md # checks + accessibility + data-PR checklists
|
||||
│ └── ISSUE_TEMPLATE/ # bug_report.yml · app_request.yml · listing_change.yml · accessibility.yml · config.yml
|
||||
├── .gitlab/ # what the public uses on the GitLab mirror
|
||||
│ ├── issue_templates/ # Bug · App request · Listing change · Accessibility
|
||||
│ └── merge_request_templates/ # Default
|
||||
├── data/
|
||||
│ └── quarantine/ # flagged apps parked here (docs/03 §5)
|
||||
│ └── quarantine/ # flagged apps parked here (docs/03 §5);
|
||||
│ # created by `pnpm quarantine` on first use
|
||||
├── worker/ # the ONE Worker (D25, D32 — docs/08 E, F)
|
||||
│ ├── index.ts # rate limit → /api/verify → else ASSETS.fetch()
|
||||
│ ├── limit.ts # site-wide rate limit, 429 page / JSON
|
||||
│ ├── verify.ts # POST /api/verify → Turnstile Siteverify
|
||||
│ ├── http.ts # JSON responses, body cap, rate-limit key
|
||||
│ ├── env.ts # bindings, typed by hand
|
||||
│ └── *.test.ts # Vitest `worker` project (docs/11)
|
||||
├── e2e/ # Playwright + axe on the build, and the
|
||||
│ # Worker under `wrangler dev` (docs/11 §5)
|
||||
├── scripts/
|
||||
│ ├── validate-data.mjs # cross-file checks beyond Zod (docs/03 §2)
|
||||
│ ├── validate-data.mjs # L2 cross-file data rules (docs/03 §2)
|
||||
│ ├── check-i18n-parity.mjs # EN/VI key parity (docs/07 §3)
|
||||
│ ├── quarantine.mjs # move flagged entries (docs/12 §4)
|
||||
│ ├── quarantine.mjs # `pnpm quarantine` — move flagged entries
|
||||
│ ├── extract-urls.mjs # URL list for lychee (docs/12 §5)
|
||||
│ └── gen-licenses.mjs # third-party notices appendix (docs/14 §3e)
|
||||
│ ├── vt-recheck.mjs # VirusTotal re-check (docs/12 §4b)
|
||||
│ ├── gitea.mjs # the bots' PRs, issues, dispatches, statuses (docs/12 §1, D38)
|
||||
│ ├── postbuild.mjs # CSP meta first in <head> (docs/09 §4)
|
||||
│ ├── check-csp.mjs # dist/ markup vs its own page's CSP
|
||||
│ ├── check-assets.mjs # referenced assets exist; no data: scripts
|
||||
│ ├── check-service-worker.mjs # emitted sw.js matches docs/08 Part D
|
||||
│ ├── check-feed.mjs # emitted rss.xml guids/links/order (§A4)
|
||||
│ ├── gen-icons.mjs # `pnpm icons` — favicon + PWA PNGs
|
||||
│ └── fixture.ts / *.test.ts # each script run for real (docs/11 §2)
|
||||
├── public/
|
||||
│ ├── _headers # security + cache headers (docs/09 §4)
|
||||
│ ├── _redirects # path-level slug renames only (docs/16 §4)
|
||||
│ ├── theme.js # no-flash theme script (docs/05 §A8)
|
||||
│ ├── robots.txt
|
||||
│ ├── .well-known/security.txt
|
||||
│ ├── favicon.svg / icons/ # PWA icons
|
||||
│ └── logos/ # (empty; local logos live in src/assets)
|
||||
│ ├── favicon.svg / favicon.ico / apple-touch-icon.png
|
||||
│ └── icons/ # PWA PNGs: 192, 512, maskable-512
|
||||
│ # (no _redirects yet — docs/16 §4)
|
||||
└── src/
|
||||
├── content.config.ts # Zod collections: apps, categories
|
||||
├── data/
|
||||
│ ├── apps/*.json # ONE file per app, filename = slug
|
||||
│ └── categories.json # category registry (docs/04 §4)
|
||||
├── assets/logos/*.svg|webp # self-hosted logos when Simple Icons lacks one
|
||||
├── assets/logos/ # vendor SVGs for `local:` logos (none yet)
|
||||
├── i18n/
|
||||
│ ├── en.json / vi.json # UI dictionaries
|
||||
│ └── index.ts # typed t() helper (docs/07 §3)
|
||||
│ └── index.ts # typed t() + appCount() (docs/07 §3)
|
||||
├── scripts/ # head scripts: plain classic JS, emitted as
|
||||
│ ├── errors.js # hashed /_astro/ files (§4) — ring buffer
|
||||
│ ├── theme.js # (docs/05 §A5), pre-paint display prefs
|
||||
│ └── analytics.js # (§A8), Web Analytics loader (D26)
|
||||
├── lib/
|
||||
│ ├── normalize.ts # VN-insensitive normalizer (docs/05 §A1)
|
||||
│ ├── search.ts # MiniSearch factory (docs/05 §A2)
|
||||
│ ├── stores.ts # nanostores: query/filters/sort
|
||||
│ ├── paths.ts # shared getStaticPaths for both locales (docs/07 §2)
|
||||
│ ├── ringbuffer.ts # console error buffer (docs/05 §A5)
|
||||
│ ├── searchOptions.ts # MiniSearch options, shared (docs/05 §A2)
|
||||
│ ├── search.ts # build-time index factory
|
||||
│ ├── searchIndex.ts # client loader: fetch + import('minisearch')
|
||||
│ ├── stores.ts # nanostores: query/facets/sort (§A3)
|
||||
│ ├── filter.ts / grid.ts # pure filter+sort / grid controller (§A3)
|
||||
│ ├── urlstate.ts # ?q&cat&platform&pricing&sort (§A3)
|
||||
│ ├── legal.ts / human.ts # sh:legal, sh:human (docs/05 §A7, §A9)
|
||||
│ ├── turnstile.ts # gate step 2, browser half (docs/09 §4a)
|
||||
│ ├── theme.ts / prefs.ts / lang.ts # typed storage helpers
|
||||
│ ├── contacts.ts # one address per purpose (D27)
|
||||
│ ├── inlineCss.ts # the one inline <style> (§6)
|
||||
│ ├── locale.ts / paths.ts # locale routing, shared getStaticPaths
|
||||
│ ├── feed.ts # RSS items + /api/apps.json export
|
||||
│ ├── icon.ts / logo.ts # build-time SVG inlining (docs/04 §2)
|
||||
│ ├── licenses.ts # third-party table at build (docs/14 §3e)
|
||||
│ ├── ringbuffer.ts # reader for errors.js (docs/05 §A5)
|
||||
│ └── issueUrl.ts # bug-report URL builder (docs/05 §A6)
|
||||
├── components/
|
||||
│ ├── Sh*.astro # static components (cards, badges, header…)
|
||||
│ ├── Sh*.astro # static: ShAppCard, ShHeader, ShFooter,
|
||||
│ │ # ShIcon (Lucide, build-time), ShJsonLd
|
||||
│ ├── legal/*.astro # the seven documents, EN + VI (docs/14)
|
||||
│ ├── pages/*.astro # shared page bodies, one per route shape;
|
||||
│ │ # src/pages/** are thin locale wrappers
|
||||
│ │ # so EN and VI cannot drift (docs/07 §2)
|
||||
│ └── islands/Sh*.svelte # the 6 islands (§5)
|
||||
├── layouts/Base.astro
|
||||
├── styles/global.css # @theme tokens (docs/06 §2)
|
||||
├── layouts/Base.astro # head scripts, gate, header, footer
|
||||
├── styles/
|
||||
│ ├── global.css # @theme tokens (docs/06 §2)
|
||||
│ └── contrast.test.ts # WCAG AA for every token pair
|
||||
└── pages/
|
||||
├── index.astro # Welcome
|
||||
├── apps/index.astro # grid + search island
|
||||
├── apps/[slug].astro # detail (getStaticPaths)
|
||||
├── categories/index.astro # category index
|
||||
├── categories/[id].astro
|
||||
├── legal/{disclaimer,privacy,terms,trademarks,third-party}.astro
|
||||
├── errors/{403,429,500}.astro # dormant templates
|
||||
├── legal/{disclaimer,privacy,terms,trademarks,third-party,
|
||||
│ ai-disclosure,accessibility}.astro
|
||||
├── contact.astro # one address per purpose (D27)
|
||||
├── errors/{403,429,500}.astro # 429 live (D32); 403, 500 dormant
|
||||
├── 404.astro # → dist/404.html
|
||||
├── offline.astro # SW fallback
|
||||
├── api/apps.json.ts # static JSON export
|
||||
@@ -111,28 +188,39 @@ softharbor/
|
||||
|
||||
| Route (EN) | VI mirror | Rendered from | Notes |
|
||||
|---|---|---|---|
|
||||
| `/` | `/vi/` | `index.astro` | Welcome: hero, category tiles, latest additions |
|
||||
| `/apps` | `/vi/apps` | `apps/index.astro` | Grid; search/filter island |
|
||||
| `/` | `/vi` | `index.astro` | Welcome: hero, manifest ledger, category grid, principles |
|
||||
| `/apps` | `/vi/apps` | `apps/index.astro` | Grid; search/filter islands; view state in the query string (docs/05 §A3) |
|
||||
| `/apps/[slug]` | `/vi/apps/[slug]` | `[slug].astro` | One page per app; `getStaticPaths` over the collection |
|
||||
| `/categories` | `/vi/categories` | `categories/index.astro` | One tile per category |
|
||||
| `/categories/[id]` | `/vi/categories/[id]` | `[id].astro` | SEO landing per category |
|
||||
| `/legal/*` | `/vi/legal/*` | static pages | Exempt from legal gate (docs/14 §2) |
|
||||
| `/404` | — | `404.astro` | Served via `not_found_handling` |
|
||||
| `/offline` | — | `offline.astro` | SW navigation fallback |
|
||||
| `/errors/{403,429,500}` | — | templates | Dormant until custom domain |
|
||||
| `/legal/*` | `/vi/legal/*` | `LegalPage` + `components/legal/*` | Seven documents (the Accessibility Statement since v1.4); gate-exempt (docs/14 Part 2) |
|
||||
| `/contact` | `/vi/contact` | `contact.astro` | One address per purpose (D27); gate-exempt |
|
||||
| `/404` | — | `404.astro` | Served via `not_found_handling`; one bilingual page; gate-exempt |
|
||||
| `/offline` | — | `offline.astro` | SW navigation fallback; one bilingual page; gate-exempt |
|
||||
| `/errors/429` | — | template | **Live** (D32): the Worker serves it with status 429 to a client over the site-wide limit (docs/08 Part F) |
|
||||
| `/errors/{403,500}` | — | templates | Dormant — Free zone, nothing issues them (docs/08 Part C) |
|
||||
| `/api/apps.json` | — | endpoint | Full dataset export (docs/03 §6) |
|
||||
| `/search-index.json` | — | endpoint | Serialized MiniSearch index, lazy-loaded |
|
||||
| `/rss.xml` | — | endpoint | Latest additions feed |
|
||||
| `POST /api/verify` | — | `worker/` | The only endpoint answered by code (D25, docs/09 §4a); like every routed request it passes the site-wide limit first (D32) |
|
||||
|
||||
Every page route is prebuilt: 701 HTML files in `dist/` as of 2026-10-21
|
||||
(326 apps × 2 locales plus the rest). Pages without a VI mirror (404,
|
||||
offline, error templates) are single bilingual documents and emit no
|
||||
hreflang alternates (docs/07 §6).
|
||||
|
||||
## 4. Astro configuration (reference)
|
||||
|
||||
```ts
|
||||
// astro.config.ts
|
||||
// astro.config.ts (excerpt — the file itself carries the full reasoning)
|
||||
import { createHash } from 'node:crypto';
|
||||
import { defineConfig } from 'astro/config';
|
||||
import svelte from '@astrojs/svelte';
|
||||
import sitemap from '@astrojs/sitemap';
|
||||
import AstroPWA from '@vite-pwa/astro';
|
||||
import { AstroPWAIntegration } from '@vite-pwa/astro';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import Icons from 'unplugin-icons/vite';
|
||||
import { VIEW_TRANSITION_OPT_IN } from './src/lib/inlineCss';
|
||||
|
||||
// Reachable but meaningless in SERPs — noindex'd (docs/16 §7) AND kept out of
|
||||
// the sitemap, or GSC reports "Submitted URL marked noindex" forever.
|
||||
@@ -141,26 +229,19 @@ const NON_INDEXED = /\/(404|500|403|429|offline)\/?$/;
|
||||
export default defineConfig({
|
||||
site: 'https://softharbor.net',
|
||||
output: 'static',
|
||||
trailingSlash: 'never', // must agree with wrangler html_handling — §7, spike S1
|
||||
// ONE decision with wrangler's html_handling (§7) — spike S1, measured.
|
||||
trailingSlash: 'never',
|
||||
build: { format: 'file', inlineStylesheets: 'never' },
|
||||
prefetch: false, // Cloudflare 503s speculative Worker requests
|
||||
i18n: {
|
||||
defaultLocale: 'en',
|
||||
locales: ['en', 'vi'],
|
||||
routing: { prefixDefaultLocale: false },
|
||||
},
|
||||
integrations: [
|
||||
svelte(),
|
||||
sitemap({
|
||||
i18n: { defaultLocale: 'en', locales: { en: 'en', vi: 'vi' } },
|
||||
filter: (page) => !NON_INDEXED.test(page),
|
||||
}),
|
||||
AstroPWA(/* docs/08 §D */),
|
||||
],
|
||||
// Astro emits a per-page <meta http-equiv="content-security-policy"> whose
|
||||
// script-src/style-src carry hashes for the inline snippets IT generates
|
||||
// (island hydration bootstraps — unavoidable, see docs/09 §4 / D20).
|
||||
// _headers therefore carries ONLY frame-ancestors: both policies are
|
||||
// enforced, so declaring script-src there too would intersect and break
|
||||
// every island.
|
||||
// Per-page <meta http-equiv="content-security-policy"> with hashes for
|
||||
// the inline snippets Astro generates (D20, docs/09 §4). _headers carries
|
||||
// ONLY frame-ancestors: both policies are enforced, so script-src there
|
||||
// too would intersect and break every island.
|
||||
security: {
|
||||
csp: {
|
||||
algorithm: 'SHA-256',
|
||||
@@ -168,42 +249,113 @@ export default defineConfig({
|
||||
"default-src 'self'",
|
||||
"img-src 'self' data:",
|
||||
"font-src 'self'",
|
||||
"connect-src 'self'",
|
||||
"connect-src 'self' https://cloudflareinsights.com", // D26 beacon
|
||||
'frame-src https://challenges.cloudflare.com', // D25 widget
|
||||
"manifest-src 'self'",
|
||||
"base-uri 'none'",
|
||||
"form-action 'none'",
|
||||
"object-src 'none'",
|
||||
],
|
||||
// `resources` REPLACES Astro's default, so 'self' must be listed or
|
||||
// every same-origin script — islands included — is refused.
|
||||
scriptDirective: {
|
||||
resources: [
|
||||
"'self'",
|
||||
'https://static.cloudflareinsights.com', // D26
|
||||
'https://challenges.cloudflare.com', // D25
|
||||
],
|
||||
},
|
||||
// The one is:inline <style> (§6). Astro hashes only what it bundles.
|
||||
styleDirective: {
|
||||
hashes: [
|
||||
`sha256-${createHash('sha256').update(VIEW_TRANSITION_OPT_IN).digest('base64')}`,
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
integrations: [
|
||||
svelte(),
|
||||
sitemap({
|
||||
i18n: { defaultLocale: 'en', locales: { en: 'en', vi: 'vi' } },
|
||||
filter: (page) => !NON_INDEXED.test(page),
|
||||
}),
|
||||
AstroPWAIntegration(/* docs/08 Part D */),
|
||||
],
|
||||
vite: {
|
||||
plugins: [tailwindcss(), Icons({ compiler: 'astro' })],
|
||||
// ~icons/<set>/<name> compiles to Svelte components (islands); .astro
|
||||
// files use ShIcon / src/lib/icon.ts instead (docs/10 §3).
|
||||
plugins: [tailwindcss(), Icons({ compiler: 'svelte' })],
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
Notes on the non-obvious keys:
|
||||
|
||||
- **`build.format: 'file'`** makes `/apps` the asset itself (`apps.html`);
|
||||
with `html_handling: "drop-trailing-slash"` the canonical no-slash URL is
|
||||
the one that serves 200 (S1). Side effect: `Astro.url.pathname` is the
|
||||
emitted *file* name, so everything user-facing goes through
|
||||
`canonicalPath()` (docs/07 §6).
|
||||
- **`inlineStylesheets: 'never'`** began as a CSP fix under the former
|
||||
`<ClientRouter />` (a soft navigation refused a page-specific inline
|
||||
stylesheet hashed only into the page it came from) and stays as a cache
|
||||
decision: external CSS needs no hash and is cached once across ~700 pages.
|
||||
- **`prefetch: false`** because Cloudflare answers a `Sec-Purpose: prefetch`
|
||||
request on a Worker with a bare 503 (`Cf-Speculation-Refused`); the zone's
|
||||
Speed Brain hits the same refusal (docs/16 §9).
|
||||
- **Head scripts** (`src/scripts/*.js`) are imported in `Base.astro` with
|
||||
`?url&no-inline`: Vite copies them verbatim to content-hashed `/_astro/`
|
||||
files cached immutably. Plain `?url` would inline files under 4 KiB as
|
||||
`data:` URLs, which `script-src 'self'` refuses — `check:assets` guards it.
|
||||
|
||||
`pnpm build` is the composite every environment runs (CI, the deploy job,
|
||||
laptops): `validate:data → i18n:check → astro build → postbuild:html →
|
||||
check:csp → check:assets → check:sw → check:feed` (docs/12 §2).
|
||||
|
||||
## 5. Islands & hydration budget
|
||||
|
||||
| Island | Directive | Why |
|
||||
|---|---|---|
|
||||
| `ShLegalGate.svelte` | `client:load` + `transition:persist` | Must block interaction immediately; survives View Transitions |
|
||||
| `ShSearch.svelte` | `client:idle` | Grid is readable without it; index fetched on first focus |
|
||||
| `ShLegalGate.svelte` | `client:load`, rendered by `Base.astro` unless the page declares `gateExempt` | Must block interaction immediately; mounts afresh on every page (§6, docs/14 Part 2) |
|
||||
| `ShSearch.svelte` | `client:idle` | Grid is readable without it; mounts the grid controller (`src/lib/grid.ts`), restores the view from the URL; index and MiniSearch load on first focus/keystroke |
|
||||
| `ShFilterSheet.svelte` | `client:idle` | Shares nanostores with search |
|
||||
| `ShLangSwitch.svelte` | `client:idle` | Persists `sh:lang`, rewrites path |
|
||||
| `ShThemeToggle.svelte` | `client:idle` | Persists `sh:theme`; no-flash script is inline+hashed |
|
||||
| `ShBugReport.svelte` | `client:visible` (footer) | Reads ring buffer, opens prefilled issue URL |
|
||||
| `ShLangSwitch.svelte` | `client:idle` | Server-rendered EN⇄VI pair; carries `?query#hash` across; persists `sh:lang` |
|
||||
| `ShPrefs.svelte` | `client:idle` | Display menu — theme, scrollbar, motion — that replaced `ShThemeToggle` in v1.1; also the global `/` shortcut off `/apps`. `theme.js` has already applied all three pre-paint |
|
||||
| `ShBugReport.svelte` | `client:visible` (footer) | Reads the ring buffer `errors.js` fills; opens prefilled issue URL |
|
||||
|
||||
Everything else is `.astro` with zero client JS. Adding a seventh island
|
||||
requires a decision-log entry.
|
||||
Everything else is `.astro` with zero client JS — including the welcome
|
||||
page's search field and the header's search hint, which are plain links to
|
||||
`/apps#search`. Adding a seventh island requires a decision-log entry;
|
||||
`ShPrefs` replaced `ShThemeToggle` one-for-one, so the count is still six.
|
||||
|
||||
## 6. View Transitions
|
||||
|
||||
Astro `<ClientRouter />` enabled site-wide. Card → detail uses
|
||||
`transition:name={slug}` on the logo+title block for a morph effect;
|
||||
`prefers-reduced-motion` disables all transitions (docs/06 §7). The legal
|
||||
gate island persists across navigations so acceptance state never re-flashes
|
||||
(verified by spike S4).
|
||||
**Native cross-document View Transitions since v1.1; `<ClientRouter />` is
|
||||
gone.** Astro does not support ClientRouter together with `security.csp`,
|
||||
and in practice the soft navigation kept the *first* page's meta CSP, wiped
|
||||
`<html data-theme>`, and kept module state alive while islands reset — the
|
||||
theme flicker and stale sort of v1.0. Every navigation is now a full
|
||||
document load with its own CSP and its own island tree.
|
||||
|
||||
- The opt-in is
|
||||
`@media (prefers-reduced-motion:no-preference){@view-transition{navigation:auto}}`
|
||||
— an **inline, hashed `<style>`** in `Base.astro`, from
|
||||
`src/lib/inlineCss.ts`, whose hash `astro.config.ts` supplies (§4). It
|
||||
cannot live in `global.css`: Chromium decides the new page's opt-in when
|
||||
the parser inserts `<body>`, counting only stylesheets already loaded, and
|
||||
the bundled CSS links come after the blocking head scripts.
|
||||
- Browsers without support simply navigate. `theme.js` marks the
|
||||
transition promises handled on `pageswap`/`pagereveal`, so an aborted fade
|
||||
never lands in the bug-report buffer as an unhandled rejection.
|
||||
- No `transition:persist`, no `transition:name`, no `astro:after-swap`
|
||||
handlers anywhere. Islands remount per page; nanostores live for one page;
|
||||
**the URL is the durable view state** (`?q&cat&platform&pricing&sort`,
|
||||
`src/lib/urlstate.ts`, docs/05 §A3).
|
||||
- The legal gate mounts on every non-exempt page and re-reads `sh:legal` /
|
||||
`sh:human`; there is nothing to carry across navigations.
|
||||
- Reduced motion — OS setting or the display menu's `data-motion="reduce"` —
|
||||
removes the fade (docs/06 §7). The card→detail morph stays withdrawn
|
||||
(docs/06 §7).
|
||||
|
||||
## 7. wrangler.jsonc (reference)
|
||||
|
||||
@@ -211,25 +363,54 @@ gate island persists across navigations so acceptance state never re-flashes
|
||||
{
|
||||
"$schema": "node_modules/wrangler/config-schema.json",
|
||||
"name": "softharbor",
|
||||
"compatibility_date": "2026-07-15",
|
||||
// No "main" — pure static assets, requests are unbilled.
|
||||
"main": "./worker/index.ts", // D25 + D32 — rate limit, /api/verify
|
||||
// ≥ 2025-04-01: on an asset-first path, a NAVIGATION that matches no asset
|
||||
// gets dist/404.html from the asset server directly (docs/08 Part C).
|
||||
"compatibility_date": "2026-10-01",
|
||||
"assets": {
|
||||
"directory": "./dist",
|
||||
"not_found_handling": "404-page", // serves dist/404.html with HTTP 404
|
||||
// MUST be explicit and MUST agree with astro's trailingSlash: 'never'.
|
||||
// Leaving it to the default is how a site ends up serving both
|
||||
// /apps/7-zip and /apps/7-zip/ (duplicate content) or 307-looping between
|
||||
// them. Spike S1 curl-tests both variants and pins the right value here.
|
||||
"html_handling": "auto-trailing-slash"
|
||||
"binding": "ASSETS",
|
||||
"not_found_handling": "404-page", // serves dist/404.html with HTTP 404
|
||||
// MUST agree with astro's trailingSlash 'never' + build.format 'file'.
|
||||
// Measured in S1 on a real deploy: "auto-trailing-slash" 307s /apps to
|
||||
// /apps/, contradicting every canonical; this makes /apps the 200.
|
||||
"html_handling": "drop-trailing-slash",
|
||||
// D32: every request runs the Worker first EXCEPT what a page loads.
|
||||
"run_worker_first": ["/*", "!/_astro/*", "!/icons/*", "!/favicon.ico",
|
||||
"!/favicon.svg", "!/apple-touch-icon.png", "!/manifest.webmanifest",
|
||||
"!/sw.js", "!/registerSW.js", "!/workbox-*.js"]
|
||||
},
|
||||
"routes": [
|
||||
{ "pattern": "softharbor.net", "custom_domain": true } // docs/16 §3
|
||||
// Workers Rate Limiting, per IPv4 address or IPv6 /64, per Cloudflare
|
||||
// location; namespace_id is account-wide (docs/08 Part F).
|
||||
"ratelimits": [
|
||||
{ "name": "SITE_LIMITER", "namespace_id": "4102", // D32
|
||||
"simple": { "limit": 60, "period": 10 } },
|
||||
{ "name": "VERIFY_LIMITER", "namespace_id": "4101", // D25
|
||||
"simple": { "limit": 20, "period": 60 } }
|
||||
],
|
||||
// Workers Logs keep the Worker's own JSON lines; invocation logs are off.
|
||||
"observability": {
|
||||
"enabled": true,
|
||||
"logs": { "enabled": true, "invocation_logs": false }
|
||||
},
|
||||
// No "routes" (since commit 66c6255, 2026-07-28): softharbor.net and
|
||||
// www.softharbor.net are Custom Domains attached in the dashboard, which a
|
||||
// deploy then leaves untouched (docs/16 §2.2, §3).
|
||||
"workers_dev": false, // canonical origin is the custom domain only
|
||||
"preview_urls": true // explicit: defaults to workers_dev's value
|
||||
"preview_urls": true // PR previews; _headers marks them noindex
|
||||
}
|
||||
```
|
||||
|
||||
Rules: never add `main` without a decision-log entry (it flips billing and
|
||||
the error model); never enable `run_worker_first`; never re-enable
|
||||
`workers_dev` (duplicate-content hazard — docs/16 §1/N3).
|
||||
Rules:
|
||||
|
||||
- `main` exists since D25 and does exactly two things (hard rule 1): the
|
||||
site-wide rate limit (D32) and `/api/verify`. Changing what
|
||||
`run_worker_first` routes, the limits, or letting the Worker serve,
|
||||
render or rewrite a page needs a decision-log entry: every routed request
|
||||
is a billed invocation. Keep the negative patterns covering everything a
|
||||
page loads, so a page that passed never half-loads.
|
||||
- Never re-enable `workers_dev` (duplicate-content hazard — docs/16 §1/N3).
|
||||
- Do not re-add `routes` without re-reading docs/16 §2.2: a deploy
|
||||
reconciles the Worker's triggers, which is how `www` was lost once.
|
||||
- The Turnstile secret is **not** in this file and never in the repo: it is
|
||||
a runtime secret, `TURNSTILE_SECRET` (docs/08 Part E).
|
||||
@@ -12,7 +12,8 @@
|
||||
▼
|
||||
CI: Zod schema (build) + validate-data.mjs + link check on new URLs
|
||||
▼
|
||||
review → squash-merge → deploy workflow → live
|
||||
review → squash-merge → CI `deploy` job (D38) → verify production
|
||||
(docs/13 §3) → live
|
||||
```
|
||||
|
||||
Rules: one app per PR; PR title `data: add <slug>`; summaries written from
|
||||
@@ -23,12 +24,31 @@ review date after the maintainer runs the vetting checklist (docs/09 §6).
|
||||
|
||||
| Layer | Where | Catches |
|
||||
|---|---|---|
|
||||
| L1 Zod schema | `src/content.config.ts`, runs inside `astro build` | Types, enums, URL shape, summary lengths, date formats |
|
||||
| L2 `scripts/validate-data.mjs` | CI (`ci.yml` job `gates`) + pre-commit | Cross-file rules Zod can't see: **slug format `^[a-z0-9]+(-[a-z0-9]+)*$` and ≤ 40 chars** (docs/04 §2 — Zod never sees the filename), duplicate slugs vs filenames, duplicate `name` (case/diacritic-insensitive), `categories[]` ids exist in registry, `links.*` are https, no `flagged` entries inside `src/data/apps/`, logo asset exists when `local:` |
|
||||
| L2b `scripts/check-i18n-parity.mjs` | CI (`ci.yml` job `gates`) + pre-commit | EN/VI dictionary key parity (docs/07 §3) — a **separate** script and a separate `pnpm i18n:check`, because it is triggered by `src/i18n/**`, not `src/data/**` |
|
||||
| L3 lychee link check | CI (PR: changed files only; weekly: all) | Dead/redirected official links |
|
||||
| L1 Zod schema | `src/content.config.ts`, runs inside `astro build` | Types, enums, https-only URLs, summary lengths; dates must be **real calendar dates** (`2026-02-31` fails) **not in the future**; `updatedAt ≥ addedAt`; **`evidence` required for `clean` and `flagged`**; unknown keys (`.strict()`) — docs/04 §1 |
|
||||
| L2 `scripts/validate-data.mjs` | first step of `pnpm build`; CI (`ci.yml` job `gates`) + pre-commit | Cross-file and provenance rules Zod can't see, listed below |
|
||||
| L2b `scripts/check-i18n-parity.mjs` | second step of `pnpm build`; CI (`ci.yml` job `gates`) + pre-commit | EN/VI dictionary key parity, placeholder parity, alphabetical order (docs/07 §3) — a **separate** script and a separate `pnpm i18n:check`, because it is triggered by `src/i18n/**`, not `src/data/**` |
|
||||
| L3 lychee link check | CI (PR: changed files only; weekly: all) | Dead official links; 403/429 count as reachable (bot mitigation, docs/12 §5) |
|
||||
| L4 Human review | PR review | Criteria judgment, summary quality, official-domain authenticity |
|
||||
|
||||
**L2 rules** (`file → rule → detail`; each is a fixture test in
|
||||
`scripts/validate-data.test.ts`):
|
||||
|
||||
| Rule | Fails when |
|
||||
|---|---|
|
||||
| `slug-format` / `slug-length` | filename is not `^[a-z0-9]+(-[a-z0-9]+)*$`, or longer than 40 chars (docs/04 §2 — Zod never sees the filename; duplicate slugs cannot exist in one directory) |
|
||||
| `duplicate-name` | two `name`s collide after `normalizeViet` (case- and diacritic-insensitive) |
|
||||
| `unknown-category` | a `categories[]` id is not in `categories.json` |
|
||||
| `bad-url` / `insecure-link` | a `links.*` or `security.evidence` value does not parse, or is not https |
|
||||
| `punycode-host` | any host label starts with `xn--` — check for a look-alike |
|
||||
| `download-portal` | the host is (or is under) a denylisted portal/mirror: softpedia, filehorse, uptodown, download.cnet, majorgeeks, filehippo, softonic, fosshub, techspot, malavida, chip.de, portableapps, apkmirror, getintopc |
|
||||
| `tracking-param` | a query key is `utm_*`, `fbclid`, `gclid`, `dclid`, `msclkid`, `mc_eid`, `ref`, `aff`, `affiliate` or `partner` |
|
||||
| `invisible-char` | any string value contains a zero-width or bidi-control character |
|
||||
| `flagged-in-main-tree` | `security.status` is `flagged` inside `src/data/apps/` — run `pnpm quarantine` (§5) |
|
||||
| `missing-logo` | a `local:` logo is not in `src/assets/logos/` — compared against the directory listing, **case-sensitively** (Windows would accept a wrong case that Linux CI and the deploy job reject) |
|
||||
| `future-date` / `date-order` | `addedAt`, `updatedAt` or `checkedAt` after today; `updatedAt` before `addedAt` |
|
||||
| `unflagged-in-quarantine` / `slug-in-both-trees` | a file in `data/quarantine/` no longer says `flagged`, or the same slug is live and quarantined |
|
||||
| `stale-check` (**warning**) | `security.checkedAt` older than 180 days — re-verify (docs/13 §6); grouped, never fails the build |
|
||||
|
||||
Both L2 scripts are plain Node (`fs` + `JSON.parse`) — they run **outside**
|
||||
Astro and must never import from `astro:content`. Failures print a table of
|
||||
`file → rule → detail` and exit non-zero. Port the structure from
|
||||
@@ -37,9 +57,13 @@ implement exactly this contract.
|
||||
|
||||
## 3. Build artifacts (derived, never hand-edited)
|
||||
|
||||
`astro build` produces, from the single source of truth:
|
||||
`astro build` produces, from the single source of truth (701 HTML pages as
|
||||
of 2026-10-21; `pnpm build` then checks the output — docs/02 §4):
|
||||
|
||||
1. **Pages** — `/apps/<slug>` ×2 locales, category pages, grid, welcome.
|
||||
1. **Pages** — `/apps/<slug>` ×2 locales, category index + category pages,
|
||||
grid, welcome, contact, the seven legal documents (the third-party table
|
||||
generated from `package.json` at build time, docs/14 §3e), 404/offline
|
||||
and the dormant error templates.
|
||||
2. **`/search-index.json`** — serialized MiniSearch index built in
|
||||
`search-index.json.ts`: for each app, `slug` (the id) plus the **raw**
|
||||
`name`, `tags`, `summaryEn`, `summaryVi` (docs/05 §A2). There are no
|
||||
@@ -49,15 +73,19 @@ implement exactly this contract.
|
||||
One function, one import, no duplicated logic (docs/05 §A1). Display data
|
||||
is **not** stored in the index — it is already in the DOM (docs/05 §A3).
|
||||
3. **`/api/apps.json`** — full public dataset export (§6).
|
||||
4. **`/rss.xml`** — 50 newest by `addedAt` (§7).
|
||||
4. **`/rss.xml`** — 50 newest by `addedAt` (§7), its emitted guids, links
|
||||
and order asserted by `check:feed`.
|
||||
5. **Sitemap** with hreflang pairs (docs/07 §6).
|
||||
|
||||
## 4. Update & re-verification flow
|
||||
|
||||
- Editing an app = PR touching its one file; bump `updatedAt`.
|
||||
- Monthly batch (docs/13 §6): oldest `security.checkedAt` entries get
|
||||
re-vetted; refresh `checkedAt` even when nothing changed — the dated
|
||||
status is the product's honesty mechanism.
|
||||
- Re-checks are automated since 2026-10-23 (docs/12 §4b): `vt-recheck.yml`
|
||||
re-scans every entry whose `checkedAt` is older than 90 days, a few
|
||||
hundred requests a day within VirusTotal's Public API limits, into one
|
||||
accumulating PR. It refreshes `checkedAt` even when nothing changed — the
|
||||
dated status is the product's honesty mechanism — and turns any detection
|
||||
into `unverified` plus an issue, never into a flag.
|
||||
|
||||
## 5. Quarantine state machine (hard rules 4–5)
|
||||
|
||||
@@ -71,10 +99,11 @@ implement exactly this contract.
|
||||
┌─────────────────────────────────────┐
|
||||
│ flagged │ (set in PR or by maintainer)
|
||||
└──────────────────┬──────────────────┘
|
||||
▼ quarantine workflow (docs/12 §4)
|
||||
▼ `pnpm quarantine` in the same PR — or, as the
|
||||
▼ safety net, the quarantine workflow (docs/12 §4)
|
||||
file moved src/data/apps/x.json → data/quarantine/x.json
|
||||
+ issue opened: reason, evidence link, date
|
||||
+ site rebuild → app disappears
|
||||
+ merge → deploy → app disappears (verify production, docs/13 §3)
|
||||
│
|
||||
cleared? reviewed restore PR (status back to clean/unverified,
|
||||
new checkedAt, evidence) → file moves back
|
||||
@@ -83,7 +112,14 @@ implement exactly this contract.
|
||||
Invariants: `data/quarantine/` is outside the content glob, so quarantined
|
||||
entries can never render; the *reason* lives in the issue + commit message,
|
||||
keeping the data file schema-identical for painless restore; deletion of a
|
||||
data file is only allowed for entries that never shipped.
|
||||
data file is only allowed for entries that never shipped. `validate:data`
|
||||
enforces both directions — a `flagged` file may not stay in
|
||||
`src/data/apps/`, a quarantined file must still say `flagged`, and one slug
|
||||
may not live in both trees (§2) — so a PR that flags an entry fails until
|
||||
`pnpm quarantine` has moved it. The directory itself appears with the first
|
||||
quarantined entry. A flagged entry vanishes from all five surfaces: detail
|
||||
page, grid, `/api/apps.json`, `/rss.xml` and the search index (tested
|
||||
end-to-end 2026-07-28).
|
||||
|
||||
## 6. `/api/apps.json` contract (for tools & future extensions)
|
||||
|
||||
@@ -93,7 +129,7 @@ data file is only allowed for entries that never shipped.
|
||||
"generatedAt": "2026-07-15T00:00:00Z",
|
||||
"count": 30,
|
||||
"license": "CC-BY-SA-4.0",
|
||||
"attribution": "SoftHarbor contributors — https://github.com/poli0981/softharbor",
|
||||
"attribution": "SoftHarbor contributors — https://git.poli0981.dev/poli0981/softharbor",
|
||||
"apps": [ { /* exactly the schema of docs/04 §1, plus "slug" */ } ]
|
||||
}
|
||||
```
|
||||
@@ -103,9 +139,15 @@ data file is only allowed for entries that never shipped.
|
||||
contract — getting it right costs nothing now and a breaking change later.
|
||||
|
||||
Every app object carries every field of docs/04 §1 including `developer`,
|
||||
plus `slug`. Because the collection schema is `.strict()`, the export shape
|
||||
cannot silently grow. Breaking changes require a `schemaVersion` bump and a
|
||||
decision-log entry.
|
||||
plus `slug`, with `categories` as plain ids. Because the collection schema is
|
||||
`.strict()`, the export shape cannot silently grow. Breaking changes require
|
||||
a `schemaVersion` bump and a decision-log entry. `apps` is sorted by slug in
|
||||
code-unit order — a stable document whatever machine builds it (docs/05
|
||||
§A4). Served with `Access-Control-Allow-Origin: *` and a 300 s cache
|
||||
(docs/09 §4). The `attribution` string names the repository's home: on
|
||||
2026-11-24 (D38) its address moved from GitHub to Gitea — the field and the
|
||||
shape are unchanged, so `schemaVersion` stays 1. The CI `deploy` job reads
|
||||
`generatedAt` to know production serves the new build (docs/12 §3).
|
||||
|
||||
`generatedAt` is a build timestamp, so this file changes on every deploy even
|
||||
when the data does not. That is fine here — but it is exactly why `/rss.xml`
|
||||
@@ -116,23 +158,34 @@ byte-determinism is a contract, this file's is not.
|
||||
|
||||
`/rss.xml` item: title = app name, link = `/apps/<slug>`, description =
|
||||
`summary.en`, pubDate = `addedAt`, guid = slug (stable). The existing
|
||||
`notify.py` cross-poster consumes this feed on its GitHub Actions cron and
|
||||
`notify.py` cross-poster consumes this feed on its own schedule, in its own
|
||||
repository, and
|
||||
announces new items to Telegram / Discord / Bluesky / Mastodon / X /
|
||||
Facebook — no new announcement code needed in this repo (integration notes:
|
||||
docs/13 §5).
|
||||
docs/13 §5). It announces every guid it has not seen, so `check:feed`
|
||||
asserts the emitted guids, links and order on every build (docs/05 §A4).
|
||||
Tagged releases are announced separately, Discord only, by `notify.yml`
|
||||
(docs/12 §2).
|
||||
|
||||
## 8. Client-side flow
|
||||
|
||||
```
|
||||
first paint: static HTML (grid server-rendered with ALL apps, unfiltered)
|
||||
└─ ShSearch hydrates on idle
|
||||
└─ on first focus/keystroke: fetch /search-index.json (~tens of KB)
|
||||
└─ MiniSearch.loadJSON → results drive nanostores
|
||||
└─ grid cards toggle visibility (no re-render of content)
|
||||
errors anywhere: window.onerror / unhandledrejection → ring buffer (A5)
|
||||
└─ ShBugReport builds prefilled GitHub issue URL (A6)
|
||||
first paint: static HTML (grid server-rendered with ALL apps, A–Z)
|
||||
├─ <head>: errors.js (ring buffer, first) → theme.js (pre-paint prefs)
|
||||
│ → registerSW.js, analytics.js (defer)
|
||||
└─ ShSearch hydrates on idle → restores ?q&cat&platform&pricing&sort
|
||||
└─ on first focus/keystroke: fetch /search-index.json
|
||||
+ import('minisearch') — one shared promise per page
|
||||
└─ MiniSearch.loadJSON → ranked hits → grid controller
|
||||
└─ cards toggle `hidden` and move in the DOM (no
|
||||
re-render of content); the URL follows (replaceState)
|
||||
errors anywhere: own-origin errors, unhandled rejections, CSP violations,
|
||||
hydration errors → ring buffer (A5)
|
||||
└─ ShBugReport builds a prefilled GitLab issue URL (A6)
|
||||
```
|
||||
|
||||
Graceful degradation: with JS disabled, the full grid, category pages, and
|
||||
all links still work; only search/filter/theme/lang-switch degrade (links in
|
||||
the header still navigate to `/vi/…`).
|
||||
all links still work; search, filters, the display menu and the legal gate
|
||||
(all islands) do not run. Dark mode still follows the OS — the CSS's
|
||||
`prefers-color-scheme` block needs no script (docs/06 §2) — and the header's
|
||||
search hint and EN/VI links are plain links.
|
||||
@@ -10,10 +10,20 @@ derived. Schema version: **1** (bump requires migration note in docs/15).
|
||||
import { defineCollection, reference, z } from 'astro:content';
|
||||
import { glob, file } from 'astro/loaders';
|
||||
|
||||
const DATE = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD');
|
||||
const HTTPS = z.string().url().startsWith('https://');
|
||||
/** Today in UTC, at build time: data dated after the build is a typo. */
|
||||
const TODAY = new Date().toISOString().slice(0, 10);
|
||||
|
||||
export const categories = defineCollection({
|
||||
// A REAL calendar date, not in the future — the regex alone let
|
||||
// `2026-02-31` through; round-tripping through Date catches it.
|
||||
const DATE = z
|
||||
.string()
|
||||
.regex(/^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD')
|
||||
.refine((d) => new Date(`${d}T00:00:00Z`).toISOString().slice(0, 10) === d,
|
||||
{ message: 'not a real calendar date' })
|
||||
.refine((d) => d <= TODAY, { message: 'date is in the future' });
|
||||
const HTTPS = z.url().refine((u) => u.startsWith('https://'), { message: 'https:// only' });
|
||||
|
||||
const categories = defineCollection({
|
||||
loader: file('./src/data/categories.json'),
|
||||
schema: z.object({
|
||||
id: z.string().regex(/^[a-z0-9-]+$/),
|
||||
@@ -23,7 +33,7 @@ export const categories = defineCollection({
|
||||
}),
|
||||
});
|
||||
|
||||
export const apps = defineCollection({
|
||||
const apps = defineCollection({
|
||||
loader: glob({ pattern: '*.json', base: './src/data/apps' }), // id = filename = slug
|
||||
schema: z.object({
|
||||
name: z.string().min(1).max(60),
|
||||
@@ -50,14 +60,30 @@ export const apps = defineCollection({
|
||||
}),
|
||||
addedAt: DATE,
|
||||
updatedAt: DATE.optional(),
|
||||
}).strict(),
|
||||
})
|
||||
.strict()
|
||||
.superRefine((app, ctx) => {
|
||||
// A status that makes a claim must link the evidence behind it.
|
||||
if (app.security.status !== 'unverified' && app.security.evidence === null)
|
||||
ctx.addIssue({ code: 'custom', path: ['security', 'evidence'],
|
||||
message: `status "${app.security.status}" requires an evidence URL` });
|
||||
if (app.updatedAt && app.updatedAt < app.addedAt)
|
||||
ctx.addIssue({ code: 'custom', path: ['updatedAt'],
|
||||
message: `updatedAt ${app.updatedAt} precedes addedAt ${app.addedAt}` });
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = { apps, categories };
|
||||
```
|
||||
|
||||
`.strict()` is deliberate: unknown keys fail the build, so the export
|
||||
contract (docs/03 §6) never silently grows.
|
||||
contract (docs/03 §6) never silently grows. The two refinements are v1.1:
|
||||
"no known warnings" is only worth something when the reader can check it
|
||||
(hard rule 4) and a flag needs its reason — CONTRIBUTING closed `clean`
|
||||
without evidence on sight, but nothing enforced it; `unverified` claims
|
||||
nothing, so its `evidence` stays optional. Cross-file rules (slug format,
|
||||
duplicates, link provenance, invisible characters, quarantine) are L2,
|
||||
`scripts/validate-data.mjs` (docs/03 §2).
|
||||
|
||||
## 2. Field reference
|
||||
|
||||
@@ -73,26 +99,26 @@ contract (docs/03 §6) never silently grows.
|
||||
| `platforms` | enum[] | Desktop only. An app available elsewhere still lists only its desktop targets. |
|
||||
| `pricing` | enum | See §5 — this encodes inclusion criterion C2/C3. |
|
||||
| `license` | SPDX \| null | `null` = closed source (renders no badge). Use exact SPDX ids: `GPL-3.0-only`, `MIT`, `LGPL-2.1-or-later`… "Open Source" UI badge = `license !== null`. |
|
||||
| `links.homepage` | https URL | Developer's official domain. |
|
||||
| `links.homepage` | https URL | Developer's official domain. L2 refuses download portals, IDN (`xn--`) hosts and tracking parameters (docs/03 §2). |
|
||||
| `links.repo` | https URL \| null | Official GitHub/GitLab/Codeberg… only. |
|
||||
| `links.download` | https URL | Official download page (page, not direct binary, when both exist). |
|
||||
| `security.status` | enum | `unverified` (default at entry) · `clean` (vetting checklist passed, docs/09 §6) · `flagged` (blocks listing → quarantine, docs/03 §5). |
|
||||
| `security.evidence` | URL \| null | VirusTotal scan of the download page/file, or vendor advisory. Required when `flagged`; recommended when `clean`. |
|
||||
| `security.checkedAt` | date | Date the status was last verified — rendered on the card ("checked 2026-07-15"). |
|
||||
| `addedAt` / `updatedAt` | date | Drive RSS + "Latest additions" + sort. |
|
||||
| `security.evidence` | https URL \| null | VirusTotal scan of the download page/file, or vendor advisory. **Required by the schema when `clean` or `flagged`** (since v1.1); optional for `unverified`, though held entries carry theirs too. Linked from the detail page ("View scan", docs/06 §5). |
|
||||
| `security.checkedAt` | date | Date of the latest scan behind the status — rendered on the card ("checked 30 Jul 2026"). The full docs/09 §6 checklist runs when an entry is first marked `clean` and whenever its links change; `vt-recheck.yml` re-scans at least every 90 days and moves this date (never `addedAt`/`updatedAt`). A real date, not in the future; `validate:data` warns once it is older than 180 days. |
|
||||
| `addedAt` / `updatedAt` | date | Drive RSS, the "Newest" sort and category-page order. Real dates, not in the future; `updatedAt` ≥ `addedAt`. |
|
||||
|
||||
## 3. Pricing semantics (rulings)
|
||||
|
||||
| Value | Meaning | Examples |
|
||||
|---|---|---|
|
||||
| `free` | Fully usable forever at $0. Includes freemium products **whose free tier alone is self-sufficient** even if the paid upgrade is a subscription (criterion C3). | VLC, 7-Zip, Bitwarden (free tier) |
|
||||
| `free-onetime` | Free tier + optional **single lifetime payment** unlock. | — (tag on entry) |
|
||||
| `onetime` | Paid once, perpetual license, optional paid major upgrades allowed. | Affinity Photo, Sublime Text |
|
||||
| `free` | Fully usable forever at $0. Includes freemium products **whose free tier alone is self-sufficient** even if the paid upgrade is a subscription (criterion C3). | VLC, 7-Zip, Bitwarden (free tier) — 354 entries |
|
||||
| `free-onetime` | Free tier + optional **single lifetime payment** unlock. | FreeFileSync, eM Client, HWiNFO, Shottr, AltTab — 17 entries |
|
||||
| `onetime` | Paid once, perpetual license, optional paid major upgrades allowed. | Sublime Text, REAPER, Total Commander, Fork — 19 entries |
|
||||
| *(excluded)* | Subscription required for core desktop use; time-limited trials; crippled demos. | Adobe CC, MS 365 |
|
||||
|
||||
Ambiguous cases → decision log (docs/15 §4) before merge.
|
||||
|
||||
## 4. Category registry (initial 12)
|
||||
## 4. Category registry (12 at launch, 14 since 2026-10-23, 15 since 2026-11-09)
|
||||
|
||||
`src/data/categories.json` — id · EN · VI · lucide icon:
|
||||
|
||||
@@ -110,13 +136,22 @@ Ambiguous cases → decision log (docs/15 §4) before merge.
|
||||
| `file-management` | File Management | Quản lý tệp | `folder` |
|
||||
| `gaming` | Gaming Tools | Công cụ chơi game | `gamepad-2` |
|
||||
| `system` | System Tools | Công cụ hệ thống | `cpu` |
|
||||
| `ai-local` | Local AI | AI cục bộ | `brain-circuit` |
|
||||
| `cad-3d` | CAD & 3D | CAD & 3D | `drafting-compass` |
|
||||
| `accessibility` | Accessibility | Trợ năng | `accessibility` |
|
||||
|
||||
Adding a category = PR editing this file + decision-log line (keeps the
|
||||
taxonomy from sprawling).
|
||||
taxonomy from sprawling). `ai-local` and `cad-3d` came with catalogue
|
||||
batch 2 (D31): models that run on your own machine, and CAD/EDA/3D-printing
|
||||
tools. `accessibility` came with catalogue batch 3 (D34, v1.4): assistive
|
||||
technology — screen readers, text-to-speech, eye-tracking input, accessible
|
||||
readers — and the tools for checking accessibility. The categories page
|
||||
counts them itself (`categories.intro` and `meta.categories` take `{n}`), so
|
||||
a new row needs no copy change.
|
||||
|
||||
## 5. Example files
|
||||
|
||||
`src/data/apps/7-zip.json` — free, open source:
|
||||
`src/data/apps/7-zip.json` — free, open source (the shipped file):
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -137,34 +172,44 @@ taxonomy from sprawling).
|
||||
"repo": null,
|
||||
"download": "https://www.7-zip.org/download.html"
|
||||
},
|
||||
"security": { "status": "clean", "evidence": null, "checkedAt": "2026-07-15" },
|
||||
"addedAt": "2026-07-15"
|
||||
"security": {
|
||||
"status": "clean",
|
||||
"evidence": "https://www.virustotal.com/gui/url/273d0beedb411e020dd6ce34a46330b626a4ed56df427f806c4c552ea5c287e7",
|
||||
"checkedAt": "2026-07-30"
|
||||
},
|
||||
"addedAt": "2026-07-28"
|
||||
}
|
||||
```
|
||||
|
||||
`src/data/apps/affinity-photo.json` — one-time purchase, closed source:
|
||||
`src/data/apps/sublime-text.json` — one-time purchase, closed source (the
|
||||
shipped file). It replaces the earlier Affinity Photo example: the catalogue
|
||||
lists today's Affinity (Canva) as `free`.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Affinity Photo",
|
||||
"developer": "Serif (Europe) Ltd",
|
||||
"logo": "simple-icons:affinityphoto",
|
||||
"name": "Sublime Text",
|
||||
"developer": "Sublime HQ Pty Ltd",
|
||||
"logo": "simple-icons:sublimetext",
|
||||
"summary": {
|
||||
"en": "Professional photo editor sold as a one-time purchase — a perpetual-license alternative to subscription editors.",
|
||||
"vi": "Trình chỉnh sửa ảnh chuyên nghiệp bán theo hình thức mua đứt một lần — thay thế cho các trình chỉnh sửa thuê bao."
|
||||
"en": "Native code editor known for fast startup, multiple cursors and project-wide Goto Anything search.",
|
||||
"vi": "Trình soạn thảo mã gốc, khởi động nhanh, hỗ trợ nhiều con trỏ và tìm kiếm Goto Anything toàn dự án."
|
||||
},
|
||||
"categories": ["graphics"],
|
||||
"tags": ["photo-editing", "raw"],
|
||||
"platforms": ["windows", "macos"],
|
||||
"categories": ["ide-editor", "developer-tools"],
|
||||
"tags": ["native", "multiple-cursors", "plugins", "cross-platform"],
|
||||
"platforms": ["windows", "macos", "linux"],
|
||||
"pricing": "onetime",
|
||||
"license": null,
|
||||
"links": {
|
||||
"homepage": "https://affinity.serif.com",
|
||||
"homepage": "https://www.sublimetext.com",
|
||||
"repo": null,
|
||||
"download": "https://affinity.serif.com/photo/"
|
||||
"download": "https://www.sublimetext.com/download"
|
||||
},
|
||||
"security": { "status": "unverified", "evidence": null, "checkedAt": "2026-07-15" },
|
||||
"addedAt": "2026-07-15"
|
||||
"security": {
|
||||
"status": "clean",
|
||||
"evidence": "https://www.virustotal.com/gui/url/50dc606906fd62b2283cc55dde1d5f1d85407d0a38a1883ef35c81ede28f0c49",
|
||||
"checkedAt": "2026-07-30"
|
||||
},
|
||||
"addedAt": "2026-07-28"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -184,7 +229,7 @@ and the renderer draws the initials (D23). VSCodium itself now resolves to
|
||||
"vi": "Bản dựng cộng đồng từ mã nguồn VS Code, đã loại bỏ telemetry và thương hiệu của Microsoft."
|
||||
},
|
||||
"categories": ["ide-editor", "developer-tools"],
|
||||
"tags": ["editor", "open-source-build"],
|
||||
"tags": ["editor", "open-source-build", "no-telemetry"],
|
||||
"platforms": ["windows", "macos", "linux"],
|
||||
"pricing": "free",
|
||||
"license": "MIT",
|
||||
@@ -193,13 +238,24 @@ and the renderer draws the initials (D23). VSCodium itself now resolves to
|
||||
"repo": "https://github.com/VSCodium/vscodium",
|
||||
"download": "https://github.com/VSCodium/vscodium/releases"
|
||||
},
|
||||
"security": { "status": "clean", "evidence": null, "checkedAt": "2026-07-15" },
|
||||
"addedAt": "2026-07-15"
|
||||
"security": {
|
||||
"status": "clean",
|
||||
"evidence": "https://www.virustotal.com/gui/url/0f460f5b6220092a8f378b0ad71922d549d99331e352143c1ef9e2ed4f83f0a5",
|
||||
"checkedAt": "2026-07-30"
|
||||
},
|
||||
"addedAt": "2026-07-28"
|
||||
}
|
||||
```
|
||||
|
||||
As of batch 4 (2026-11-24) no entry uses `local:` (`src/assets/logos/` does
|
||||
not exist yet): 130 entries use `simple-icons:`, 260 `monogram` (390 in all).
|
||||
|
||||
## 6. Quarantine files
|
||||
|
||||
Schema-identical (§1) — the file simply lives in `data/quarantine/` and
|
||||
keeps `status: "flagged"`. Reason/evidence/date live in the linked issue and
|
||||
commit message (docs/03 §5), so restoring is a plain `git mv` + status edit.
|
||||
keeps `status: "flagged"` (which, since v1.1, also means it carries an
|
||||
`evidence` URL). Reason/evidence/date live in the linked issue and commit
|
||||
message (docs/03 §5). `pnpm quarantine` moves a flagged file there;
|
||||
restoring is a reviewed PR that moves it back (`git mv`) and edits the
|
||||
status — `validate:data` refuses a quarantined file that no longer says
|
||||
`flagged`, and a slug that is live and quarantined at once.
|
||||
@@ -38,34 +38,40 @@ decomposed sequences. `normalize('NFD')` unifies both before stripping.
|
||||
|
||||
Applied at **build time** to index fields and at **query time** via
|
||||
MiniSearch's `processTerm` — the same function on both sides, imported from
|
||||
one module (never duplicated).
|
||||
one module (never duplicated). The same fold keys the name sort
|
||||
(`compareNames`, §A3). The one deliberate copy lives in
|
||||
`scripts/validate-data.mjs`, which runs in plain Node and cannot import from
|
||||
`src/`; it is used only to catch duplicate names (docs/03 §2).
|
||||
|
||||
## A2 — Search index & query (MiniSearch)
|
||||
|
||||
```ts
|
||||
// src/lib/search.ts
|
||||
import MiniSearch from 'minisearch';
|
||||
// src/lib/searchOptions.ts — shared verbatim by the build-time indexer
|
||||
// (search.ts → search-index.json.ts) and the client loader (searchIndex.ts).
|
||||
// Deliberately free of any `minisearch` import (see below).
|
||||
import { normalizeViet } from './normalize';
|
||||
|
||||
export const FUZZY = 0.25; // D22 — measured, see below
|
||||
|
||||
export const miniSearchOptions = {
|
||||
idField: 'slug',
|
||||
fields: ['name', 'tags', 'summaryEn', 'summaryVi'], // raw values, not pre-normalized
|
||||
// No storeFields: MiniSearch already returns the id on every result, and
|
||||
// display data is in the DOM (A3). Storing anything here just inflates
|
||||
// /search-index.json.
|
||||
extractField: (doc, field) => {
|
||||
extractField: (doc: Record<string, unknown>, field: string): string => {
|
||||
const v = doc[field];
|
||||
return Array.isArray(v) ? v.join(' ') : v; // `tags` is string[] — be explicit
|
||||
return Array.isArray(v) ? v.join(' ') : ((v as string | undefined) ?? '');
|
||||
},
|
||||
processTerm: (t: string) => {
|
||||
processTerm: (t: string): string | null => {
|
||||
const n = normalizeViet(t);
|
||||
return n.length > 0 ? n : null; // null drops the term
|
||||
},
|
||||
searchOptions: {
|
||||
prefix: true,
|
||||
fuzzy: 0.15, // PROVISIONAL — S2 sets the real value, see below
|
||||
fuzzy: FUZZY,
|
||||
boost: { name: 3, tags: 2, summaryEn: 1, summaryVi: 1 },
|
||||
combineWith: 'AND',
|
||||
combineWith: 'AND' as const,
|
||||
},
|
||||
} as const;
|
||||
```
|
||||
@@ -77,11 +83,29 @@ export const miniSearchOptions = {
|
||||
add pre-normalized `nameNorm`/`summaryEnNorm` copies: they would double the
|
||||
index and give `boost` two sets of keys to disagree about.
|
||||
- Index is built in `src/pages/search-index.json.ts` at build time
|
||||
(`MiniSearch.addAll` over the collection → `JSON.stringify(mini)`), then
|
||||
`MiniSearch.loadJSON` on the client — zero client-side indexing cost.
|
||||
- Lazy-load on first focus/keystroke of the search input; show a subtle
|
||||
"loading index…" state for the (rare) slow fetch.
|
||||
- Empty query ⇒ search layer passes *all* slugs through to A3.
|
||||
(`buildIndex()` in `src/lib/search.ts`: `addAll` over the collection →
|
||||
`JSON.stringify`), then `MiniSearch.loadJSON` on the client — zero
|
||||
client-side indexing cost.
|
||||
- **Client loader** (`src/lib/searchIndex.ts`): on the first focus or
|
||||
keystroke it fetches `/search-index.json` **and** pulls MiniSearch in with
|
||||
a dynamic `import('minisearch')` — the library used to ship in `/apps`'
|
||||
static bundle. One promise per page, shared by every caller, so a burst of
|
||||
keystrokes costs one download. A non-OK response or a failed import
|
||||
rejects, clears the cached promise (the next keystroke retries) and puts
|
||||
the island in an error state: "Search is unavailable right now — the
|
||||
filters still work" (`search.error`). The facets never depend on the index
|
||||
(A3).
|
||||
- **Query flow** (`ShSearch.svelte`): input is debounced **150 ms**, then
|
||||
the trimmed query goes to `query` and a **sequence number** is taken; a
|
||||
result that arrives after a newer query (or after the box was emptied) is
|
||||
dropped, so a late index can never filter the grid behind an empty box.
|
||||
The hits, in MiniSearch's rank order, go to the grid controller (A3).
|
||||
A subtle "loading" label shows while the fetch is in flight.
|
||||
- **Relevance order.** While a query is active the sort switches from A–Z
|
||||
to "Best match" (`relevance`) — unless the visitor has picked an order
|
||||
themselves; emptying the query switches back.
|
||||
- Empty query ⇒ the search layer constrains nothing (`setSearchHits(null)`),
|
||||
i.e. *all* slugs pass through to A3. Esc clears the box first, then blurs.
|
||||
|
||||
**`fuzzy = 0.25` — settled by measurement in S2 (2026-07-27), decision D22.**
|
||||
MiniSearch converts the fraction to `round(term.length × fuzzy)` edits. The
|
||||
@@ -110,7 +134,12 @@ by turning the constant up.
|
||||
## A3 — Filter & sort composition
|
||||
|
||||
State (nanostores, `src/lib/stores.ts`): `query`, `categories: Set`,
|
||||
`platforms: Set`, `pricing: Set`, `sort: 'name' | 'added'`.
|
||||
`platforms: Set`, `pricing: Set`, `sort: 'name' | 'added' | 'relevance'`,
|
||||
plus `visibleCount` (written by the grid, read by the filter sheet's "Show N
|
||||
apps"). `clearAll()` empties the query **and** every facet — before v1.1
|
||||
"Clear all" reset the facets while the box kept its text and the grid stayed
|
||||
filtered by it. The atoms live for one page: every navigation is a full
|
||||
document load (docs/02 §6), and the URL is the durable copy (below).
|
||||
|
||||
**Export the atoms WITHOUT the `$` prefix** that nanostores' own docs use.
|
||||
Svelte reserves `$` for store auto-subscription, so `import { $query }` in a
|
||||
@@ -121,35 +150,81 @@ side that gives (found in M3).
|
||||
|
||||
**Where the logic lives.** The composition and sort below are pure functions in
|
||||
`src/lib/filter.ts`, unit-tested without a DOM. `src/lib/grid.ts` is the thin
|
||||
layer that reads the `data-*` facets off the cards and writes `hidden` /
|
||||
`order`. Neither is an island: docs/02 §5 fixes the count at six, so
|
||||
`ShSearch` mounts the grid controller rather than a seventh island existing.
|
||||
layer that reads the `data-*` facets off the cards, toggles `hidden` and
|
||||
reorders the card nodes. Neither is an island: docs/02 §5 fixes the count at
|
||||
six, so `ShSearch` mounts the grid controller rather than a seventh island
|
||||
existing.
|
||||
|
||||
Reordering uses **CSS `order`, not DOM moves** — moving nodes on every
|
||||
keystroke would drop focus and restart the entrance animation.
|
||||
Reordering uses **real DOM moves** (`insertBefore`, walking the desired
|
||||
order against the live child list so an unchanged order costs zero writes)
|
||||
and never `el.style.*`. An earlier version set `el.style.order`, which CSP
|
||||
`style-src` silently refuses — sorting was broken in production while every
|
||||
build gate passed (2026-07-30, docs/15 §4). DOM moves also keep tab order
|
||||
equal to visual order; nothing is lost, because cards carry no entrance
|
||||
animation and every control that drives the grid lives outside it.
|
||||
|
||||
**Where the facet data comes from.** Every card wrapper is server-rendered
|
||||
with `data-slug`, `data-categories`, `data-platforms`, `data-pricing`,
|
||||
`data-added` (docs/06 §6). The filter island reads those attributes and
|
||||
nothing else. This matters: `/search-index.json` is lazy-loaded on first
|
||||
search interaction, so filtering and sorting **must not depend on it** — a
|
||||
user who only clicks facets never triggers that fetch, and one who filters
|
||||
before the index lands must still get correct results.
|
||||
with `data-slug`, `data-name`, `data-categories`, `data-platforms`,
|
||||
`data-pricing`, `data-added` (docs/06 §6). The grid controller reads those
|
||||
attributes and nothing else. This matters: `/search-index.json` is
|
||||
lazy-loaded on first search interaction, so filtering and sorting **must not
|
||||
depend on it** — a user who only clicks facets never triggers that fetch,
|
||||
and one who filters before the index lands must still get correct results.
|
||||
|
||||
```
|
||||
visible = searchResults(query) // A2, or ALL if query empty
|
||||
∩ (categories empty ? ALL : app.categories ∩ selected ≠ ∅)
|
||||
∩ (platforms empty ? ALL : app.platforms ∩ selected ≠ ∅)
|
||||
∩ (pricing empty ? ALL : app.pricing ∈ selected)
|
||||
sorted: name → localeCompare on normalizeViet(name)
|
||||
added → addedAt desc, tiebreak name
|
||||
sorted: name → compareNames(a.name, b.name)
|
||||
added → addedAt desc, tiebreak compareNames
|
||||
relevance → MiniSearch rank; unranked cards fall back to compareNames
|
||||
```
|
||||
|
||||
**`compareNames`** is `Intl.Collator('en', { sensitivity: 'base', numeric:
|
||||
true })` over `normalizeViet(name)` (keys cached per name). It is THE name
|
||||
order wherever a list is sorted by name — the grid, category pages
|
||||
(`byAddedDesc` in `src/lib/paths.ts`) and the detail page's "More in
|
||||
<category>" — so they cannot disagree. Pinned to `en` on purpose: a bare
|
||||
`localeCompare()` collates by the visitor's browser locale (a Czech browser
|
||||
moved 81 of 326 cards, because "ch" sorts after "h" there) or, at build time,
|
||||
by whatever ICU default the build machine has. `numeric` puts "7-Zip" before
|
||||
"10…". The server renders `/apps` in the same A–Z order, so hydration never
|
||||
reshuffles the grid.
|
||||
|
||||
Semantics: **OR within a facet, AND across facets** (industry-standard
|
||||
faceting). The grid is fully server-rendered; filtering toggles `hidden` on
|
||||
card wrappers via slug lookup — no client re-render of card content, so
|
||||
disabled-JS users still see everything (docs/03 §8). Result count is
|
||||
announced via `aria-live="polite"`.
|
||||
disabled-JS users still see everything (docs/03 §8).
|
||||
|
||||
**Result count.** `#sh-count` is server-rendered with the true total and
|
||||
announced via `aria-live="polite"`. It carries one template per plural
|
||||
category (`data-count-one`, `data-count-other`); the controller picks with
|
||||
`Intl.PluralRules(<html lang>)` and formats the number with
|
||||
`Intl.NumberFormat`, and writes only when the text changed (identical text in
|
||||
a live region is re-announced). The empty state (`#sh-empty`) is revealed
|
||||
only once filtering really yields nothing, never while the index loads.
|
||||
|
||||
**View state in the URL** (`src/lib/urlstate.ts`, v1.1). The view
|
||||
round-trips through the query string, so it can be shared, survives a reload
|
||||
and Back, and follows a language switch (`ShLangSwitch` carries
|
||||
`location.search` + `location.hash`):
|
||||
|
||||
```
|
||||
/apps?q=trinh+duyet&cat=browser,utilities&platform=linux&pricing=free&sort=added
|
||||
```
|
||||
|
||||
- `ShSearch` parses it when it mounts (`client:idle`, so a shared link
|
||||
first paints the full grid, then narrows); writes go through
|
||||
`history.replaceState` **300 ms** after the view stops changing — no
|
||||
history entry per keystroke.
|
||||
- Facet values must look like slugs (`^[a-z0-9]+(?:-[a-z0-9]+)*$`); anything
|
||||
else is noise and dropped. Lists are de-duplicated and written in a stable
|
||||
order; `q` is trimmed and capped at 200 characters.
|
||||
- `sort` is written only when the visitor chose it and it is not the
|
||||
default `name`; an automatic "Best match" order is implied by `q`.
|
||||
- `#search` on `/apps` focuses the search box — the welcome page's search
|
||||
field and the header's search hint are links to it.
|
||||
|
||||
## A4 — Feed generation
|
||||
|
||||
@@ -170,66 +245,126 @@ Two implementation notes from M5:
|
||||
asserted by building twice and comparing hashes — `/rss.xml` is byte-
|
||||
identical, while `/api/apps.json` legitimately differs because
|
||||
`generatedAt` is a build timestamp (docs/03 §6).
|
||||
- **The tie-break collator is pinned** — `Intl.Collator('en')`, not a bare
|
||||
`localeCompare()`. Builds run on the CI runner's container, the deploy
|
||||
job and laptops; if two machines' ICU defaults disagreed, the 50-item window could
|
||||
change membership between builds and notify.py would announce apps that
|
||||
are not new. `en` matches the order production served at launch (checked
|
||||
byte-for-byte against the live feed). `/api/apps.json` is likewise sorted
|
||||
by slug in code-unit order, independent of the build machine.
|
||||
|
||||
**`scripts/check-feed.mjs`** (in `pnpm build` since v1.1) asserts what was
|
||||
actually **emitted**, because the guid is injected through `customData` — a
|
||||
seam no unit test sees and a dependency update could break with every test
|
||||
green: 1–50 items; exactly one `<guid isPermaLink="false">` per item holding
|
||||
the slug of an app that exists in `src/data/apps/`; guids unique; `<link>`
|
||||
is that app's page; `<pubDate>` parses and items run newest first.
|
||||
|
||||
## A5 — Console ring buffer
|
||||
|
||||
```ts
|
||||
// src/lib/ringbuffer.ts — module-level singleton, ~30 LOC
|
||||
const CAP = 20;
|
||||
const buf: string[] = [];
|
||||
function push(line: string) {
|
||||
buf.push(`[${new Date().toISOString()}] ${line}`.slice(0, 500));
|
||||
if (buf.length > CAP) buf.shift();
|
||||
}
|
||||
window.addEventListener('error', (e) =>
|
||||
push(`error: ${e.message} @ ${e.filename}:${e.lineno}`));
|
||||
window.addEventListener('unhandledrejection', (e) =>
|
||||
push(`unhandledrejection: ${String(e.reason).slice(0, 400)}`));
|
||||
export const getBuffer = () => buf.join('\n');
|
||||
```js
|
||||
// src/scripts/errors.js — plain classic script (abridged)
|
||||
(() => {
|
||||
var CAP = 20, MAX_LINE = 500;
|
||||
var buf = (window.__shErrors = window.__shErrors || []);
|
||||
var seen = Object.create(null); // one line per distinct failure
|
||||
function push(line) {
|
||||
var key = line.slice(0, 200);
|
||||
if (seen[key]) return;
|
||||
seen[key] = true;
|
||||
buf.push(('[' + new Date().toISOString() + '] ' + location.pathname +
|
||||
' ' + line).slice(0, MAX_LINE));
|
||||
if (buf.length > CAP) buf.shift();
|
||||
}
|
||||
// error (own-origin scripts only) · unhandledrejection (first two stack
|
||||
// lines) · securitypolicyviolation · astro:hydration-error
|
||||
…
|
||||
})();
|
||||
```
|
||||
|
||||
**The buffer cannot live in the island.** `ShBugReport` is `client:visible` in
|
||||
the footer (docs/02 §5), so listeners attached at hydration would miss every
|
||||
error that happened before the user scrolled — which is most of them, and
|
||||
exactly the ones a bug report is about. The listeners therefore ship in
|
||||
`public/errors.js`, loaded `defer` from `Base.astro`, and the two halves meet
|
||||
on `window.__shErrors`; `src/lib/ringbuffer.ts` is only the reader. External
|
||||
file, so no CSP hash is needed (docs/09 §4).
|
||||
`src/scripts/errors.js`, and the two halves meet on `window.__shErrors`;
|
||||
`src/lib/ringbuffer.ts` is only the reader (`getBuffer()`, `bufferSize()`).
|
||||
|
||||
Privacy: captures only exception text from our own origin; never wraps
|
||||
`console.*`, never touches input values, never leaves the page until the
|
||||
user explicitly opens a bug report (A6).
|
||||
**Loaded first, blocking.** `errors.js` is the first script in `<head>`,
|
||||
before `theme.js` and any island bootstrap — until v1.1 it was `defer`red,
|
||||
so it missed exactly the early failures a report needs. `Base.astro`
|
||||
imports it with `?url&no-inline`: a content-hashed, immutable `/_astro/`
|
||||
file covered by `script-src 'self'` with no hash (docs/09 §4).
|
||||
|
||||
What it records, each line stamped with time and page path and
|
||||
de-duplicated so a failure in a loop cannot flush the rest:
|
||||
|
||||
- uncaught errors from **our own origin** — extension and third-party
|
||||
script errors are skipped: not our bugs, and their URLs would reveal which
|
||||
extensions a visitor runs;
|
||||
- unhandled promise rejections;
|
||||
- **CSP violations** (`securitypolicyviolation`). The policy is a `<meta>`
|
||||
tag, which cannot carry `report-uri`/`report-to`, so this event is the
|
||||
only place a refused script or style ever surfaces;
|
||||
- island hydration failures, which Astro catches and re-dispatches as
|
||||
`astro:hydration-error` instead of letting them reach `window.onerror`.
|
||||
|
||||
The footer link shows the count ("3 errors") when the buffer is non-empty.
|
||||
|
||||
Privacy: in-memory only, for the life of the page; never wraps `console.*`,
|
||||
never touches input values, and nothing leaves the page unless the visitor
|
||||
opens a bug report (A6).
|
||||
|
||||
## A6 — Bug-report URL builder
|
||||
|
||||
GitHub Issue Forms prefill fields via query params matching each field `id`
|
||||
in `bug_report.yml` (docs/12 §7).
|
||||
Since D38 (2026-11-24) the report is a new issue on the **GitLab mirror**:
|
||||
the Gitea that holds the source takes no outside sign-ups. GitLab has no
|
||||
issue *forms* to prefill field by field, so the builder writes one Markdown
|
||||
description in the layout of `.gitlab/issue_templates/Bug.md` (docs/12 §7) —
|
||||
change the two together. The addresses live in `src/lib/forge.ts`.
|
||||
|
||||
```ts
|
||||
// src/lib/issueUrl.ts
|
||||
const REPO = 'https://github.com/poli0981/softharbor';
|
||||
const BUDGET = 5500; // conservative total-URL budget; verified by spike S3
|
||||
// src/lib/issueUrl.ts (abridged)
|
||||
export const BUG_FORM_URL = newIssue('Bug'); // …/-/issues/new?issuable_template=Bug
|
||||
export const BUDGET = 5000; // total-URL budget (below)
|
||||
|
||||
export function buildBugUrl(consoleText: string): string {
|
||||
const u = new URL(`${REPO}/issues/new`);
|
||||
u.searchParams.set('template', 'bug_report.yml');
|
||||
u.searchParams.set('labels', 'bug');
|
||||
u.searchParams.set('page-url', location.href);
|
||||
u.searchParams.set('environment',
|
||||
`${navigator.userAgent} · lang=${document.documentElement.lang}`);
|
||||
// newest lines matter most → truncate from the head
|
||||
export function bugDescription(consoleText: string, ctx: BugContext): string {
|
||||
const logs = consoleText || '(buffer empty)';
|
||||
const fence = fenceFor(logs); // more backticks than the logs hold
|
||||
return ['### Page URL', '', ctx.href, '',
|
||||
'### What happened / expected', '', '<!-- … -->', '',
|
||||
'### Browser & OS', '', `${ctx.userAgent} · lang=${ctx.lang}`, '',
|
||||
'### Console output', '', `${fence}shell`, logs, fence].join('\n');
|
||||
}
|
||||
|
||||
export function buildBugUrl(consoleText: string, context?: BugContext): string {
|
||||
const ctx = context ?? currentContext(); // { href, userAgent, lang }
|
||||
const url = (logs: string) => {
|
||||
const u = new URL(NEW_ISSUE_URL); // https://gitlab.com/poli0981/softharbor/-/issues/new
|
||||
u.searchParams.set('issue[title]', 'Bug: ');
|
||||
u.searchParams.set('issue[description]', bugDescription(logs, ctx));
|
||||
return u.toString();
|
||||
};
|
||||
// Newest lines matter most, so truncate from the head — measured on the
|
||||
// REAL encoded URL, not an estimate.
|
||||
let logs = consoleText;
|
||||
const overhead = () => u.toString().length + encodeURIComponent(logs).length;
|
||||
while (logs.length > 0 && overhead() > BUDGET) {
|
||||
logs = logs.slice(logs.indexOf('\n') + 1 || logs.length);
|
||||
while (logs.length > 0 && url(logs).length > BUDGET) {
|
||||
const nl = logs.indexOf('\n');
|
||||
logs = nl === -1 ? '' : logs.slice(nl + 1);
|
||||
}
|
||||
u.searchParams.set('console-output', logs || '(buffer empty)');
|
||||
return u.toString();
|
||||
return url(logs);
|
||||
}
|
||||
```
|
||||
|
||||
**`BUDGET = 5000`** — measured by spike S3 against github.com (2026-07-27,
|
||||
two probes per length):
|
||||
`ShBugReport` rebuilds the URL on hover, focus and click — it embeds the
|
||||
*current* page and buffer — and renders a real `<a target="_blank">`, so the
|
||||
visitor can see, copy or middle-click the target. Before hydration (or
|
||||
without JS) it points at `BUG_FORM_URL`, the bare template. Opening it sends
|
||||
the prefilled report to GitLab as URL parameters; nothing is filed until the
|
||||
visitor submits the issue (docs/09 §8). A signed-out visitor is sent to
|
||||
GitLab's sign-in first.
|
||||
|
||||
**`BUDGET = 5000`** — first measured by spike S3 against github.com
|
||||
(2026-07-27, two probes per length):
|
||||
|
||||
| Total URL length | GitHub response |
|
||||
|---|---|
|
||||
@@ -238,54 +373,165 @@ two probes per length):
|
||||
| ~8 160 | connection reset |
|
||||
| ≥ 8 360 | `414` URI Too Long |
|
||||
|
||||
The important part is the *shape*: GitHub does not degrade gracefully into a
|
||||
414. There is a ~1.3 KB band where it plainly 500s, and the only person who
|
||||
ever meets it is a user who just clicked "Report a bug" — the worst possible
|
||||
moment for an error page. So the budget sits **~25 % below the first observed
|
||||
failure (6 660)**, not at 80 % of the hard 414 limit: 80 % of 8 360 is 6 688,
|
||||
which lands inside the 500 band. Re-measure if GitHub changes; the constant is
|
||||
an observation, not a standard.
|
||||
GitHub did not degrade gracefully into a 414: there was a ~1.3 KB band where
|
||||
it plainly 500'd, and the only person who ever meets it is a user who just
|
||||
clicked "Report a bug". So the budget sat **~25 % below the first observed
|
||||
failure (6 660)**.
|
||||
|
||||
Re-measured against **gitlab.com** on 2026-11-24, on this project's
|
||||
new-issue URL with `issuable_template`, `issue[title]` and a padded
|
||||
`issue[description]` (signed out, so a success is the redirect to sign-in):
|
||||
|
||||
| Total URL length | GitLab response |
|
||||
|---|---|
|
||||
| 4 000 · 5 000 · 6 500 · 8 000 | `302` → `/users/sign_in` |
|
||||
| 12 000 | `400` |
|
||||
|
||||
The same budget is well inside what GitLab takes, so it stays. Re-measure if
|
||||
GitLab changes; the constant is an observation, not a standard.
|
||||
|
||||
## A7 — Legal-gate version check
|
||||
|
||||
```ts
|
||||
export const LEGAL_VERSION = '2026-07-15'; // bump when any legal doc changes
|
||||
// src/lib/legal.ts (abridged)
|
||||
/** Version of the ACCEPTED set — bump when one of those three changes. */
|
||||
export const LEGAL_VERSION = '2026-10-21';
|
||||
export const ACCEPTED_DOCS = ['disclaimer', 'privacy', 'terms'] as const;
|
||||
/** Each document's own "Last updated" (docs/14 Part 2). */
|
||||
export const LEGAL_UPDATED: Readonly<Record<LegalDoc, string>> = { /* six dates */ };
|
||||
|
||||
const KEY = 'sh:legal';
|
||||
export const isAccepted = () => localStorage.getItem(KEY) === LEGAL_VERSION;
|
||||
export const accept = () => localStorage.setItem(KEY, LEGAL_VERSION);
|
||||
const MEM_KEY = '__shLegalAcceptedThisSession'; // on globalThis
|
||||
|
||||
export function isAccepted(): boolean {
|
||||
if (globalThis[MEM_KEY] === true) return true;
|
||||
try { return localStorage.getItem(KEY) === LEGAL_VERSION; }
|
||||
catch { return false; }
|
||||
}
|
||||
export function acceptLegal(): void {
|
||||
globalThis[MEM_KEY] = true;
|
||||
try { localStorage.setItem(KEY, LEGAL_VERSION); } catch { /* memory carries it */ }
|
||||
}
|
||||
```
|
||||
|
||||
Any value ≠ current version (including old versions) re-opens the gate.
|
||||
Route exemptions and dialog behavior: docs/14 §2. localStorage failures
|
||||
(private mode with storage disabled) fail open *per session*: gate shows
|
||||
once, acceptance held in memory.
|
||||
Any value ≠ current version re-opens the gate — old versions, *newer*
|
||||
versions and garbage alike: equality, never `startsWith`, never ordering.
|
||||
localStorage failures (private mode with storage disabled) fail open *per
|
||||
session*: the gate shows once and acceptance is held in memory. The memory
|
||||
flag lives on `globalThis`, not in a module-local `let`, because its real
|
||||
scope is the session — a module-local also leaked acceptance between tests.
|
||||
|
||||
**Exemptions are declared by the page**, not computed from the path: a page
|
||||
passes `gateExempt` to `Base.astro` and the island is simply not rendered
|
||||
(legal documents, contact, 404, offline, error templates — docs/14 Part 2).
|
||||
The old path regex never matched the cases that mattered: Workers serves
|
||||
`404.html` at whatever URL was requested, and the service worker serves the
|
||||
offline page at the URL that failed.
|
||||
|
||||
Version policy (bump rule, per-document dates, the test that enforces it):
|
||||
docs/14 Part 2. The gate's second step — the human check — is §A9.
|
||||
|
||||
## A8 — Theme resolution (no-flash)
|
||||
|
||||
`public/theme.js` — **not** inline. The strict CSP is `script-src 'self'` with
|
||||
no hashes (docs/09 §4, decision D18), so this ships as a real file loaded by a
|
||||
*blocking* tag in `<head>`, before any stylesheet-dependent paint:
|
||||
|
||||
```html
|
||||
<script src="/theme.js"></script> <!-- no defer, no async: must run pre-paint -->
|
||||
```
|
||||
`src/scripts/theme.js` — a real file, **not** inline, loaded by a *blocking*
|
||||
classic `<script src>` in `<head>` (no `defer`, no `async`, no
|
||||
`type=module`), right after `errors.js` and before any stylesheet-dependent
|
||||
paint. `Base.astro` imports it with `?url&no-inline`, so Vite copies it
|
||||
verbatim to a content-hashed `/_astro/theme.<hash>.js`, cached immutably and
|
||||
covered by `script-src 'self'` without a hash (docs/09 §4). (Until v1.1 it
|
||||
was `public/theme.js` at a fixed path with a revalidating cache.)
|
||||
|
||||
```js
|
||||
// public/theme.js — plain classic script, not a module (modules are deferred).
|
||||
// src/scripts/theme.js — plain classic script (abridged)
|
||||
(() => {
|
||||
const s = localStorage.getItem('sh:theme'); // 'light'|'dark'|null
|
||||
const dark = s ? s === 'dark'
|
||||
: matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
document.documentElement.dataset.theme = dark ? 'dark' : 'light';
|
||||
const read = (key) => { try { return localStorage.getItem(key); }
|
||||
catch { return null; } }; // storage may THROW
|
||||
const root = document.documentElement;
|
||||
const theme = read('sh:theme'); // 'light'|'dark'|null
|
||||
const explicit = theme === 'light' || theme === 'dark' ? theme : null;
|
||||
const dark = explicit ? explicit === 'dark'
|
||||
: matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
root.dataset.theme = dark ? 'dark' : 'light';
|
||||
const scrollbar = read('sh:scrollbar'); // 'thin'|'hidden'|null
|
||||
if (scrollbar === 'thin' || scrollbar === 'hidden') root.dataset.scrollbar = scrollbar;
|
||||
if (read('sh:motion') === 'reduce') root.dataset.motion = 'reduce';
|
||||
if (read('sh:keys') === 'off') root.dataset.keys = 'off'; // v1.4
|
||||
// + marks View Transition promises handled on pageswap/pagereveal
|
||||
})();
|
||||
```
|
||||
|
||||
A render-blocking same-origin script in `<head>` runs before first paint just
|
||||
as an inline one does, so there is no theme flash — the only cost is one
|
||||
request, which is cached and HTTP/2-multiplexed. This file lives in `public/`
|
||||
(copied verbatim to `dist/`) so it is never bundled, hashed, or renamed; the
|
||||
`<script src>` path is therefore stable.
|
||||
as an inline one does, so there is no flash of the wrong theme, scrollbar or
|
||||
motion — the cost is one request, cached immutably. Storage reads are
|
||||
guarded: with site data blocked localStorage *throws*, and an unguarded read
|
||||
used to abort the script and leave dark-OS visitors on the light theme.
|
||||
Unknown or garbage values mean "the default". With scripting off there is no
|
||||
`data-theme` at all and the CSS's `prefers-color-scheme` block applies — kept
|
||||
identical to the dark theme by test (docs/06 §2).
|
||||
|
||||
`ShThemeToggle` cycles system → light → dark (writes/clears `sh:theme`) and
|
||||
keeps `data-theme` in sync with a `change` listener on the media query while
|
||||
in system mode.
|
||||
**The display menu (`ShPrefs`, v1.1)** replaced `ShThemeToggle`: one icon
|
||||
button opens a popover (`popover="auto"`) with four radio groups (the
|
||||
fourth since v1.4).
|
||||
|
||||
| Choice | Values | Storage | Applied as |
|
||||
|---|---|---|---|
|
||||
| Theme | system · light · dark | `sh:theme` (key removed for system) | `html[data-theme]` |
|
||||
| Scrollbar | default · thin · hidden | `sh:scrollbar` (removed for default) | `html[data-scrollbar]` |
|
||||
| Motion | system · reduce | `sh:motion` (removed for system) | `html[data-motion]` |
|
||||
| Keyboard shortcut "/" | on · off | `sh:keys` (removed for on) | `html[data-keys="off"]` — `ShSearch` and `ShPrefs` ignore "/", the header hides its hint, the search placeholder drops "( / )" (WCAG 2.1.4) |
|
||||
|
||||
- While the theme is `system` it follows the OS live (`change` on the
|
||||
media query); an explicit choice stops that.
|
||||
- A `storage` event from another tab re-applies the changed preference here.
|
||||
- "Hidden" removes the scrollbar, never the scrolling; under forced colours
|
||||
the bar is handed back to the system.
|
||||
- The rules are written twice — typed in `src/lib/theme.ts` /
|
||||
`src/lib/prefs.ts` for the island, plain in `theme.js` for pre-paint (it
|
||||
ships unbundled and cannot import). `prefs.test.ts` runs the real script
|
||||
to keep the two identical.
|
||||
- The same island owns the global **`/` shortcut** off `/apps`: it goes to
|
||||
`/apps#search` (on `/apps` `ShSearch` focuses its own box). It never fires
|
||||
inside a text field or while the legal gate is open
|
||||
(`body[data-sh-gate="open"]`, docs/06 §9).
|
||||
|
||||
## A9 — Gate step 2: the human check (`sh:human`)
|
||||
|
||||
The browser half of D25 (`src/lib/turnstile.ts`, `src/lib/human.ts`; the
|
||||
server half and its threat model are docs/09 §4a).
|
||||
|
||||
```
|
||||
gate mounts ─▶ !isAccepted() → step 1 (documents) ─ accept ─┐
|
||||
─▶ accepted ∧ !isHuman() → step 2 directly │
|
||||
─▶ accepted ∧ isHuman() → closed │
|
||||
▼
|
||||
step 2: load api.js (once) ─▶ render Managed widget ─▶ token ─▶ POST /api/verify
|
||||
200 → rememberHuman(48 h) → close
|
||||
anything else→ rememberHuman(1 h) → "check skipped" (1.5 s) → close
|
||||
```
|
||||
|
||||
- **Never before acceptance.** `api.js` is injected only when step 2
|
||||
starts — the documents describing Turnstile are accepted first. One
|
||||
injection per page, shared by concurrent callers; a failed load is
|
||||
forgotten so a later attempt can retry.
|
||||
- **Widget:** `sitekey` `0x4AAAAAAFfEB-RvBz18M-UK` (public by design);
|
||||
Cloudflare's always-pass test sitekey on `localhost`, `127.0.0.1` and
|
||||
`[::1]`. `action: 'legal_gate'` (must equal the Worker's), `appearance:
|
||||
'interaction-only'` (most people never see it), the page's theme and
|
||||
language, `retry: 'never'`, `response-field: false` (no form — the token
|
||||
travels in our own JSON body).
|
||||
- **Timeouts:** 10 s for the whole check; once the widget asks for a click
|
||||
(`before-interactive-callback`) the person gets 120 s instead. The POST
|
||||
itself times out after 8 s.
|
||||
- **Retries:** a `403` (token rejected — spent, stale, minted elsewhere) is
|
||||
answered with a fresh challenge (`reset`), up to 3 attempts. `429`, `503`,
|
||||
a network failure, a widget error, "unsupported" or a timeout all resolve
|
||||
to *unverified* at once. Every path resolves exactly once; none throws.
|
||||
- **`sh:human`** stores an **expiry timestamp** (ms), so the lifetime is
|
||||
decided when the check ends: `PASS_TTL_MS` = 48 h after a pass,
|
||||
`UNVERIFIED_TTL_MS` = 1 h after the gate let someone through unchecked —
|
||||
short enough that an outage is retried soon, long enough not to ask on
|
||||
every page. `isHuman()` rejects values further out than 48 h (not written
|
||||
by us), garbage and the past. Storage failures fall back to a
|
||||
`globalThis` copy for the page, like §A7.
|
||||
- A returning visitor whose check has lapsed sees step 2 only; the
|
||||
documents are not re-shown unless `LEGAL_VERSION` changed.
|
||||
@@ -2,37 +2,71 @@
|
||||
|
||||
## 1. Design direction
|
||||
|
||||
**"Quiet editorial, soft-brutalist."** Warm paper background, ink text, one
|
||||
harbor-blue accent, visible 2 px borders, offset shadows on hover, generous
|
||||
whitespace, type doing the personality work. Explicitly banned: purple/blue
|
||||
AI-gradient hero, glassmorphism blur cards, stock 3D illustrations, emoji as
|
||||
UI icons, more than one accent hue.
|
||||
**"Harbor" (v1.1) — a harbour master's ledger.** Cool chart paper and navy
|
||||
ink by day, a night harbour by night; one harbour-blue accent; hairline
|
||||
rules, soft layered shadows, mono labels for the data, generous whitespace,
|
||||
and type doing the personality work. The welcome hero carries depth
|
||||
contours drawn in pure CSS. This replaced v1.0's "quiet editorial,
|
||||
soft-brutalist" look — the warm paper, 2 px ink borders and *offset* hover
|
||||
shadows are gone.
|
||||
|
||||
Explicitly banned: purple/blue AI-gradient hero, glassmorphism cards (blur
|
||||
is reserved for the sticky header and the modal backdrop), stock 3D
|
||||
illustrations, emoji as UI icons, more than one accent hue, colour as the
|
||||
only carrier of meaning (status icons differ in shape too — §6).
|
||||
|
||||
The site should feel like a well-set reference book you happen to be able to
|
||||
search — calm, dense with information, quietly confident.
|
||||
|
||||
## 2. Design tokens
|
||||
|
||||
Defined once in `src/styles/global.css` via Tailwind v4 `@theme`; every
|
||||
color is a `--sh-*` custom property switched by `html[data-theme]`.
|
||||
Defined once in `src/styles/global.css`; every colour is a `--sh-*` custom
|
||||
property switched by `html[data-theme]`, and Tailwind v4's `@theme` exposes
|
||||
each one as a utility (`--color-sh-muted` → `text-sh-muted`,
|
||||
`bg-sh-surface`, `border-sh-control`, `shadow-sh-2`, …). Utilities — never a
|
||||
`style=` attribute, which CSP `style-src` drops silently (docs/09 §4).
|
||||
|
||||
| Token | Light | Dark | Use |
|
||||
| Token | Light "chart paper" | Dark "night harbour" | Use |
|
||||
|---|---|---|---|
|
||||
| `--sh-bg` | `oklch(0.97 0.01 85)` warm paper | `oklch(0.19 0.01 85)` warm near-black | page background |
|
||||
| `--sh-surface` | `oklch(0.99 0.005 85)` | `oklch(0.23 0.012 85)` | cards, sheets, dialogs |
|
||||
| `--sh-ink` | `oklch(0.22 0.015 75)` | `oklch(0.93 0.008 85)` | primary text, borders |
|
||||
| `--sh-muted` | `oklch(0.48 0.012 75)` | `oklch(0.70 0.01 85)` | secondary text |
|
||||
| `--sh-accent` | `oklch(0.52 0.11 235)` harbor blue | `oklch(0.72 0.10 235)` | links, active filters, focus |
|
||||
| `--sh-accent-ink` | `oklch(0.98 0.005 235)` | `oklch(0.16 0.02 235)` | text on accent |
|
||||
| `--sh-ok` | `oklch(0.55 0.12 150)` | `oklch(0.72 0.12 150)` | "clean" status |
|
||||
| `--sh-warn` | `oklch(0.62 0.13 75)` | `oklch(0.75 0.12 75)` | "unverified" status |
|
||||
| `--sh-danger` | `oklch(0.55 0.19 25)` | `oklch(0.68 0.17 25)` | destructive/flag copy only |
|
||||
| `--sh-border` | = ink | = `oklch(0.42 0.012 85)` | 2 px borders |
|
||||
| `--sh-bg` | `oklch(0.975 0.007 230)` | `oklch(0.17 0.03 255)` | page background |
|
||||
| `--sh-surface` | `oklch(0.995 0.003 230)` | `oklch(0.205 0.034 255)` | cards, panels, dialogs |
|
||||
| `--sh-surface-2` | `oklch(0.952 0.012 232)` | `oklch(0.245 0.036 255)` | tiles, pills, hover fills |
|
||||
| `--sh-ink` | `oklch(0.24 0.035 252)` navy | `oklch(0.94 0.012 230)` | primary text |
|
||||
| `--sh-muted` | `oklch(0.47 0.03 250)` | `oklch(0.75 0.025 240)` | secondary text, placeholders |
|
||||
| `--sh-accent` | `oklch(0.5 0.13 245)` harbour blue | `oklch(0.77 0.11 230)` | links, active state, focus, primary buttons |
|
||||
| `--sh-accent-ink` | `oklch(0.985 0.005 240)` | `oklch(0.18 0.04 255)` | text on accent |
|
||||
| `--sh-accent-soft` | `oklch(0.94 0.03 240)` | `oklch(0.27 0.05 245)` | accent tint (icon tiles, selection) |
|
||||
| `--sh-ok` / `-ok-soft` | `oklch(0.5 0.12 155)` / `oklch(0.95 0.035 155)` | `oklch(0.78 0.13 155)` / `oklch(0.27 0.045 160)` | "clean" status, `free` chip |
|
||||
| `--sh-warn` / `-warn-soft` | `oklch(0.53 0.12 62)` / `oklch(0.95 0.04 75)` | `oklch(0.82 0.12 78)` / `oklch(0.28 0.045 70)` | "unverified" status, `onetime` chip |
|
||||
| `--sh-danger` | `oklch(0.52 0.18 25)` | `oklch(0.74 0.15 25)` | destructive/flag copy only |
|
||||
| `--sh-border` | `oklch(0.88 0.014 240)` | `oklch(0.31 0.03 252)` | **hairline**: separates and frames, never a control's only edge |
|
||||
| `--sh-control` | `oklch(0.6 0.035 248)` | `oklch(0.6 0.03 245)` | visible boundary of inputs, selects, buttons (≥ 3:1, WCAG 1.4.11) |
|
||||
| `--sh-contour` | accent at 14 % | accent at 16 % | welcome-hero depth contours |
|
||||
| `--sh-shadow-1/2/3` | navy-tinted, soft | black, deeper | rest · hover lift · overlays (dialogs, popover) |
|
||||
|
||||
Shape & depth: radius `10px` (cards) / `999px` (pills); border `2px solid
|
||||
var(--sh-border)`; hover shadow `4px 4px 0 var(--sh-border)` (offset, not
|
||||
blurred — the soft-brutalist tell); focus ring `2px` accent, `2px` offset.
|
||||
Spacing: Tailwind default 4 px scale; page gutter `16px` mobile / `24px` ≥ md.
|
||||
Shape & depth: radii `--radius-card` **14px** · `--radius-tile` **12px** ·
|
||||
`--radius-btn` **10px** · `--radius-pill` 999px; borders are **1px**
|
||||
(`--sh-border` hairline for framing, `--sh-control` for anything you can
|
||||
operate); shadows are blurred and layered (`shadow-1` at rest, `shadow-2`
|
||||
on hover lift, `shadow-3` for the gate, the filter sheet and the display
|
||||
menu); focus ring `2px` accent, `2px` offset. Scrollbar colours derive from
|
||||
`--sh-ink` (`color-mix`), so they follow the theme. Spacing: Tailwind
|
||||
default 4 px scale; page gutter `16px` mobile / `24px` ≥ md.
|
||||
|
||||
**Dark mode with JS off.** `theme.js` sets `data-theme` pre-paint (docs/05
|
||||
§A8); with scripting disabled there is no attribute, and a
|
||||
`@media (prefers-color-scheme: dark) { :root:not([data-theme]) { … } }`
|
||||
block applies instead. That block must stay *identical* to
|
||||
`:root[data-theme='dark']` — `src/styles/contrast.test.ts` compares them.
|
||||
|
||||
**Contrast is a test, not a review item.** `contrast.test.ts` reads
|
||||
`global.css`, converts each OKLCH token the way browsers do (OKLab → linear
|
||||
sRGB, gamut-clipped) and checks WCAG 2.2 ratios in **both** themes: `ink` ≥
|
||||
7:1 and `muted`, `accent`, `ok`, `warn`, `danger` ≥ 4.5:1 on `bg`,
|
||||
`surface` and `surface-2`; `control` ≥ 3:1 on all three; `accent-ink` on
|
||||
`accent`, `ok` on `ok-soft`, `accent` on `accent-soft`, `warn` on
|
||||
`warn-soft` and `ink` on `accent-soft` ≥ 4.5:1. A colour tweak that breaks
|
||||
legibility fails `pnpm test`.
|
||||
|
||||
## 3. Typography
|
||||
|
||||
@@ -42,52 +76,93 @@ Spacing: Tailwind default 4 px scale; page gutter `16px` mobile / `24px` ≥ md.
|
||||
| Body / UI | **Be Vietnam Pro** 400 · 500 · 700 | Designed for Vietnamese; excellent diacritic rendering |
|
||||
| Badges / dates / SPDX ids | **IBM Plex Mono** 400 · 500 | Vietnamese subset; gives data a "spec sheet" texture |
|
||||
|
||||
Import only `latin` + `vietnamese` subsets from Fontsource;
|
||||
`font-display: swap`. Fallback stacks end in `system-ui` / `monospace`.
|
||||
Scale (desktop → mobile): display 44/36 · h1 32/28 · h2 24/22 · h3 19/18 ·
|
||||
body 16 · small 14 · mono-badge 12.5. Line-height 1.6 body, 1.15 display.
|
||||
Vietnamese check: stacked diacritics (ậ, ễ, ữ) must not clip at any size —
|
||||
add to visual QA.
|
||||
Unchanged by the v1.1 refresh. Be Vietnam Pro (400/500/700) and IBM Plex
|
||||
Mono (400/500) are imported per subset, `latin` + `vietnamese` only.
|
||||
Bricolage's variable package ships one stylesheet covering vietnamese,
|
||||
latin-ext and latin; each `@font-face` carries a `unicode-range`, so a
|
||||
browser still downloads only the subsets a page uses. `font-display: swap`;
|
||||
fallback stacks end in `system-ui` / `monospace`.
|
||||
|
||||
Scale, as `--text-*` tokens (desktop → mobile below 40 rem): hero 64/42
|
||||
(welcome headline only) · display 44/36 · h1 36/30 · h2 24/22 · h3 19/18 ·
|
||||
body 16 · small 14 · badge 12.5. Line-height 1.6 body, 1.15 headings;
|
||||
headings use `text-wrap: balance`. Vietnamese check: stacked diacritics (ậ,
|
||||
ễ, ữ) must not clip at any size — add to visual QA.
|
||||
|
||||
## 4. Global layout
|
||||
|
||||
**Header (sticky):** wordmark `SoftHarbor` (Bricolage; the "H" may carry a
|
||||
subtle anchor-shaped counter — optional flourish) · nav `Apps · Categories`
|
||||
· search shortcut hint `/` (opens/focuses search on any page) ·
|
||||
`ShLangSwitch` (`EN | VI` text toggle) · `ShThemeToggle`.
|
||||
**Header (sticky, frosted glass):** `.sh-glass` — the page background at
|
||||
80 % with `backdrop-filter: blur(14px) saturate(1.4)` over a hairline
|
||||
bottom rule; without `backdrop-filter` support it is simply opaque. Left to
|
||||
right: the **anchor mark** on an accent tile + wordmark `SoftHarbor`
|
||||
(Bricolage; the wordmark hides below `sm`, a screen-reader name stays) ·
|
||||
nav `Apps · Categories` with Lucide icons, the current section marked by
|
||||
`aria-current="page"` and a short accent underline (not colour alone) · a
|
||||
search hint styled as a field with a `/` key cap (`lg`+; a real link to
|
||||
`/apps#search`) · `ShLangSwitch` (segmented `EN | VI`) · `ShPrefs` (display
|
||||
menu icon button, docs/05 §A8).
|
||||
|
||||
**Footer:** legal links (Disclaimer · Privacy · Terms · Trademarks ·
|
||||
Third-party) · license line "Code GPL-3.0 · Data CC BY-SA 4.0" · GitHub link
|
||||
· `ShBugReport` ("Report a bug") · build date.
|
||||
**Footer — five columns** (two on phones): **brand** (mark, tagline, license
|
||||
line "Code GPL-3.0 · Data CC BY-SA 4.0", build date) · **Browse** (Apps,
|
||||
Categories, Search) · **Open data** (`/api/apps.json`, `/rss.xml`, the CC
|
||||
BY-SA 4.0 data licence) · **Legal** (all seven documents, the
|
||||
Accessibility Statement last) · **Project**
|
||||
(Contact, Source code ↗ and Releases ↗ on Gitea, `ShBugReport` "Report a bug"
|
||||
— a prefilled issue on the GitLab mirror; D38).
|
||||
|
||||
## 5. Pages
|
||||
|
||||
**Welcome `/`** — one-line pitch + subline (dictionary keys
|
||||
`welcome.hero`), primary button → `/apps`; 12 category tiles (icon + label +
|
||||
count); "Latest additions" row (5 newest cards); short "How this list
|
||||
works" strip: official links only · free or own-once · dated security
|
||||
status, each linking to the relevant legal/about text.
|
||||
**Welcome `/`** — no island at all. **Hero** over the depth contours
|
||||
(`.sh-contours`: repeating radial rings plus a dot grid, masked to fade,
|
||||
kept inside the section so it can never widen a phone's layout viewport):
|
||||
eyebrow, headline at `--text-hero`, subline, a **search field that is a
|
||||
link** to `/apps#search` ("Search 326 apps…" with a `/` key cap — the real
|
||||
search is the island on `/apps`), and two buttons: Browse all apps
|
||||
(primary) · All categories. Beside it, the **"Manifest" ledger**: figures
|
||||
counted from the data at build time — apps listed, completely free, buy
|
||||
once, no known warnings, and per-platform counts — in ruled mono rows.
|
||||
Then the **category grid** — 15 as of v1.4 (icon tile, label, localized count, stretched
|
||||
link) and **"How this list works"** — three numbered principles (01 official
|
||||
links only · 02 free or own it once · 03 dated, honest status). The v1.0
|
||||
"Latest additions" row was dropped in the refresh (every entry still shares
|
||||
the seed's `addedAt`, 2026-07-28); `/rss.xml` remains the new-entries
|
||||
channel.
|
||||
|
||||
**Grid `/apps`** — toolbar: search input (`ShSearch`, placeholder
|
||||
"Search apps… (/)"), filter button with active-count chip (`ShFilterSheet`),
|
||||
sort select (A–Z · Newest). Result count line (`aria-live`). Card grid §6.
|
||||
Empty state: friendly line + "Clear filters" + "Suggest this app →"
|
||||
(app-request issue form).
|
||||
**Grid `/apps`** — eyebrow + h1 + one-line intro ("Every link goes to the
|
||||
developer's official page…"); toolbar: search input (`ShSearch`, search
|
||||
icon, placeholder "Search apps… ( / )"), sort select (A–Z · Newest, plus
|
||||
"Best match" while a query is active — docs/05 §A2), filter button with an
|
||||
active-count chip (`ShFilterSheet`). Result count line (`aria-live`,
|
||||
plural-aware). Card grid §6. Empty state, hidden until filtering yields
|
||||
nothing: "No apps match. Try fewer filters or a different word."
|
||||
|
||||
**Filter sheet** — desktop: right-side panel; mobile: bottom sheet
|
||||
(`<dialog>`). Facets: Category (checkbox list with icons), Platform
|
||||
(Windows/macOS/Linux), Pricing (Free / Free + one-time / One-time). Footer:
|
||||
"Clear all" + "Show N apps".
|
||||
**Filter sheet** — native `<dialog>` (`showModal`): full-height right-side
|
||||
panel (24 rem) from 640 px up, a bottom sheet (max 80 dvh) below. Facets:
|
||||
Category (registry order, localized labels), Platform (Windows/macOS/Linux),
|
||||
Pricing (Free / Free + one-time / One-time). Footer: "Clear all" (disabled
|
||||
when nothing is active; also clears the query) + "Show N apps" — the visible
|
||||
text *is* the accessible name (WCAG 2.5.3), pluralised.
|
||||
|
||||
**Detail `/apps/[slug]`** — breadcrumb (primary category); header: logo
|
||||
64 px + name (h1, `transition:name={slug}`) + **developer line** directly
|
||||
under the h1 (`detail.developer` label + `developer` value, muted, body
|
||||
weight) + pricing & license badges; summary paragraph; **link rail** of three
|
||||
equal bordered buttons: Homepage ↗ · Repository ↗ (hidden when null) ·
|
||||
Download ↗ (accent-filled — the page's one loud element); meta block (mono):
|
||||
platforms · tags · security line · added/updated dates; footer note: "Links
|
||||
go to the official site. SoftHarbor hosts no downloads." + "Report an issue
|
||||
with this entry".
|
||||
**Categories `/categories`** — one tile per category: icon, name, count and
|
||||
the first three app names (name order), so a tile says what is inside
|
||||
before the click.
|
||||
|
||||
**Category `/categories/[id]`** — back link to Categories, icon tile + h1
|
||||
(the label) + count, then the grid: newest first, name as the tie-break —
|
||||
the `/apps` "Newest" order exactly (docs/05 §A3).
|
||||
|
||||
**Detail `/apps/[slug]`** — breadcrumb (Apps › primary category › name).
|
||||
**Hero panel**: logo on an 80 px tile + name (h1) + **developer line**
|
||||
directly under the h1 (the `developer` value, muted) + price chip (toned,
|
||||
§6) and license pill; the summary at h3 size. **Action rail**: Download ↗
|
||||
(accent-filled, *first* — the page's one loud element) · Homepage ↗ ·
|
||||
Repository ↗ (absent when null), then the note "Links go to the official
|
||||
site. SoftHarbor hosts no downloads." **Facts ledger** ("At a glance",
|
||||
`<dl>` in ruled rows): developer · platforms · license · tags · security
|
||||
line · added · updated. **Security-meaning panel** beside it, tinted ok or
|
||||
warn by status, explaining what the status does and does not mean, linking
|
||||
the Disclaimer. **"More in <category>"**: up to four cards from the primary
|
||||
category, name order.
|
||||
|
||||
The **security line carries a "View scan ↗" link** whenever
|
||||
`security.evidence` is set, at any status. Hard rule 4 caps what the copy may
|
||||
@@ -96,33 +171,46 @@ more when the reader can open the scan and judge it. It matters most on an
|
||||
entry held at `unverified` *because* something was found: the link is how a
|
||||
reader sees what, instead of being told only that we were unsure.
|
||||
|
||||
The developer line sits *above* the link rail on purpose: a reader should be
|
||||
able to match "who makes this" against the domain they are about to click.
|
||||
It is plain text, never a link — we do not maintain vendor pages.
|
||||
The developer line sits *above* the action rail on purpose: a reader should
|
||||
be able to match "who makes this" against the domain they are about to
|
||||
click. It is plain text, never a link — we do not maintain vendor pages. (Its
|
||||
label, "Developer", now lives in the facts ledger.)
|
||||
|
||||
**Legal `/legal/*`** — h1, "last updated" stamp, VI courtesy notice on the VI
|
||||
side, then the document. **No inter-document nav in the page body**: the
|
||||
footer already lists all six on every page, and repeating them a screen apart
|
||||
is noise.
|
||||
**Legal `/legal/*`** — eyebrow, h1, the document's own "Last updated" stamp
|
||||
(`LEGAL_UPDATED`, docs/14 Part 2), the fixed VI notice on the VI side, then
|
||||
the document (`.sh-prose`: numbered clauses keep their numbers, links are
|
||||
underlined). **No inter-document nav in the page body**: the footer already
|
||||
lists all seven on every page, and repeating them a screen apart is noise.
|
||||
|
||||
**Category `/categories/[id]`** — h1 = label, count, pre-filtered grid.
|
||||
**Contact `/contact`** — one card per purpose (nine `@poli0981.dev`
|
||||
addresses from `src/lib/contacts.ts`, ordered by urgency: security first,
|
||||
press and collaboration last; the DMCA card links Terms `#copyright`), a
|
||||
panel pointing everything else to issues on the GitLab mirror, and a languages note.
|
||||
Gate-exempt: a security or copyright notice must never wait behind "I
|
||||
understand and accept".
|
||||
|
||||
**Error/offline pages** — same layout family: giant mono status code
|
||||
(clipped, 40 % opacity, behind text), one-line explanation EN+VI, buttons
|
||||
Home / Back. Offline adds "You appear to be offline — SoftHarbor needs a
|
||||
connection to load new pages."
|
||||
**Error/offline pages** — one shared shell (`ErrorPage.astro`), **bilingual
|
||||
on one page** (an error can be reached from either locale, and `/offline`
|
||||
with no network at all): the status code set huge in the ledger's mono,
|
||||
accent at 25 % opacity and `aria-hidden` (`···` for offline), then an EN
|
||||
panel and a `lang="vi"` panel side by side, each with an icon tile, title
|
||||
and explanation from the dictionaries (`error.<kind>.*`). Buttons: Home ·
|
||||
Apps · Trang chủ (VI home). All are `noindex` — `/404` requested directly is
|
||||
a 200 — gate-exempt, and emit no hreflang alternates.
|
||||
|
||||
## 6. Card anatomy
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────┐
|
||||
│ [logo 40px] Name (7-Zip) │ name: 600, 17px
|
||||
│ ⊞ ⌘ 🐧 FREE LGPL-2.1 │ platform icons + pills
|
||||
│ File archiver with high-ratio 7z │ summary, 2-line clamp,
|
||||
│ compression and support for dozens… │ muted
|
||||
│ ── ── ── ── ── ── ── ── ── ── ── ── ── │
|
||||
│ ● No known warnings · checked 2026-07-15 │ status dot: ok/warn color
|
||||
│ file-management · utilities │ category chips (link)
|
||||
│ ┌────┐ 7-Zip [FREE] │ 48px logo tile · name
|
||||
│ │logo│ Igor Pavlov │ (h2, 17px, 600) · developer
|
||||
│ └────┘ │ (muted, truncated) · price chip
|
||||
│ File archiver with high-ratio 7z │ summary, 2-line clamp,
|
||||
│ compression and support for dozens… │ muted
|
||||
│ [LGPL-2.1-or-later] ▭ Windows · Linux │ SPDX pill · platforms
|
||||
│ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ │ dashed rule
|
||||
│ ⛉✓ No known warnings · checked 30 Jul 2026 │ shield icon + status (mono)
|
||||
│ File Management Utilities │ category chips (links)
|
||||
└──────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
@@ -130,74 +218,186 @@ connection to load new pages."
|
||||
inside another `<a>` is invalid HTML: the parser *closes* the outer anchor
|
||||
when it meets the inner one, so the card link silently breaks and the
|
||||
"A11y = 100" gate (docs/13 §2) cannot pass. Use the standard pattern
|
||||
instead — the card is an `<article class="relative">`, the **app title** is
|
||||
the only link to the detail page and carries the overlay:
|
||||
instead — the card is an `<article class="relative">`, the **app name** is
|
||||
the only link to the detail page and carries the overlay
|
||||
(`global.css`):
|
||||
|
||||
```css
|
||||
.sh-card-title a::after { content: ''; position: absolute; inset: 0; }
|
||||
.sh-card a:not(.sh-card-title a) { position: relative; z-index: 1; }
|
||||
.sh-stretch::after { content: ''; position: absolute; inset: 0; }
|
||||
```
|
||||
|
||||
Category chips are then ordinary **sibling** links that sit above the
|
||||
overlay and navigate normally. One card = one primary link in the
|
||||
accessibility tree; platform icons carry `aria-label`.
|
||||
- Each card wrapper carries the facet data the filter island needs (docs/05
|
||||
§A3): `data-slug`, `data-categories`, `data-platforms`, `data-pricing`,
|
||||
`data-added`. These are the **only** source filtering reads, so sorting and
|
||||
filtering work before `/search-index.json` has loaded — and keep working if
|
||||
the user never touches search.
|
||||
- Pills: pricing (`FREE` ink-on-paper / `ONE-TIME` accent outline /
|
||||
`FREE + ONE-TIME`) and SPDX id (mono) only when open source.
|
||||
Category chips are then ordinary **sibling** links raised above the
|
||||
overlay (`relative z-1`) and navigate normally. One card = one primary
|
||||
link in the accessibility tree. The name is an `h2` on `/apps` and
|
||||
category pages and an `h3` inside "More in <category>", so no page skips
|
||||
a heading level.
|
||||
- Each card wrapper carries the facet data the grid controller needs
|
||||
(docs/05 §A3): `data-slug`, `data-name`, `data-categories`,
|
||||
`data-platforms`, `data-pricing`, `data-added`. These are the **only**
|
||||
source filtering and sorting read, so both work before
|
||||
`/search-index.json` has loaded — and keep working if the user never
|
||||
touches search.
|
||||
- **Price chip, toned by pricing:** `free` → ok (green) · `free-onetime` →
|
||||
accent (blue) · `onetime` → warn (amber), each text-on-tint pair ≥ 4.5:1
|
||||
(§2). Localized labels (`FREE`, `FREE + ONE-TIME`, `ONE-TIME`). SPDX id
|
||||
as a neutral mono pill, only when open source. Platforms as a monitor icon
|
||||
plus the platform names — words, not glyphs.
|
||||
- Security line copy (exact, both locales in dictionaries). **Each string
|
||||
renders the date field it actually names** — the dated-honesty claim is the
|
||||
product (hard rule 4), so the words and the data must not drift apart:
|
||||
`clean` → "No known warnings · checked {date}" ← `security.checkedAt` ·
|
||||
`unverified` → "Not yet verified · listed {date}" ← **`addedAt`** ·
|
||||
`flagged` → never rendered (quarantined before build).
|
||||
- States: hover = translate(-2px,-2px) + offset shadow; focus-visible =
|
||||
accent ring; filtered-out = `hidden` attr (A3).
|
||||
`flagged` → never rendered (quarantined before build). The status icon
|
||||
differs in **shape and colour** — `shield-check` in ok, `shield-question`
|
||||
in warn — so it never rests on colour alone (WCAG 1.4.1).
|
||||
- Category chips print the category **label** in the page's language (they
|
||||
printed the raw id before v1.1).
|
||||
- States: hover (pointer devices only) = `translateY(-2px)` + `shadow-2` +
|
||||
an accent-tinted border, and the logo tile's icon "pops" (§7);
|
||||
keyboard focus anywhere in the card outlines the **whole card**
|
||||
(`:has(:focus-visible)`); filtered-out = `hidden` attr (A3).
|
||||
- **`content-visibility: auto`** with `contain-intrinsic-size: auto 15rem`:
|
||||
with 326 cards on `/apps`, the browser skips layout and paint for the ones
|
||||
off screen while the scrollbar stays honest.
|
||||
|
||||
## 7. Motion
|
||||
|
||||
Durations 150 ms (hover/focus) · 250 ms (sheet, dialog, view transitions);
|
||||
easing `cubic-bezier(.2,.8,.2,1)`. Grid entrance: stagger opacity+4 px rise,
|
||||
30 ms apart, **first 12 cards only**. View Transitions: a cross-page fade.
|
||||
`@media (prefers-reduced-motion: reduce)` — all of the above collapse to
|
||||
instant; ClientRouter falls back to plain navigation.
|
||||
Tokens: `--duration-fast` 150 ms (hover/focus colour, borders) ·
|
||||
`--duration-slow` 250 ms (lift, icon motion); easing `--ease-sh`
|
||||
`cubic-bezier(.2,.8,.2,1)`, plus `--ease-spring` `cubic-bezier(.34,1.56,.64,1)`
|
||||
for pops. Motion is **opt-in per element**, through classes in
|
||||
`global.css`:
|
||||
|
||||
| Class | Effect | Used for |
|
||||
|---|---|---|
|
||||
| `sh-anim` | marks the control an icon reacts to (hover, or keyboard focus) | links, buttons, cards |
|
||||
| `sh-nudge-x` | icon slides 3 px right | "go there" arrows |
|
||||
| `sh-nudge-diag` | icon moves 2 px up-right | ↗ links that leave the site |
|
||||
| `sh-pop` | icon scales 1.12 and tilts −6°, spring easing | tiles, the anchor mark |
|
||||
| `sh-draw` | strokes redraw (dash-offset, 0.8 s), hover only | decorative icons |
|
||||
| `sh-rise` | fade + 12 px rise on first paint (0.6 s) | hero panels |
|
||||
| `sh-stagger` | children rise 45 ms apart, capped at 495 ms from the 12th | hero, category grids, contact cards |
|
||||
|
||||
`ShIcon` takes the effect as a prop (`motion="nudge-x" | "nudge-diag" |
|
||||
"pop" | "draw"`); hover variants sit behind `@media (hover: hover)`, focus
|
||||
variants do not. Delays are classes, never inline styles (CSP). Cards have
|
||||
**no** entrance animation — the grid reorders by moving nodes (docs/05
|
||||
§A3).
|
||||
|
||||
**View Transitions:** a native cross-document fade (docs/02 §6), opted in
|
||||
only under `prefers-reduced-motion: no-preference`; browsers without
|
||||
support simply navigate.
|
||||
|
||||
**Reduced motion collapses everything to instant**, whether the OS asks
|
||||
(`prefers-reduced-motion: reduce`) or the visitor picks Motion → Reduce in
|
||||
the display menu (`html[data-motion="reduce"]`, applied pre-paint): animation
|
||||
and transition durations go to 0.01 ms, **delays to 0** (a staggered element
|
||||
would otherwise sit invisible for its delay under fill mode `both`),
|
||||
iteration counts to 1, smooth scrolling off, and the view-transition
|
||||
pseudo-elements lose their animation.
|
||||
|
||||
**The card→detail morph is withdrawn (2026-07-30) — it is not implementable
|
||||
under this CSP.** `transition:name` makes Astro emit a per-slug `<style>`, and
|
||||
Astro does not put that style's hash into the page's own CSP, so the browser
|
||||
refuses it on hard loads and on swaps alike. Allow-listing all 326 hashes
|
||||
would add ~17 KB to every page head (~12 MB across the build) for a 180 ms
|
||||
effect, and a nonce needs a Worker (hard rule 1). It had never animated in any
|
||||
case: a morph needs the same `view-transition-name` on both sides, and the
|
||||
card never carried one. Revisit only if Astro starts hashing transition
|
||||
styles. The fade is unaffected — that style *is* hashed correctly.
|
||||
refused it on every load. Allow-listing all 326 hashes would add ~17 KB to
|
||||
every page head (~12 MB across the build) for a 180 ms effect, and a nonce
|
||||
would mean running every page through a Worker, which D25 explicitly rules
|
||||
out. It had never animated in any case: a morph needs the same
|
||||
`view-transition-name` on both sides, and the card never carried one.
|
||||
Revisit only if Astro starts hashing transition styles. The cross-document
|
||||
fade is unaffected — its one inline style is hashed by `astro.config.ts`.
|
||||
|
||||
## 8. Responsive
|
||||
|
||||
| Breakpoint | Grid cols | Notes |
|
||||
|---|---|---|
|
||||
| < 640 | 1 | filter = bottom sheet; sticky compact header; search full-width |
|
||||
| ≥ 640 | 2 | |
|
||||
| ≥ 1024 | 3 | filter = side panel |
|
||||
| ≥ 1440 | 4 | max content width 1360 px |
|
||||
| < 640 | 1 | filter sheet, legal gate = bottom sheets; mobile type step; wordmark hidden (mark only); search full-width; footer 2 columns |
|
||||
| ≥ 640 (`sm`) | 2 | filter = right-side panel |
|
||||
| ≥ 768 (`md`) | 2 | page gutter 24 px; footer 5 columns |
|
||||
| ≥ 1024 (`lg`) | 3 | header search hint appears; detail facts + status side by side |
|
||||
| ≥ 1280 (`xl`) | 4 | max content width 1360 px |
|
||||
|
||||
Touch targets ≥ 44×44 px; hover effects gated behind `@media (hover:hover)`.
|
||||
Touch targets ≥ 44×44 px (`.sh-btn`, gate button and filter rows have
|
||||
`min-height: 44px`); hover effects gated behind `@media (hover:hover)`.
|
||||
**Nothing may widen the layout viewport on a phone**: single-column grids
|
||||
are `minmax(0, 1fr)` and the hero contours stay inside their section — a
|
||||
long developer name or the decoration once widened phones to 459–620 px.
|
||||
The e2e suite fails any page whose document overflows sideways (docs/11
|
||||
§5).
|
||||
|
||||
## 9. Accessibility checklist
|
||||
|
||||
- Contrast ≥ 4.5:1 body, ≥ 3:1 large text & UI — verify both themes with
|
||||
the token table above (adjust L values, keep hues).
|
||||
- Keyboard: `/` focuses search (suppressed inside inputs, **and while the
|
||||
legal gate is open** — a global shortcut that reaches through a modal
|
||||
defeats the focus trap and can scroll content the user hasn't accepted yet)
|
||||
· Esc clears then blurs · Tab order header → toolbar → cards → footer ·
|
||||
sheet & gate use native `<dialog>` (focus trap, `aria-modal`, Esc — gate
|
||||
intercepts Esc, docs/14 §2).
|
||||
- `aria-live="polite"` result count; icons decorative (`aria-hidden`) with
|
||||
text alternatives; `lang` attribute correct per locale, including
|
||||
`lang="vi"` snippets embedded in EN pages.
|
||||
- Zoom to 200 % without horizontal scroll; test VoiceOver + NVDA on the grid
|
||||
and the gate before launch (docs/13 §2).
|
||||
**Target: WCAG 2.2 level AA** (D33) — a goal, not a conformance claim; no
|
||||
independent audit has been done. The public statement is
|
||||
`/legal/accessibility` (docs/14 §3g), the contributor-facing one
|
||||
`ACCESSIBILITY.md`; both list the test record and known limitations below.
|
||||
|
||||
- Contrast ≥ 4.5:1 text, ≥ 3:1 control boundaries — **enforced** for every
|
||||
token pair in both themes by `src/styles/contrast.test.ts` (§2; adjust L
|
||||
values, keep hues), and checked on rendered pages by axe in the e2e suite
|
||||
(light and dark; critical, serious and moderate findings fail — docs/11
|
||||
§5).
|
||||
- Keyboard: `/` jumps to search from **any** page — on `/apps` `ShSearch`
|
||||
focuses its box, elsewhere `ShPrefs` navigates to `/apps#search`.
|
||||
Suppressed inside text fields, with modifier keys, **while the legal gate
|
||||
is open** (`body[data-sh-gate="open"]`) — a global shortcut that reaches
|
||||
through a modal defeats the focus trap and can scroll content the user
|
||||
hasn't accepted yet — **and when the visitor turned it off**: a bare
|
||||
printable-key shortcut must be possible to switch off (WCAG 2.1.4, level
|
||||
A), so the display menu has "Keyboard shortcut “/”: On / Off" (`sh:keys`
|
||||
→ `html[data-keys="off"]`, applied pre-paint by theme.js; the header's
|
||||
`/` hint and the search placeholder's "( / )" disappear with it, v1.4).
|
||||
Esc in search clears, then blurs. A skip link ("Skip to content") comes
|
||||
first; `scroll-padding-top` keeps focused or anchored content out from
|
||||
under the sticky header (WCAG 2.4.11) — it is `--sh-header-h` + 1 rem,
|
||||
the header's real height measured by `ShPrefs` (a ResizeObserver),
|
||||
because the header wraps to two rows on narrow screens and grows with
|
||||
zoom; `scroll-padding-bottom` clears the fixed language banner while it
|
||||
shows. Tab order
|
||||
header → toolbar → cards → footer, and the grid's DOM order always equals
|
||||
its visual order (docs/05 §A3).
|
||||
- Overlays use the platform: the filter sheet and the legal gate are native
|
||||
`<dialog>`s opened with `showModal()` (focus trap, inert background);
|
||||
the gate also sets `closedby="none"` and re-opens if Esc or the browser
|
||||
closes it early (docs/14 Part 2). The gate focuses its heading first, so a
|
||||
screen reader reads the notice before any control. The display menu is a
|
||||
`popover`. Closing the sheet or the menu with Esc returns focus to the
|
||||
button that opened it (the platform's, pinned by e2e). Focus is always
|
||||
visible: the global 2 px accent ring, and in the display menu's segmented
|
||||
controls — where arrow keys move focus and choice together, so the
|
||||
focused radio is the accent-filled one — a ring in the fill's ink colour
|
||||
(WCAG 2.4.7).
|
||||
- `aria-live="polite"` result count; the search error lives in a
|
||||
`role="status"` region that is always in the DOM (only its text changes,
|
||||
so it is announced — WCAG 4.1.3); the filter button reads "Filters 2
|
||||
active". `aria-current` on the current nav section (with an underline,
|
||||
not colour alone); icons decorative
|
||||
(`aria-hidden`) unless they are a control's only name; status shown by
|
||||
icon shape *and* colour; links in running text (legal prose, the gate)
|
||||
are underlined (WCAG 1.4.1).
|
||||
- **Forced colours** (Windows contrast themes, v1.4): backgrounds and box
|
||||
shadows are repainted, so the current section gets a text underline, and
|
||||
the chosen segment in the display menu and the current language keep a
|
||||
`Highlight` fill (`forced-color-adjust: none`); focus outlines survive on
|
||||
their own. Pinned by e2e (`emulateMedia({ forcedColors: 'active' })`).
|
||||
- Targets: buttons 44 px, header controls 38–40 px, and inline category
|
||||
links on cards at least 24 px tall (WCAG 2.5.8).
|
||||
- Data tables (third-party notices, AI disclosure) have a visually hidden
|
||||
`<caption>`, `scope="col"` headers, and sit in a labelled
|
||||
`role="region" tabindex="0"` wrapper so their sideways scroll is
|
||||
reachable from the keyboard. The one link that opens a new tab ("Report a
|
||||
bug") says so to screen readers.
|
||||
- Visible text stays inside the accessible name (WCAG 2.5.3): the language
|
||||
switch reads "EN — English" / "VI — Tiếng Việt" (the endonym appended in
|
||||
a matching `lang`, never replacing "EN"/"VI"), and the filter sheet's
|
||||
submit button is named by its own "Show N apps" text.
|
||||
- `lang` attribute correct per locale, including the `lang="vi"` panel on
|
||||
bilingual error pages and the VI suggestion banner on EN pages.
|
||||
- Reflow and zoom to 200 % without horizontal scroll: the e2e suite fails
|
||||
any sideways overflow at desktop and Pixel 7 sizes, and at **320 CSS px**
|
||||
(WCAG 1.4.10) — where the header's controls drop to a second row instead
|
||||
of leaving the screen (`flex-wrap`, v1.4).
|
||||
- Manual record: keyboard only + Narrator on Windows 11 (Chrome, Brave,
|
||||
Firefox) by the owner, 2026-11-09 — no barriers found. VoiceOver + NVDA
|
||||
on the grid, the filter sheet and the gate remain a manual
|
||||
launch-checklist item (docs/13 §2).
|
||||
@@ -12,9 +12,14 @@ Three i18n layers:
|
||||
|
||||
| Layer | Lives in | Examples |
|
||||
|---|---|---|
|
||||
| UI strings | `src/i18n/en.json`, `vi.json` | buttons, badges, security-line copy, error pages |
|
||||
| UI strings | `src/i18n/en.json`, `vi.json` (163 keys each, 2026-10-21) | buttons, badges, security-line copy, gate copy, error pages |
|
||||
| Content data | each app file (`summary.en/.vi`), category registry (`label.en/.vi`) | app summaries, category names |
|
||||
| Legal | full pages per locale (docs/14) | Disclaimer, Privacy, Terms… |
|
||||
| Legal | `src/components/legal/*.astro`, EN and VI in one file per document (docs/14 Part 3) | Disclaimer, Privacy, Terms… |
|
||||
|
||||
Error, 404 and offline pages are the exception to "one page per locale":
|
||||
each is **one bilingual document** (an EN and a `lang="vi"` panel), because
|
||||
an error can be reached from either locale — and `/offline` with no network
|
||||
at all — so there is no safe moment to pick one (docs/06 §5).
|
||||
|
||||
## 2. Routing
|
||||
|
||||
@@ -25,21 +30,25 @@ Astro built-in i18n (config in docs/02 §4): `defaultLocale: 'en'`,
|
||||
- VI pages are real files under `src/pages/vi/**` re-exporting shared page
|
||||
components with `locale="vi"` — thin wrappers, logic lives once.
|
||||
- **`getStaticPaths` is shared, never copy-pasted.** Astro requires it in each
|
||||
dynamic route file, and there are two per collection (EN + VI). Define the
|
||||
path builders once in `src/lib/paths.ts` and re-export:
|
||||
dynamic route file, and there are two per collection (EN + VI). The path
|
||||
builders are defined once in `src/lib/paths.ts` — one factory per
|
||||
collection, instantiated per locale — and re-exported:
|
||||
|
||||
```ts
|
||||
// src/pages/vi/apps/[slug].astro — and identically in src/pages/apps/[slug].astro
|
||||
export { appPaths as getStaticPaths } from '~/lib/paths';
|
||||
// src/pages/vi/apps/[slug].astro — the EN twin re-exports appPathsEn
|
||||
export { appPathsVi as getStaticPaths } from '../../../lib/paths';
|
||||
```
|
||||
|
||||
Duplicating the logic means a filter added to one locale silently skips the
|
||||
other, which breaks the parity guarantee CI cannot check (docs/10 §7).
|
||||
- **No automatic locale redirect.** Bots and users always get the URL they
|
||||
asked for. Instead: a one-time dismissible banner ("Trang này có bản
|
||||
tiếng Việt — Chuyển sang tiếng Việt?") renders when
|
||||
`navigator.language.startsWith('vi')` ∧ current locale is EN ∧
|
||||
`sh:lang` unset. Dismiss or switch sets `sh:lang`; banner never returns.
|
||||
asked for. Instead: a one-time dismissible banner — "Trang này có bản
|
||||
tiếng Việt." with [Chuyển sang tiếng Việt] [Giữ tiếng Anh], always in
|
||||
Vietnamese (`t('vi', …)`) because it only ever shows to a Vietnamese
|
||||
browser — renders when `navigator.language` starts with `vi` ∧ current
|
||||
locale is EN ∧ `sh:lang` unset. Switching writes the chosen locale;
|
||||
dismissing writes `en`; either way the banner never returns. `sh:lang`
|
||||
does nothing else — it never redirects (`src/lib/lang.ts`).
|
||||
|
||||
## 3. Dictionaries & typed helper
|
||||
|
||||
@@ -64,7 +73,7 @@ Flat dot-keys, alphabetized, identical key sets:
|
||||
// src/i18n/index.ts
|
||||
import en from './en.json';
|
||||
import vi from './vi.json';
|
||||
export type Locale = 'en' | 'vi';
|
||||
import { type Locale } from '../lib/locale'; // routing lives there
|
||||
export type Key = keyof typeof en; // en is the source of truth
|
||||
const dict: Record<Locale, Record<Key, string>> = { en, vi };
|
||||
|
||||
@@ -74,14 +83,37 @@ export function t(locale: Locale, key: Key,
|
||||
for (const [k, v] of Object.entries(vars)) s = s.replaceAll(`{${k}}`, String(v));
|
||||
return s;
|
||||
}
|
||||
|
||||
/** "1 app" / "326 apps" / "326 ứng dụng" — plural rule + digit grouping. */
|
||||
export function appCount(locale: Locale, n: number): string {
|
||||
const lang = locale === 'vi' ? 'vi-VN' : 'en-GB';
|
||||
const one = new Intl.PluralRules(lang).select(n) === 'one';
|
||||
return t(locale, one ? 'apps.count.one' : 'apps.count',
|
||||
{ n: new Intl.NumberFormat(lang).format(n) });
|
||||
}
|
||||
```
|
||||
|
||||
`appCount()` is the one way a count reaches a page, so no page can print
|
||||
"1 apps". Islands never import the dictionaries (that would bundle every
|
||||
key): they receive their strings as props, and where they must pluralise on
|
||||
the client — the grid count, the filter sheet's "Show N apps" — the server
|
||||
leaves one template per plural category and the island picks with
|
||||
`Intl.PluralRules(<html lang>)` (docs/05 §A3). Routing helpers
|
||||
(`localePath`, `localePair`, `canonicalPath`) live in `src/lib/locale.ts`,
|
||||
which imports no dictionary, so islands can use them for free;
|
||||
`src/i18n/index.ts` re-exports them.
|
||||
|
||||
**CI parity check** — its own script, `scripts/check-i18n-parity.mjs`, run by
|
||||
`pnpm i18n:check`. It is deliberately **not** folded into `validate-data.mjs`:
|
||||
that script is triggered by `src/data/**`, so an edit touching only
|
||||
`src/i18n/*.json` would skip the check entirely. Port it from
|
||||
`pnpm i18n:check` (and as the second step of `pnpm build`). It is
|
||||
deliberately **not** folded into `validate-data.mjs`: that script is
|
||||
triggered by `src/data/**`, so an edit touching only `src/i18n/*.json`
|
||||
would skip the check entirely. Ported from
|
||||
`E:\qoute\scripts\check-i18n-parity.ts` (flatten → bidirectional key diff →
|
||||
error list → non-zero exit).
|
||||
error list → non-zero exit), and since extended: an empty object counts as
|
||||
a key, **`{placeholder}` sets must match** between locales (a dropped one
|
||||
would render literal braces), **keys must be in alphabetical order** in
|
||||
every dictionary, and a UTF-8 BOM is stripped instead of crashing
|
||||
`JSON.parse`.
|
||||
|
||||
`vi.json` must contain **exactly** the keys of `en.json` — missing *or* extra
|
||||
keys fail the build (hard rule 6). No exceptions, including metadata or
|
||||
@@ -93,21 +125,43 @@ guard.
|
||||
- Every page reads `Astro.currentLocale`; components take `locale` as a
|
||||
prop — no global mutable locale.
|
||||
- Dates: `new Intl.DateTimeFormat(locale === 'vi' ? 'vi-VN' : 'en-GB',
|
||||
{ dateStyle: 'medium' })` — `en-GB` chosen for unambiguous `15 Jul 2026`.
|
||||
- Numbers (counts): `Intl.NumberFormat` per locale.
|
||||
- Sorting app names: `localeCompare` on `normalizeViet(name)` — identical
|
||||
order in both locales, avoiding collation surprises.
|
||||
- `<html lang>` = `en` / `vi`; embedded other-language strings (e.g. VI
|
||||
summary shown on an EN admin view — not in v1) must carry `lang`.
|
||||
{ dateStyle: 'medium', timeZone: 'UTC' })` — `en-GB` chosen for
|
||||
unambiguous `15 Jul 2026`; UTC so a `YYYY-MM-DD` never shifts a day.
|
||||
- Numbers (counts): `Intl.NumberFormat` per locale; plurals via
|
||||
`appCount()` (§3) or the per-plural templates islands use.
|
||||
- Sorting app names: `compareNames()` — `Intl.Collator('en', { sensitivity:
|
||||
'base', numeric: true })` over `normalizeViet(name)` — identical order in
|
||||
both locales, and independent of the visitor's browser locale and the
|
||||
build machine's ICU default (docs/05 §A3). A bare `localeCompare()` let a
|
||||
Czech-locale browser reorder 81 of 326 cards.
|
||||
- Category chips, filter labels and error copy are localized too; only the
|
||||
language switch's endonyms and the VI suggestion banner are deliberately
|
||||
fixed-language.
|
||||
- `<html lang>` = `en` / `vi`; embedded other-language strings carry `lang`
|
||||
— the VI panel on bilingual error pages, the VI suggestion banner on EN
|
||||
pages, the endonyms in the switcher.
|
||||
|
||||
## 5. Language switcher (`ShLangSwitch`)
|
||||
|
||||
Text toggle `EN | VI` in the header. Behavior: compute the counterpart URL
|
||||
of the *current* path (add/strip `/vi` prefix), navigate, persist choice to
|
||||
`sh:lang`. On pages without a counterpart (none by design — parity is
|
||||
total), fall back to the locale home. Also renders `<link rel="alternate">`
|
||||
awareness: switcher href must equal the hreflang alternate for the page
|
||||
(single source: a `localePair(path)` util used by both).
|
||||
A segmented `EN | VI` control in the header (`client:idle`). The current
|
||||
language is a `<span aria-current="true">` (the filled segment), the other
|
||||
a link with `hreflang` and `lang`. Accessible names keep the visible code
|
||||
and append the endonym, each inside an element with the matching `lang`:
|
||||
**"EN — English"** and **"VI — Tiếng Việt"** — never an `aria-label` that
|
||||
replaces "EN"/"VI", so voice-control users can say what they see (WCAG
|
||||
2.5.3).
|
||||
|
||||
Behavior: the counterpart URL is **server-rendered** from the same
|
||||
`localePair(path)` result `Base.astro` writes into the hreflang alternates,
|
||||
so the switcher href always equals the hreflang alternate (before v1.1 the
|
||||
island guessed until it hydrated, and every VI page shipped HTML marking
|
||||
English as current). On mount it appends `location.search` +
|
||||
`location.hash`, so a filtered `/apps?…` view survives a switch (docs/05
|
||||
§A3). Clicking persists the choice to `sh:lang` and is an ordinary full
|
||||
navigation — there is no `<ClientRouter />` (docs/02 §6). Every page has a
|
||||
counterpart except the single bilingual error/offline pages, which emit no
|
||||
alternates (`alternates={false}`); there the switcher leads to the other
|
||||
locale's home.
|
||||
|
||||
## 6. SEO
|
||||
|
||||
@@ -121,7 +175,10 @@ Every page emits:
|
||||
|
||||
`@astrojs/sitemap` i18n option (docs/02 §4) mirrors the same pairs into the
|
||||
sitemap. Canonical = self per locale (no cross-locale canonicals). Meta
|
||||
description = the locale's `summary`.
|
||||
description = the locale's `summary` on app pages, a per-page dictionary
|
||||
string elsewhere (docs/16 §7). Error and offline pages emit **no**
|
||||
alternates: advertising them pointed crawlers at `/vi/404` and
|
||||
`/vi/offline`, which do not exist.
|
||||
|
||||
**Never pass `Astro.url.pathname` straight into a canonical or an alternate.**
|
||||
With `build.format: 'file'` — which the trailing-slash fix requires (docs/02
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# 08 — Platform: Cloudflare Workers (setup · errors · offline)
|
||||
|
||||
> This is the operator's guide Kokone asked for. Part A is the click-by-click
|
||||
> setup; Part C answers "can Cloudflare make our error pages?" definitively.
|
||||
> setup; Part C answers "can Cloudflare make our error pages?" definitively;
|
||||
> Part E is the one Worker the site runs since v1.1 (D25), and Part F the
|
||||
> site-wide rate limit it has run since v1.3 (D32).
|
||||
|
||||
## Part A — Setup guide (account + zone + first deploy)
|
||||
|
||||
@@ -9,66 +11,105 @@
|
||||
|
||||
1. Log in to the Cloudflare dashboard → **Workers & Pages**.
|
||||
2. If the account has no `workers.dev` subdomain yet, set it once
|
||||
(Workers & Pages → account **Subdomain**). Since v1.1 it only shapes
|
||||
**PR preview URLs** (`<version>-softharbor.<subdomain>.workers.dev`) —
|
||||
production lives on `softharbor.net`.
|
||||
(Workers & Pages → account **Subdomain**). Since the domain arrived
|
||||
(2026-07-20) it only shaped **PR preview URLs**
|
||||
(`<version>-softharbor.<subdomain>.workers.dev`), which nothing makes since
|
||||
D38 — production lives on `softharbor.net`.
|
||||
3. Copy the **Account ID** (right sidebar of the Workers overview).
|
||||
4. Onboard the `softharbor.net` zone — Free plan, nameservers, DNSSEC —
|
||||
per **docs/16 §2** (action item H2). The zone must exist before the
|
||||
first deploy, because `wrangler.jsonc` declares the custom-domain route.
|
||||
custom domains can be attached (docs/16 §3).
|
||||
|
||||
### A2. API token (for CI)
|
||||
### A2. API token (for CI) — retired
|
||||
|
||||
Dashboard → My Profile → **API Tokens** → Create Token → template
|
||||
**"Edit Cloudflare Workers"** → scope it to *this account only* → create,
|
||||
copy once. Then in GitHub repo → Settings → Secrets and variables →
|
||||
Actions:
|
||||
**Not used since 2026-07-28** (docs/12 §1). Deployment is Cloudflare Workers
|
||||
Builds (A4), which deploys with account-level credentials; no workflow in
|
||||
this repository deploys. The old `CLOUDFLARE_API_TOKEN` /
|
||||
`CLOUDFLARE_ACCOUNT_ID` repository secrets are unused and should be deleted
|
||||
(docs/15 §5). If a workflow ever needs a token again, it must carry zone
|
||||
scopes (**Zone → Workers Routes → Edit**, **Zone → DNS → Edit**) as well as
|
||||
Workers ones, and must never be committed or put in `wrangler.jsonc`.
|
||||
|
||||
| Secret | Value |
|
||||
|---|---|
|
||||
| `CLOUDFLARE_API_TOKEN` | the token above |
|
||||
| `CLOUDFLARE_ACCOUNT_ID` | account id from A1.3 |
|
||||
|
||||
Never put the token in `wrangler.jsonc` or commit it anywhere.
|
||||
|
||||
### A3. Local first deploy (sanity check before CI exists)
|
||||
### A3. Local deploy (bootstrap and emergencies only)
|
||||
|
||||
```bash
|
||||
pnpm build # → dist/
|
||||
pnpm install
|
||||
pnpm dlx wrangler@4 login # one-time browser OAuth (local only)
|
||||
pnpm dlx wrangler@4 deploy # reads wrangler.jsonc (docs/02 §7)
|
||||
pnpm deploy # = pnpm run build && wrangler deploy
|
||||
```
|
||||
|
||||
The `routes` block in `wrangler.jsonc` (docs/02 §7) makes this deploy also
|
||||
attach `softharbor.net` to the Worker: the apex DNS record and certificate
|
||||
are provisioned automatically. Verify: `https://softharbor.net/` renders,
|
||||
This uploads `dist/` **and** the Worker (`main`, docs/02 §7). Since commit
|
||||
66c6255 (2026-07-28) `wrangler.jsonc` declares no `routes`:
|
||||
`softharbor.net` and `www.softharbor.net` are Custom Domains attached in
|
||||
the dashboard (Workers & Pages → softharbor → Domains), and a deploy leaves
|
||||
them untouched. Re-creating the Worker from a fresh clone therefore needs
|
||||
both domains re-attached by hand (docs/16 §3), plus the runtime secret
|
||||
(Part E).
|
||||
|
||||
**Prefer merging to a hand deploy** (A4): the CI `deploy` job is the
|
||||
pipeline, and a local `wrangler deploy` bypasses `ci`. If one is ever
|
||||
needed, run it from the commit `main` points at, so the next CI deploy
|
||||
does not surprise anyone.
|
||||
|
||||
Verify after any deploy: `https://softharbor.net/` renders,
|
||||
`/apps/does-not-exist` returns **HTTP 404** with our page (not a blank
|
||||
Cloudflare 404), `/_headers` rules apply (`curl -I` shows CSP — docs/09
|
||||
§4), and the old `softharbor.<subdomain>.workers.dev` no longer serves
|
||||
(`workers_dev: false`). Full domain checklist: docs/16 §10.
|
||||
Cloudflare 404), `_headers` rules apply (`curl -I` shows `frame-ancestors`
|
||||
— docs/09 §4), and the old `softharbor.<subdomain>.workers.dev` no longer
|
||||
serves (`workers_dev: false`). Full domain checklist: docs/16 §10.
|
||||
|
||||
### A4. Continuous deploys & previews
|
||||
### A4. Continuous deploys (the CI `deploy` job, D38)
|
||||
|
||||
- Production: `deploy.yml` runs `cloudflare/wrangler-action` on every push
|
||||
to `main` (docs/12 §3).
|
||||
- PR previews: `wrangler versions upload` produces a per-version preview
|
||||
URL (enabled by `"preview_urls": true`); the workflow comments it on the
|
||||
PR. Previews also run the legal gate — expected.
|
||||
- **Production:** `ci.yml`'s **`deploy`** job on the Gitea runner (docs/12
|
||||
§3) — after `build` and `gates` pass on a push to `main`, it runs
|
||||
`pnpm build` and `pnpm exec wrangler deploy --message "main <sha7>"` with
|
||||
the user-level secrets `CLOUDFLARE_API_TOKEN` / `CLOUDFLARE_ACCOUNT_ID`,
|
||||
then polls `/api/apps.json` until production serves the new build.
|
||||
- **Until 2026-11-24** Cloudflare **Workers Builds** (the dashboard's git
|
||||
integration) built and deployed every push to `main` from the GitHub
|
||||
repository, and uploaded a preview version per PR. It stopped with the
|
||||
GitHub account; it is **not** reconnected to the GitLab mirror, which
|
||||
would deploy a second time on every mirror push. The Worker's Settings →
|
||||
Builds shows no connected repository — keep it that way.
|
||||
- **No PR previews.** Gitea hands same-repository PRs (Renovate's
|
||||
included) the secrets, so no job a branch can run carries the Cloudflare
|
||||
token. `"preview_urls": true` stays, and `_headers` still marks
|
||||
`*.workers.dev` `noindex` (docs/16 §3), for a hand-made
|
||||
`wrangler versions upload`.
|
||||
- **The runner is the maintainer's PC:** a merge deploys when the PC is on;
|
||||
otherwise the job waits and runs when the runner comes back.
|
||||
- **Release step — verify production after every merge** (docs/13 §3): the
|
||||
job's last step already waits for the new build; then check the headers
|
||||
(`curl -I`), the per-page CSP meta, `POST /api/verify` (Part E), `/rss.xml`
|
||||
and the content-hashed `/_astro/` names.
|
||||
- The **build environment is the job container**: it reads `.nvmrc`
|
||||
(Node 26) and `packageManager` (pnpm 11) like CI, so production is built
|
||||
exactly as CI validated it.
|
||||
- Rollback: dashboard → the Worker → **Deployments** → promote a previous
|
||||
version, or `wrangler rollback`.
|
||||
|
||||
### A5. Observability & limits
|
||||
|
||||
- Metrics: Worker → **Metrics** shows request counts/status classes. There
|
||||
is no `wrangler tail` stream for pure static assets (no script runs) —
|
||||
client-side errors reach us via the bug-report flow instead (docs/05 §A5–A6).
|
||||
- **Billing:** with no `main` script and `run_worker_first` unset, every
|
||||
request is served from static assets and is **not billed** — the site
|
||||
costs $0 in usage on the existing Workers Paid plan.
|
||||
- Metrics: Worker → **Metrics** shows request counts and status classes.
|
||||
Static-asset requests run no code, so there is nothing to `tail` for them
|
||||
— client-side errors reach us via the bug-report flow instead (docs/05
|
||||
§A5–A6).
|
||||
- **Workers Logs** (`observability.enabled`, invocation logs **off**) hold
|
||||
only the Worker's own one-line JSON events: `{event: "verify", outcome,
|
||||
ms}` per verification, `verify.secret_refused` when Siteverify rejects our
|
||||
secret, `verify.crash` on an unexpected exception, `{event:
|
||||
"rate_limited", kind}` per refused request — never an IP address or a
|
||||
token (Parts E and F). A request that passes logs nothing. `wrangler tail` shows the same lines live.
|
||||
- **Billing:** only requests that run the Worker are billed Worker
|
||||
requests. Since D32 that is every page, feed and data file —
|
||||
`run_worker_first` is `/*` minus the files a page loads (Part F) — while
|
||||
`/_astro/*`, icons and the service worker stay on the asset server and
|
||||
are **not billed**.
|
||||
- Asset limits to respect (check current values in CF docs at setup time;
|
||||
documented limits as of writing): max ~20 000 files per deploy, 25 MiB
|
||||
per file. SoftHarbor's budget: < 1 000 files, largest file < 1 MiB —
|
||||
comfortable margins. `validate-data.mjs` warns at 15 000 files.
|
||||
per file. SoftHarbor's footprint (local build, 2026-10-21): 763 files in
|
||||
`dist/`, 701 of them HTML; the largest is `/vi/apps` at ~1.3 MB raw
|
||||
(~125 KB gzip — every card is server-rendered, docs/15 §2 item 9).
|
||||
Comfortable margins; nothing checks this automatically.
|
||||
|
||||
## Part B — What we deliberately do NOT configure in v1
|
||||
|
||||
@@ -77,52 +118,96 @@ no Bot Fight Mode, no Custom Errors** — each has a reason and a ready-made
|
||||
activation recipe in **docs/16 §9** (short version: static assets are
|
||||
unbilled so there's nothing to protect, bot challenges would break our own
|
||||
`/api/apps.json` + RSS consumers, and Custom Errors is a paid-zone
|
||||
feature). HSTS **is** configured — zone-level, phased (docs/16 §5). Do not
|
||||
"pre-enable" anything beyond that.
|
||||
feature). HSTS **is** configured — zone-level, now at phase P3 (docs/16
|
||||
§5). Do not "pre-enable" anything beyond that.
|
||||
|
||||
Two things that look similar but are not zone features: the Worker's
|
||||
**Workers Rate Limiting bindings** — `SITE_LIMITER` for every page, feed
|
||||
and data request (Part F, D32) and `VERIFY_LIMITER` for `/api/verify`
|
||||
(Part E) — and **Turnstile** (D25), a widget our own page loads after
|
||||
consent. The zone's rate-limiting rule stays off; the Worker's limit is
|
||||
configured in `wrangler.jsonc` and answers with our own 429 page. Conversely, the zone's
|
||||
**Speed Brain** speculative prefetch should be **off**: Cloudflare refuses
|
||||
prefetch on Worker requests with a 503, which is why `astro.config.ts` sets
|
||||
`prefetch: false` (docs/16 §9 — ⚠ verify the zone setting; production still
|
||||
sent a `Speculation-Rules` header on 2026-10-21).
|
||||
|
||||
## Part C — Error-page matrix (the definitive answer)
|
||||
|
||||
Background (re-verified 2026-07-20): Cloudflare **Custom Errors** is a
|
||||
**paid zone-plan** feature — our zone is Free (docs/16 §1/N4) — and even
|
||||
where available it does not apply to 500/501/503/505 responses. Therefore
|
||||
in v1 **every error page a user can see must come from our own build
|
||||
output**, and anything Cloudflare itself emits shows Cloudflare's default
|
||||
page:
|
||||
**every error page a user can see must come from our own build output**,
|
||||
and anything Cloudflare itself emits shows Cloudflare's default page.
|
||||
`/api/verify` (Part E) answers the gate's own `fetch` in JSON, never with a
|
||||
document. Since D32 the Worker runs first for pages too (Part F), and its
|
||||
one page-level answer is our own 429.
|
||||
|
||||
| Status | Who generates it in v1 | What the user sees | Our artifact |
|
||||
| Status | Who generates it | What the user sees | Our artifact |
|
||||
|---|---|---|---|
|
||||
| 404 | Static assets router (URL matches nothing) | Our branded page, real HTTP 404 | `dist/404.html` via `not_found_handling: "404-page"` |
|
||||
| 500-class | Practically cannot originate from us (no script). Cloudflare infra errors (52x) show Cloudflare's page — not customizable on a Free zone | CF default (rare) | `/errors/500` template kept **dormant** |
|
||||
| 403 | Nothing issues 403 in v1 — WAF features deliberately OFF (docs/16 §9). If ever enabled on the Free zone, blocks render **Cloudflare's default page** (custom responses are paid features) | n/a | `/errors/403` dormant template |
|
||||
| 429 | Nothing issues 429 in v1 — rate limiting deliberately OFF (docs/16 §9); same Free-zone caveat as 403 | n/a | `/errors/429` dormant template |
|
||||
| 404 | The asset server, URL matches nothing. Since D32 the request reaches it through the Worker's `env.ASSETS.fetch(request)`, which applies the same `not_found_handling`; a miss under an asset-first pattern (`/_astro/*`, icons) gets it directly | Our branded, bilingual page, real HTTP 404, no legal gate | `dist/404.html` via `not_found_handling: "404-page"` |
|
||||
| 500-class (pages) | Practically cannot originate from us: the Worker in front of pages only counts and hands over, and catches every limiter failure (Part F); an uncaught exception would show Cloudflare's 1101 page. Cloudflare infra errors (52x) show Cloudflare's page — not customizable on a Free zone | CF default (rare) | `/errors/500` template kept **dormant** |
|
||||
| 403 (pages) | Nothing issues 403 for a page — WAF features deliberately OFF (docs/16 §9). If ever enabled on the Free zone, blocks render **Cloudflare's default page** (custom responses are paid features) | n/a | `/errors/403` dormant template |
|
||||
| 429 (pages) | The Worker's site-wide rate limit (Part F, D32): over 60 requests per 10 s from one address. The zone rule stays OFF (docs/16 §9) | Our branded, bilingual page, real HTTP 429, `Retry-After: 10`, no legal gate | `/errors/429` — **live** since D32 |
|
||||
| 429 (`/api/*`) | The same limit, for the data endpoints and `/api/verify` | JSON `{ "error": "rate_limited" }`, `Retry-After: 10`; CORS-readable on the dataset | — |
|
||||
| 4xx/5xx from `/api/verify` | The Worker: `400 invalid_json`/`invalid_token`, `403 bad_origin`/`rejected`, `405`, `413`, `415`, `429 rate_limited` (`Retry-After: 60` from its own limit, 10 from the site-wide one), `503 not_configured`/`unavailable`, `500 internal_error` | Nothing — the gate reads the status; 403 asks Turnstile for a fresh challenge, every other failure **fails open** (docs/05 §A9) | JSON body `{ "error": "<code>" }` |
|
||||
| No internet | Client-side | Our offline page | `offline.html` via service worker (Part D) |
|
||||
|
||||
The dormant templates cost three static pages and make a future Pro-zone
|
||||
Custom Errors switch-on a config-only task (docs/16 §9 recipe).
|
||||
The two dormant templates (403, 500) cost two static pages and make a
|
||||
future Pro-zone Custom Errors switch-on a config-only task (docs/16 §9
|
||||
recipe); the 429 one has been live since D32. Like
|
||||
`/404` and `/offline` they are gate-exempt, `noindex` and bilingual on one
|
||||
page (docs/06 §5).
|
||||
|
||||
## Part D — PWA / offline ("No Internet" page)
|
||||
|
||||
Scope: **offline fallback only** — not an installable app-cache of the whole
|
||||
site (a software directory is useless offline anyway; we just refuse to show
|
||||
a browser dinosaur).
|
||||
Scope: **an installable app with an offline fallback** — not an app-cache of
|
||||
the whole site (a software directory is useless offline anyway; we just
|
||||
refuse to show a browser dinosaur). Since v1.1 the manifest is linked and
|
||||
has proper icons, so the site is installable; navigation still always goes
|
||||
to the network.
|
||||
|
||||
```ts
|
||||
// astro.config.ts — AstroPWA(…)
|
||||
AstroPWA({
|
||||
// astro.config.ts — AstroPWAIntegration(…) (abridged; @vite-pwa/astro 2,
|
||||
// which under pnpm needs rolldown, magicast, @vite-pwa/workbox-swkit and
|
||||
// @vite-pwa/workbox-window as direct devDependencies — docs/09 §7)
|
||||
AstroPWAIntegration({
|
||||
registerType: 'autoUpdate',
|
||||
// MUST be explicit: without it registerSW.js is emitted but referenced by
|
||||
// no page, and the SW silently never registers (S5). 'script', not
|
||||
// 'inline': an injected inline snippet would not be in the CSP hashes.
|
||||
injectRegister: 'script',
|
||||
minify: false, // check:sw reads the SW by its names
|
||||
includeManifestIcons: false, // 2.x default; 1.x never precached them
|
||||
manifest: {
|
||||
name: 'SoftHarbor', short_name: 'SoftHarbor',
|
||||
id: '/', name: 'SoftHarbor', short_name: 'SoftHarbor', lang: 'en',
|
||||
description: 'Free & buy-once desktop software, one page.',
|
||||
theme_color: '#f7f4ee', background_color: '#f7f4ee',
|
||||
icons: [/* 192, 512, maskable — public/icons/ */],
|
||||
// The icon tile's colour (scripts/gen-icons.mjs), so the install splash
|
||||
// and title bar match the icon rather than the page.
|
||||
theme_color: '#0B4F7A', background_color: '#0B4F7A',
|
||||
icons: [
|
||||
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png', purpose: 'any' },
|
||||
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png', purpose: 'any' },
|
||||
{ src: '/icons/maskable-512.png', sizes: '512x512', type: 'image/png', purpose: 'maskable' },
|
||||
{ src: '/favicon.svg', sizes: 'any', type: 'image/svg+xml', purpose: 'any' },
|
||||
],
|
||||
},
|
||||
workbox: {
|
||||
// '_astro/*.woff2', NOT 'fonts/*.woff2' — Astro hashes fonts into _astro/,
|
||||
// so the old glob matched nothing and the offline page would have rendered
|
||||
// unstyled (found in M1, 2026-07-27).
|
||||
// 'offline.html', NOT 'offline/**' — the glob is coupled to build.format
|
||||
// ('file'), so the directory pattern matched nothing (M1/S5).
|
||||
globPatterns: ['offline.html', '_astro/*.woff2', 'favicon.svg'], // shell only
|
||||
generateSW: { // `workbox` in 1.x
|
||||
// What /offline needs, and nothing more. Coupled to build.format
|
||||
// ('offline.html', never 'offline/**') and to Astro hashing fonts and
|
||||
// CSS into _astro/ (never a /fonts/ dir) — both mistakes once matched
|
||||
// nothing, silently (M1, S5).
|
||||
globPatterns: [
|
||||
'offline.html',
|
||||
'_astro/*.css', // inlineStylesheets 'never'
|
||||
'_astro/{errors,theme,analytics}.*.js', // the head scripts
|
||||
'_astro/be-vietnam-pro-{latin,vietnamese}-400-normal.*.woff2',
|
||||
'_astro/bricolage-grotesque-{latin,vietnamese}-wght-normal.*.woff2',
|
||||
'favicon.svg',
|
||||
],
|
||||
skipWaiting: true, // registerSW.js never posts SKIP_WAITING
|
||||
clientsClaim: true, // control the page that installed the SW (S5)
|
||||
cleanupOutdatedCaches: true, // a 1.x default, opt-in since 2.x
|
||||
// MUST be the empty string, and must be present. Omitting the key does
|
||||
// NOT disable it: vite-plugin-pwa's `defaultWorkbox` sets
|
||||
// navigateFallback: 'index.html', which emitted
|
||||
@@ -147,15 +232,197 @@ AstroPWA({
|
||||
|
||||
Behavior: online navigation always hits the network (content freshness >
|
||||
offline cleverness); when a navigation fails, the precached `/offline` page
|
||||
renders. **`pnpm check:sw` asserts this against the emitted `dist/sw.js`** —
|
||||
no `NavigationRoute`, a `NetworkOnly` navigation handler, `/offline` and the
|
||||
fonts actually precached, and `registerSW.js` referenced by a page. Every one
|
||||
of the four service-worker bugs this project has had was silent at build time,
|
||||
so the config being right is not evidence that the output is. Spike S5 verifies: SW registers under the production origin
|
||||
(`softharbor.net` — a preview URL is acceptable for early iterations, but
|
||||
renders — styled, with its scripts and the latin + Vietnamese body and
|
||||
display faces. The precache is deliberately small: until v1.1 the SW
|
||||
precached all 13 font files (211 KB) on a visitor's first page view, yet
|
||||
missed the CSS the offline page links (it rendered unstyled exactly when
|
||||
needed). Other faces fall back to system fonts offline. `Base.astro` links
|
||||
`/manifest.webmanifest` (the plugin emits it but links it from no page) and
|
||||
loads `/registerSW.js` with `defer`; icons come from `pnpm icons`
|
||||
(`scripts/gen-icons.mjs`, output committed to `public/`).
|
||||
|
||||
**`pnpm check:sw` asserts this against the emitted `dist/sw.js`** — no
|
||||
`NavigationRoute`, a `NetworkOnly` navigation handler with the `/offline`
|
||||
fallback, `offline.html` and fonts precached, **every stylesheet and
|
||||
`/_astro/` script `/offline` loads precached**, `skipWaiting()` present,
|
||||
and `registerSW.js` plus the manifest link referenced from `dist/index.html`.
|
||||
Every one of the service-worker bugs this project has had was silent at
|
||||
build time, so the config being right is not evidence that the output is.
|
||||
Spike S5 verifies: SW registers under the production origin
|
||||
(`softharbor.net` — a preview URL was acceptable for early iterations, but
|
||||
the final pass runs on the real origin), fallback fires in airplane mode,
|
||||
`autoUpdate` swaps SW without a stale lockout, and the legal gate behaves
|
||||
on the offline page (it is exempt — docs/14 §2).
|
||||
on the offline page (it is exempt — the page declares `gateExempt`, docs/14
|
||||
Part 2).
|
||||
|
||||
## Part E — The `/api/verify` endpoint (D25)
|
||||
|
||||
The one piece of server code (CLAUDE.md hard rule 1 as amended). Threat
|
||||
model and the client half: docs/09 §4a, docs/05 §A9.
|
||||
|
||||
**Files.** `worker/index.ts` (entry: the site-wide limit first — Part F —
|
||||
then `/api/verify` → `handleVerify`, anything else →
|
||||
`env.ASSETS.fetch(request)`), `worker/limit.ts` (Part F), `worker/verify.ts`
|
||||
(the endpoint), `worker/http.ts` (JSON responses, streamed body cap, rate-limit
|
||||
key), `worker/env.ts` (bindings, typed by hand — `@cloudflare/workers-types`
|
||||
would collide with the DOM lib the site compiles against). Tested by the
|
||||
Vitest `worker` project against a stubbed Siteverify (docs/11 §2); CI also
|
||||
runs `wrangler deploy --dry-run` so a config error fails before production.
|
||||
|
||||
**Routing.** Until D32 `/api/verify` was the only path that ran the
|
||||
Worker before the asset server. Now every request except the files a page
|
||||
loads does (Part F), and each one passes the site-wide limit before it
|
||||
reaches this endpoint — whose own, stricter limit comes on top.
|
||||
|
||||
**Contract — `POST /api/verify`**, body `{"token": "<turnstile token>"}`:
|
||||
|
||||
| Check | Refusal |
|
||||
|---|---|
|
||||
| method is POST | `405` + `Allow: POST` |
|
||||
| `Origin` equals the origin the request arrived on (works on previews and `wrangler dev` without a host list) | `403 bad_origin` |
|
||||
| `TURNSTILE_SECRET` present | `503 not_configured` |
|
||||
| rate limit — 20 per 60 s per IPv4 address or IPv6 /64 (`VERIFY_LIMITER`) | `429 rate_limited`, `Retry-After: 60` |
|
||||
| `Content-Type` exactly `application/json` (what a cross-site form or no-preflight fetch cannot send) | `415` |
|
||||
| body ≤ 4 KB — `Content-Length` checked, then counted **while streaming** | `413` |
|
||||
| valid JSON with a non-empty string `token` ≤ 2048 chars | `400 invalid_json` / `invalid_token` |
|
||||
| Siteverify says success, `hostname` = request host, `action` = `legal_gate`, `challenge_ts` ≤ 300 s old | `403 rejected` |
|
||||
| Siteverify cannot answer (network error or 5xx twice, a 4xx or non-JSON reply, `internal-error`) or refuses our secret | `503 unavailable` |
|
||||
|
||||
Success is `200 {"ok":true}`. Siteverify is called with the secret, the
|
||||
token, `remoteip` (the `CF-Connecting-IP`, never logged) and an
|
||||
**idempotency key**; a network error or 5xx is retried **once with the same
|
||||
key**, so the retry is answered instead of calling the token spent (4 s
|
||||
timeout per attempt). Cloudflare's documented test secrets (`1x…`, `2x…`,
|
||||
`3x…`) skip the hostname/action/age comparison, whose values they fake.
|
||||
|
||||
Every response is `no-store` JSON with its own security headers —
|
||||
`Content-Security-Policy: default-src 'none'; frame-ancestors 'none'`,
|
||||
`Cross-Origin-Resource-Policy: same-origin`, `Referrer-Policy`,
|
||||
`X-Content-Type-Options` — because `public/_headers` applies to asset
|
||||
responses only, never to what Worker code returns.
|
||||
|
||||
**Fail open, always.** The verdict only decides how long the gate remembers
|
||||
the visitor (48 h after a pass, 1 h otherwise — docs/05 §A9). It never
|
||||
blocks a page: no secret, a Siteverify outage, the rate limit, a blocked
|
||||
script — all let the person in.
|
||||
|
||||
**Secrets.** `TURNSTILE_SECRET` is a **runtime** secret: dashboard →
|
||||
Workers & Pages → softharbor → Settings → Variables and Secrets, or
|
||||
`wrangler secret put TURNSTILE_SECRET`. A build-time variable (a CI
|
||||
`env:`) is invisible to the Worker at runtime, and a deploy never touches
|
||||
the runtime secret. Missing → every check answers 503 and
|
||||
the gate fails open, so the site works but nobody is verified — check it
|
||||
after re-creating the Worker (docs/13 §2). Set in production: verified
|
||||
2026-10-21 — a junk token got `403 {"error":"rejected"}`, not
|
||||
`503 not_configured`. For `wrangler dev`, copy `.dev.vars.example` to
|
||||
`.dev.vars` (git-ignored): it holds Cloudflare's always-pass **test**
|
||||
secret, which pairs with the test sitekey the gate uses on localhost. The
|
||||
sitekey itself is public by design and lives in `src/lib/turnstile.ts`.
|
||||
|
||||
**Logs.** One line per request — `{event: "verify", outcome, ms}` — plus
|
||||
`verify.secret_refused` (our secret was rejected: ours to fix) and
|
||||
`verify.crash`. Never an IP address, never a token; invocation logs are off
|
||||
in `wrangler.jsonc`.
|
||||
|
||||
## Part F — The site-wide rate limit (D32)
|
||||
|
||||
**What runs it.** `assets.run_worker_first` is `/*` minus the files a page
|
||||
loads once it has passed: `/_astro/*` (content-hashed JS, CSS and fonts),
|
||||
`/icons/*`, the two favicons, `apple-touch-icon.png`,
|
||||
`manifest.webmanifest`, `sw.js`, `registerSW.js` and `workbox-*.js`.
|
||||
Negative patterns win over `/*` whatever the order. Every other request —
|
||||
every page in both locales, `/rss.xml`, the sitemaps, `/search-index.json`,
|
||||
`/api/apps.json`, `/api/verify`, `robots.txt`, `security.txt`, a miss that
|
||||
ends on the 404 page — runs `worker/index.ts` first, which spends one unit
|
||||
of `SITE_LIMITER` (`worker/limit.ts`) and, under the limit, hands the
|
||||
request to `env.ASSETS.fetch()` unchanged.
|
||||
|
||||
**The limit.** 60 requests per 10 s per IPv4 address or IPv6 /64 (`rateKey`,
|
||||
the same key as Part E), per Cloudflare location, namespace `4102`. That is
|
||||
six a second, sustained: a person reading spends one per page, and what it
|
||||
stops is a flood or a scraper running flat out. Generous on purpose,
|
||||
because a school, an office or a mobile carrier's NAT puts many people
|
||||
behind one address. `/api/verify` keeps its own 20 per 60 s on top
|
||||
(Part E).
|
||||
|
||||
**What it really counts — measured on the PR preview, 2026-10-26.**
|
||||
Cloudflare calls the binding "permissive, eventually consistent": each
|
||||
machine counts locally and shares its counts in the background. In
|
||||
practice that sharing barely shows:
|
||||
|
||||
| Burst (one client address) | Result |
|
||||
|---|---|
|
||||
| 120 requests over **one keep-alive connection**, ~11 s | 61 × `200`, then 59 × `429` — the limit, almost to the request |
|
||||
| 1 500 requests, **a new connection each** (30 in parallel), ~20 a second for 79 s | 0 × `429` (1 487 × `200`, 12 local connection errors, one `500` whose cause version URLs cannot log) |
|
||||
| Production `VERIFY_LIMITER`, 40 `POST /api/verify` in 33 s, a new connection each | 0 × `429` against 20 per 60 s |
|
||||
|
||||
So the Worker's limit holds a client that **reuses its connection** —
|
||||
every browser (one HTTP/2 connection per origin) and most scrapers — and
|
||||
answers it with our own page. A flood that opens a fresh connection per
|
||||
request spreads over many machines and mostly slips past it; stopping that
|
||||
is the job of the zone rule, which counts per IP at the edge before the
|
||||
Worker runs: **layer 1, recommended** (docs/16 §9.1). Neither layer locks
|
||||
out a person reading normally.
|
||||
|
||||
**Over the limit:**
|
||||
|
||||
| Request | Answer |
|
||||
|---|---|
|
||||
| `/api/*` | `429 {"error":"rate_limited"}`, `Retry-After: 10`, `no-store`, the Worker's own security headers — plus `Access-Control-Allow-Origin: *` and `Access-Control-Expose-Headers: Retry-After` on everything but `/api/verify`: the dataset is CORS-open, so its refusal must be readable cross-origin, or a consumer sees a network error instead |
|
||||
| anything else | The built `/errors/429` page (bilingual, gate-exempt, `noindex`) with status **429**, `Retry-After: 10`, `Cache-Control: no-store` and no `ETag`; every other header is the asset server's (`_headers`). `HEAD` gets the headers only. If that page cannot be fetched, a plain-text 429 |
|
||||
|
||||
The 429 page's own CSS, JS and fonts are under `/_astro/` and never
|
||||
limited, so it renders whole. The service worker's navigation route is
|
||||
NetworkOnly and a 429 is a response, not a failure, so the visitor sees
|
||||
our page rather than the offline fallback.
|
||||
|
||||
**Fails open.** No `SITE_LIMITER` binding, no `CF-Connecting-IP` (no client
|
||||
to tell apart — one shared bucket would throttle strangers together), or a
|
||||
limiter that throws: the request is served as if there were no limit.
|
||||
|
||||
**`_headers` still apply.** What `env.ASSETS.fetch()` returns carries
|
||||
`public/_headers` exactly as a direct asset response does — measured under
|
||||
`wrangler dev` and on the PR preview on 2026-10-26 (frame-ancestors,
|
||||
`X-Frame-Options`, nosniff, the workers.dev `X-Robots-Tag`, the `/_astro/*`
|
||||
and `/api/apps.json` `Cache-Control`; and on a refused page the same set
|
||||
plus `Retry-After: 10` and `no-store`). Moving pages behind the Worker
|
||||
changed no header.
|
||||
|
||||
**Billing.** Every routed request is now a billed Worker invocation. The
|
||||
account is on Workers Paid: 10 million requests and 30 million
|
||||
CPU-milliseconds a month included, then $0.30 per million requests and
|
||||
$0.02 per million CPU-ms; Workers Logs include 20 million events a month
|
||||
(Cloudflare's pricing page, read 2026-10-26 — Logs move to Observability
|
||||
pricing on 2026-12-01). A page view costs one invocation and well under a
|
||||
millisecond of CPU, and the files a page loads stay free ("requests to
|
||||
static assets are free and unlimited"). A refused request
|
||||
is billed too — the limit makes a flood cheap to answer, not free. A flood
|
||||
large enough to matter is the job of Cloudflare's automatic DDoS
|
||||
protection and of the zone rate-limiting rule (docs/16 §9.1), both of
|
||||
which act before the Worker runs, so what they block is never billed —
|
||||
the rule at the price of Cloudflare's default block page.
|
||||
|
||||
**Logs.** One line per refusal, `{event: "rate_limited", kind: "page" |
|
||||
"api"}` — never the address; a request that passes logs nothing. Rate
|
||||
limiting bindings have no dashboard of their own, so these lines (Workers
|
||||
Logs, `wrangler tail`) are the only record of how often the limit fires —
|
||||
read them before tuning it.
|
||||
|
||||
**Tests.** Unit: `worker/limit.test.ts` (stubbed limiter and asset server;
|
||||
`wrangler.jsonc` is read with wrangler's `unstable_readConfig` to hold
|
||||
`period` equal to `RETRY_AFTER_S` and keep the negative patterns). End to
|
||||
end: the Playwright project `worker` (`e2e/worker.spec.ts`) starts `wrangler
|
||||
dev` on `dist/` with the real config — Miniflare simulates the binding in
|
||||
fixed windows aligned to the clock, without counting refusals — and floods
|
||||
it: exactly the configured 60 × 200 and then 429s, the 429 page rendered
|
||||
and styled in Chrome, `/api/*` answering JSON, a page's own files still
|
||||
200, everyone back in when the window passes. On a deployed version: the
|
||||
burst check in docs/13 §2.
|
||||
|
||||
**Tuning.** Change `limit` in `wrangler.jsonc` with a decision-log line;
|
||||
`period` must stay equal to `RETRY_AFTER_S` (a test holds them together).
|
||||
Keep namespace ids unique on the account — bindings that share one share
|
||||
their counters, across Workers too.
|
||||
|
||||
## Appendix — Future custom-domain package (superseded in v1.1)
|
||||
|
||||
@@ -168,8 +435,9 @@ sit in this appendix, for the record:
|
||||
into `_headers`, and `preload` is a separate explicit decision (H9).
|
||||
- `www` → apex uses **zone Redirect Rules** — the static `_redirects` file
|
||||
cannot match hostnames and stays reserved for path-level slug renames.
|
||||
- Rate limiting and Bot Fight Mode are **deliberately OFF**, not enabled by
|
||||
default (reasons + recipes: docs/16 §9); on the Free zone their block
|
||||
pages would be Cloudflare defaults anyway.
|
||||
- Rate limiting and Bot Fight Mode are **deliberately OFF** at the zone,
|
||||
not enabled by default (reasons + recipes: docs/16 §9); on the Free zone
|
||||
their block pages would be Cloudflare defaults anyway. Since D32 rate
|
||||
limiting lives in the Worker instead (Part F), with our own 429 page.
|
||||
- The workers.dev route is **disabled** (`workers_dev: false`) rather than
|
||||
served-with-noindex — cleaner than the old "decide then" note.
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
## 1. Posture in one paragraph
|
||||
|
||||
A static site with no accounts, no forms, no cookies, no third-party
|
||||
requests, and no server code has a small attack surface — the residual risks
|
||||
are **supply chain** (our build), **data integrity** (a malicious or sloppy
|
||||
listing), and **reputation** (recommending software that later turns out
|
||||
harmful). Sections below address exactly those three, plus the honest-privacy
|
||||
story.
|
||||
A static site with no accounts, no forms, no cookies and no page-serving
|
||||
server code has a small attack surface — the residual risks are **supply
|
||||
chain** (our build), **data integrity** (a malicious or sloppy listing), and
|
||||
**reputation** (recommending software that later turns out harmful).
|
||||
Since v1.1 two deliberate additions widen it slightly and are covered
|
||||
here: **one server endpoint**, `POST /api/verify` (D25, §4a), and **two
|
||||
disclosed Cloudflare services** loaded by our own code — Web Analytics
|
||||
(D26) and Turnstile (D25). Sections below address all of that, plus the
|
||||
honest-privacy story.
|
||||
|
||||
## 2. Threat model
|
||||
|
||||
@@ -15,19 +18,24 @@ story.
|
||||
|---|---|---|---|
|
||||
| T1 | Visitors' machines | A listed app is/becomes malware; user installs it trusting us | Inclusion criteria C5–C7; vetting checklist §6; dated `security.status` (never a guarantee — hard rule 4); quarantine pipeline (docs/03 §5); monthly re-verification (docs/13 §6); Disclaimer (docs/14 §3a) |
|
||||
| T2 | Visitors | Typosquat/mirror `links.download` sneaks into a PR | Official-domain rule (hard rule 8); L4 human review compares domain to vendor's known domain; lychee catches parked/dead domains; PRs from non-maintainers never auto-merge |
|
||||
| T3 | Site integrity | Supply-chain compromise of a dependency poisons the build | §7: lockfile, `ignore-scripts`, Renovate + osv-scanner, SHA-pinned actions, minimal dependency count |
|
||||
| T4 | Site integrity | XSS via data fields | All rendering through Astro's default escaping; **no `set:html` anywhere** (lint-banned); schema constrains URLs to https; CSP §4 as backstop |
|
||||
| T5 | Visitors | Clickjacking / framing on a look-alike site | `frame-ancestors 'none'` + `X-Frame-Options: DENY` |
|
||||
| T6 | Repo | Malicious PR alters workflows/scripts | Branch protection; CODEOWNERS on `.github/**`, `scripts/**`, `src/data/**`; workflows from forks get read-only token (GitHub default) |
|
||||
| T7 | Availability | DDoS | Cloudflare edge absorbs; static assets, nothing to exhaust; no further action in v1 |
|
||||
| T8 | Users' privacy | Tracking/leakage | No analytics, no third-party origins (CSP-enforced), localStorage-only prefs §8 |
|
||||
| T9 | The domain itself | `softharbor.net` hijack (registrar/DNS) or email spoofing "from" the domain | Registrar transfer lock + auto-renew, DNSSEC enabled, zone changes only via the two admin paths (dashboard, wrangler deploy); SPF + DMARC (`p=quarantine` → `reject`) — all in docs/16 §2/§6 |
|
||||
| T3 | Site integrity | Supply-chain compromise of a dependency poisons the build | §7: frozen lockfile, `allowBuilds` allowlist, Renovate (3-day release age) + osv-scanner + `pnpm audit`, SHA-pinned actions, the ops `security.yml` (gitleaks, Opengrep, osv-scanner) + Qodana, minimal dependency count |
|
||||
| T4 | Site integrity | XSS via data fields | All rendering through Astro's default escaping; `set:html` lint-banned (`astro/no-set-html-directive`) except five named files that inline build-time SVG, JSON-LD or one constant (docs/10 §3); JSON-LD escapes `<`; schema constrains URLs to https; CSP §4 as backstop |
|
||||
| T5 | Visitors | Clickjacking / framing on a look-alike site | `frame-ancestors 'none'` + `X-Frame-Options: DENY` (and on Worker responses, §4a) |
|
||||
| T6 | Repo | Malicious PR alters workflows/scripts/the Worker | Gitea branch protection on `main`: PR required, owner-only push, required checks `CI / build (*)` + `CI / gates (*)` (docs/12 §8); only the owner can open PRs on Gitea — outside merge requests arrive on the GitLab mirror, where no CI runs, and are applied by hand (D38); CODEOWNERS on `.gitea/`, `scripts/`, `src/data/`, `worker/`; every workflow declares least `permissions:` (the repo default token is read-write); `persist-credentials: false` on checkout; step outputs reach shell only via `env:` (no `${{ }}` in `run:`) |
|
||||
| T7 | Availability | DDoS, floods, runaway scrapers | Cloudflare's edge DDoS protection absorbs volumetric attacks before any code runs. Above that, the Worker's site-wide limit (D32, docs/08 Part F): 60 requests per 10 s per IPv4 or IPv6 /64 for every page, feed and data file, answered with our own 429 page or JSON — measured to hold a client on one connection (every browser, most scrapers) but not a flood opening a new connection per request, which is what the recommended zone rule in front of it is for (docs/16 §9.1). The files a page loads are never limited, so a page that passed loads whole; the limit and `/api/verify` both fail open, so an outage of either locks nobody out (§4a) |
|
||||
| T8 | Users' privacy | Tracking/leakage | No cookies, no ads, no fingerprinting by us. Two Cloudflare services only, both started by our code: Web Analytics (cookieless; never under Global Privacy Control or off the production host) and Turnstile (only after the documents are accepted). The CSP allows exactly their origins (§4); storage inventory §8 |
|
||||
| T9 | The domain itself | `softharbor.net` hijack (registrar/DNS) or email spoofing "from" the domain | Registrar transfer lock + auto-renew, DNSSEC enabled, zone changes only via the dashboard (custom domains are attached there, docs/16 §3); SPF + DMARC `p=quarantine` observed 2026-10-21 (→ `reject` planned) — docs/16 §2/§6 |
|
||||
| T10 | The endpoint | `/api/verify` abused: cross-site POSTs, replayed or foreign tokens, oversized bodies, burning the Siteverify allowance | Same-origin check; `application/json` only; body ≤ 4 KB counted while streaming; token ≤ 2048 chars; Siteverify verdict re-checked for host, `action: legal_gate` and age ≤ 300 s; idempotency key; Workers Rate Limiting 20/60 s per IPv4 or IPv6 /64; `no-store` — all in §4a |
|
||||
| T11 | Visitors | A compromised third-party script (the analytics beacon or Turnstile's `api.js`) | Loaded by our code only, from exactly two CSP-listed origins; analytics never on previews, localhost or under GPC; Turnstile only after acceptance and inside its own iframe. No Subresource Integrity — both are unversioned URLs Cloudflare updates in place — so this is an **accepted** dependency on Cloudflare, the host we already trust with every byte |
|
||||
|
||||
## 3. Non-existent surfaces (by design)
|
||||
|
||||
No auth, no sessions, no cookies, no server input parsing, no file uploads,
|
||||
no comments. Keep it that way: any feature that adds one of these requires a
|
||||
threat-model update in this file first.
|
||||
No auth, no sessions, no cookies, no file uploads, no comments, no
|
||||
database. **One** server input exists since v1.1: the JSON body of
|
||||
`POST /api/verify` — at most 4 KB, one string field, read only to be
|
||||
forwarded to Siteverify (§4a). Keep it that way: any feature that adds one
|
||||
of these — or a second server input — requires a threat-model update in
|
||||
this file first, and a decision-log entry (hard rule 1).
|
||||
|
||||
## 4. HTTP headers & CSP
|
||||
|
||||
@@ -42,19 +50,41 @@ threat-model update in this file first.
|
||||
Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), usb=()
|
||||
Cross-Origin-Opener-Policy: same-origin
|
||||
Cross-Origin-Resource-Policy: same-origin
|
||||
Cache-Control: public, max-age=0, must-revalidate
|
||||
|
||||
/_astro/*
|
||||
! Cache-Control
|
||||
Cache-Control: public, max-age=31536000, immutable
|
||||
|
||||
/api/apps.json
|
||||
! Cache-Control
|
||||
Access-Control-Allow-Origin: *
|
||||
Cache-Control: public, max-age=300
|
||||
|
||||
/search-index.json
|
||||
! Cache-Control
|
||||
Cache-Control: public, max-age=300
|
||||
|
||||
# RFC 9116 §3: text/plain WITH charset=utf-8
|
||||
/.well-known/security.txt
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
# PR preview versions (docs/16 §3); never matches the custom domain
|
||||
https://:version.:subdomain.workers.dev/*
|
||||
X-Robots-Tag: noindex
|
||||
```
|
||||
|
||||
**`/*` sets no `Cache-Control`, and every specific rule detaches with
|
||||
`! Cache-Control` first** (fixed 2026-10-21). Cloudflare applies *every*
|
||||
matching rule and **joins** a header set by several of them with a comma —
|
||||
it does not override. With the old `/*` value, hashed assets were served
|
||||
`public, max-age=0, must-revalidate, public, max-age=31536000, immutable`;
|
||||
browsers honour the first `max-age` (RFC 9111 even says to treat
|
||||
conflicting directives as stale), so every "immutable" asset was
|
||||
revalidated on every load and the JSON feeds were never cached. HTML,
|
||||
`sw.js` and the manifest still get `public, max-age=0, must-revalidate` —
|
||||
Cloudflare's own default for static assets. `_headers` applies only to
|
||||
asset responses; the Worker sets its own headers (§4a).
|
||||
|
||||
**There is no `/fonts/*` rule.** Astro content-hashes the self-hosted fonts
|
||||
into `/_astro/` along with JS and CSS, so the `/fonts/*` rule earlier drafts
|
||||
carried matched nothing (verified in M1: `dist/` contains 13 `.woff2` files,
|
||||
@@ -66,7 +96,9 @@ Notes:
|
||||
- **The CSP is split between a header and a meta tag (decision D20,
|
||||
supersedes D18).** Settled empirically in spike S1, 2026-07-27:
|
||||
- `<ClientRouter />` compiles to an **external** module script — it was
|
||||
never the problem.
|
||||
never the problem. (It is gone anyway since v1.1: Astro does not
|
||||
support ClientRouter together with `security.csp`, and a soft
|
||||
navigation kept the *first* page's meta policy — docs/02 §6.)
|
||||
- **Astro's island hydration is.** Every `client:*` directive emits inline
|
||||
bootstrap scripts into that page's HTML. With six islands (docs/02 §5)
|
||||
that is effectively every page, so the D18 plan — "ship nothing inline,
|
||||
@@ -79,23 +111,58 @@ Notes:
|
||||
`script-src`/`style-src` plus our other directives. No hand-maintained
|
||||
hash list, no `emit-csp.mjs`, no placeholder to forget — which was B4's
|
||||
real complaint.
|
||||
- **The policy (v1.1)**, emitted on every page:
|
||||
`default-src 'self'; img-src 'self' data:; font-src 'self';
|
||||
connect-src 'self' https://cloudflareinsights.com;
|
||||
frame-src https://challenges.cloudflare.com; manifest-src 'self';
|
||||
base-uri 'none'; form-action 'none'; object-src 'none'`, plus
|
||||
`script-src 'self' https://static.cloudflareinsights.com
|
||||
https://challenges.cloudflare.com` + Astro's hashes, and
|
||||
`style-src 'self'` + hashes. The two Cloudflare origins are D26 (beacon
|
||||
script + beacon POST) and D25 (Turnstile `api.js` + its iframe) — nothing
|
||||
else third-party, and adding an origin needs a decision-log entry (hard
|
||||
rule 7). `scriptDirective.resources` **replaces** Astro's default list, so
|
||||
`'self'` is spelled out or every same-origin script, islands included,
|
||||
would be refused. `styleDirective.hashes` adds the one style Astro cannot
|
||||
hash itself: the inline View Transitions opt-in (`src/lib/inlineCss.ts`,
|
||||
docs/02 §6).
|
||||
- **The meta tag comes first.** A meta-tag CSP governs only what the parser
|
||||
meets *after* it, and Astro appends its tag at the end of `<head>` —
|
||||
behind `errors.js`, `theme.js`, `registerSW.js` and the analytics loader.
|
||||
`scripts/postbuild.mjs` (`pnpm postbuild:html`) moves it to directly after
|
||||
`<meta charset="utf-8">` on every page, so nothing in the document
|
||||
precedes the policy meant to cover it. Our head scripts are external,
|
||||
content-hashed `/_astro/` files (docs/02 §4) — covered by `'self'`, no
|
||||
hash needed.
|
||||
- **`_headers` must therefore carry only `frame-ancestors`.** A header CSP
|
||||
and a meta CSP are enforced as **two separate policies**, and a resource
|
||||
must satisfy both — so a `script-src 'self'` in `_headers` would intersect
|
||||
with the meta policy, drop Astro's hashes, and break every island.
|
||||
`frame-ancestors` is the one directive that must stay in the header,
|
||||
because meta-tag CSP ignores it by spec. `X-Frame-Options: DENY` backs it up.
|
||||
- **Verification** (re-run whenever islands or the config change): build,
|
||||
then for every page in `dist/**/*.html` recompute the SHA-256 of each
|
||||
inline `<script>`/`<style>` body and assert it appears in that page's meta
|
||||
policy. P1 ran this and every inline resource matched. This check is worth
|
||||
keeping as a build-time assertion — it fails loudly if Astro ever emits a
|
||||
snippet it does not hash.
|
||||
- **Verification is a build gate: `pnpm check:csp`** (`scripts/check-csp.mjs`,
|
||||
formerly `check-no-inline-styles` / `check:styles`), run inside
|
||||
`pnpm build` after `postbuild:html`. For every page in `dist/**/*.html` it
|
||||
fails on: **no CSP meta** at all (formerly a silent skip), **any
|
||||
`<script>` before the meta**, any `<style>` element whose SHA-256 is not
|
||||
in that page's own policy, any inline `<script>` body not in it (JSON-LD
|
||||
data blocks excepted), and **any `style` attribute** in any of HTML's
|
||||
three quoting forms. Then the e2e suite loads real pages in Chromium and
|
||||
fails on any `securitypolicyviolation` event (docs/11 §5), and in the
|
||||
field `errors.js` records violations into bug reports (docs/05 §A5) —
|
||||
a meta policy cannot carry `report-uri`/`report-to`, so that event is the
|
||||
only signal there is. **Check against `astro preview`, never `astro
|
||||
dev`**: the dev server emits no CSP meta, so a check there returns a false
|
||||
clean.
|
||||
- **Residual weakness, accepted:** Astro puts the union of known hashes in
|
||||
every page's policy (9 hashes on a page that uses 3). Still hash-pinned,
|
||||
never `'unsafe-inline'` — just less tight per page than it could be.
|
||||
every page's policy (2026-10-21 build: 7 script and 3 style hashes on
|
||||
every page, of which `/` uses 4 and 2, a legal page 3 and 2). Still
|
||||
hash-pinned, never `'unsafe-inline'` — just less tight per page than it
|
||||
could be.
|
||||
- **JSON-LD** (`<script type="application/ld+json">`) is a data block, not an
|
||||
executable script, so it needs no hash under `script-src` (docs/16 §7).
|
||||
`astro/no-unsafe-inline-scripts` bans hand-written inline script bodies in
|
||||
source; JSON-LD is allowed by that rule's defaults.
|
||||
- **`style-src` bans inline `style` ATTRIBUTES, not just `<style>` blocks.**
|
||||
Hashes do not apply to attributes — only `'unsafe-hashes'` or
|
||||
`'unsafe-inline'` would permit them, and the policy has neither. So any
|
||||
@@ -104,48 +171,132 @@ Notes:
|
||||
is how the sticky header shipped fully transparent, letting page content bleed
|
||||
through it (found 2026-07-28, after ~49 inline styles had accumulated).
|
||||
Every design token is therefore exposed as a Tailwind utility
|
||||
(`text-sh-muted`, `bg-sh-surface`, `border-sh-border`) in
|
||||
`src/styles/global.css`, and **`pnpm check:styles` fails the build if any
|
||||
`style=` reaches `dist/`**. Do not relax the policy to fix a styling bug.
|
||||
- **Cache-Control precedence.** Cloudflare `_headers` applies *every* matching
|
||||
rule, so the `/*` block's `must-revalidate` and the `/_astro/*` `immutable`
|
||||
rule both match hashed assets. Verify with
|
||||
`curl -sI https://softharbor.net/_astro/<file>` that the immutable value
|
||||
wins; if it does not, scope the HTML rule to `/*.html` instead of `/*`.
|
||||
(`text-sh-muted`, `bg-sh-surface`, `border-sh-control`) in
|
||||
`src/styles/global.css`, and **`pnpm check:csp` fails the build if any
|
||||
`style=` reaches `dist/`**. The same applies to **runtime** writes: an
|
||||
`el.style.*` assignment is refused too and no build check can see it —
|
||||
that is how sorting broke in production (docs/05 §A3); code never writes
|
||||
`el.style`. Do not relax the policy to fix a styling bug.
|
||||
- **Turnstile's iframe has its own CSP** and logs violations for probes it
|
||||
makes itself (`*.challenges.cloudflare.com` hosts). Those messages come
|
||||
from inside Cloudflare's frame, cannot be fixed from the page, and the e2e
|
||||
fixture ignores them; do not loosen ours in response.
|
||||
- `Strict-Transport-Security` is deliberately **absent from `_headers`**:
|
||||
it is configured once at the zone level with a phased max-age rollout
|
||||
(docs/16 §5) so it also rides on redirect responses. Keeping it out of
|
||||
`_headers` avoids two sources of truth with conflicting `max-age`.
|
||||
- `Access-Control-Allow-Origin: *` only on the intentionally-public dataset.
|
||||
- Verify after every deploy touching `_headers`:
|
||||
`curl -sI https://…/ | grep -iE 'content-security|frame|referrer'` +
|
||||
an observatory scan pre-launch (docs/13 §2).
|
||||
- Verify after every deploy touching `_headers` or the CSP (full block:
|
||||
docs/16 §10) — the header CSP must be exactly `frame-ancestors 'none'`,
|
||||
the meta policy must list the two Cloudflare origins, one hashed asset
|
||||
must carry a single `Cache-Control` — plus an observatory scan
|
||||
pre-launch (docs/13 §2):
|
||||
|
||||
```bash
|
||||
curl -sI https://softharbor.net/ | grep -iE 'content-security|frame|referrer|cache-control'
|
||||
curl -s https://softharbor.net/ | grep -o '<meta http-equiv="content-security-policy"[^>]*>'
|
||||
```
|
||||
|
||||
## 4a. The human check (`POST /api/verify`, D25)
|
||||
|
||||
Step 2 of the legal gate (docs/14 Part 2): after a visitor accepts the
|
||||
documents, Cloudflare Turnstile checks that a person — not a bot — is
|
||||
there, and the site's one Worker confirms the result with Cloudflare's
|
||||
Siteverify. Endpoint mechanics, statuses and secrets: docs/08 Part E; the
|
||||
client algorithm and timings: docs/05 §A9.
|
||||
|
||||
**What it is for — and what it is not.** It filters automated traffic
|
||||
politely; it is **not a lock**. SoftHarbor is a public static site: every
|
||||
page is served without asking, and the verdict only decides whether the
|
||||
gate remembers the visitor as checked (`sh:human`, 48 h) or lets them
|
||||
through unchecked (1 h). Every failure on our side — no secret, Siteverify
|
||||
down, rate limit hit, script blocked, timeout — **fails open**. A person is
|
||||
never locked out by an outage, and a bot that defeats it gains nothing a
|
||||
`curl` of the static pages would not already give it.
|
||||
|
||||
**Consent first.** Turnstile's `api.js` is requested only after the
|
||||
visitor accepts the Privacy Policy that describes it — never before (the
|
||||
e2e suite asserts that no Cloudflare request precedes acceptance).
|
||||
|
||||
**Server-side checks** (`worker/verify.ts`, `worker/http.ts`):
|
||||
|
||||
- **Same-origin only** — `Origin` must equal the origin the request arrived
|
||||
on (so previews and `wrangler dev` work without a host list).
|
||||
- **`Content-Type: application/json` exactly** — `text/plain` and form
|
||||
encodings, which a cross-site form or a no-preflight `fetch` can send, are
|
||||
refused (`415`).
|
||||
- **Bounded input** — `Content-Length` ≤ 4096 when declared, and the body is
|
||||
*counted while it streams*, so a body without a length is never buffered
|
||||
past the cap (`413`); `token` must be a non-empty string ≤ 2048 chars.
|
||||
- **The verdict is re-checked, not trusted** — Siteverify's `success` plus
|
||||
`hostname` equal to the request's host (a token minted on another site is
|
||||
refused), `action` equal to `legal_gate` (a token minted for another
|
||||
purpose is refused) and `challenge_ts` at most 300 s old.
|
||||
- **Replay-safe retry** — one retry on a network error or 5xx, with the
|
||||
*same* idempotency key, so the retry is answered instead of reporting the
|
||||
single-use token as spent.
|
||||
- **Rate limit** — Workers Rate Limiting, 20 verifications per 60 s per
|
||||
IPv4 address or IPv6 /64 (a host can rotate through its /64), per
|
||||
Cloudflare location; generous because a school or office shares one NAT
|
||||
address. Over the limit → `429` + `Retry-After: 60` → the gate fails open.
|
||||
- **Responses** — JSON, `Cache-Control: no-store`, and their own security
|
||||
headers (`default-src 'none'; frame-ancestors 'none'` CSP, CORP
|
||||
same-origin, `nosniff`, Referrer-Policy): `_headers` never applies to
|
||||
Worker responses.
|
||||
|
||||
**Privacy.** The token travels to Siteverify with the visitor's IP
|
||||
(`remoteip`); the IP is also the rate-limit key. Neither is stored or
|
||||
logged — Workers Logs keep `{event, outcome, ms}` only, invocation logs off.
|
||||
The secret is a runtime secret (`TURNSTILE_SECRET`), never in the repo.
|
||||
The Privacy Policy's `#turnstile` section says all of this to visitors, and
|
||||
the gate's step 2 links to it.
|
||||
|
||||
**Testing.** Unit tests cover every refusal, verdict and the retry
|
||||
(`worker/*.test.ts`) and the client's fail-open paths
|
||||
(`src/lib/turnstile.test.ts`). The e2e suite stands in for Cloudflare:
|
||||
`api.js` is served from its real URL (so the page CSP is exercised) and
|
||||
`/api/verify` — which `astro preview` does not run — answers 200, 503 or is
|
||||
blocked (docs/11 §5). The Worker itself — routing, both limiters, `_headers` on
|
||||
what it passes through — runs under `wrangler dev` in the e2e project
|
||||
`worker` (docs/11 §5). What only production can show: the real edge, the
|
||||
secret — verified after each deploy (docs/13 §3).
|
||||
|
||||
## 5. Vulnerability reporting
|
||||
|
||||
`public/.well-known/security.txt`:
|
||||
|
||||
```
|
||||
Contact: mailto:contact@softharbor.net
|
||||
Contact: https://github.com/poli0981/softharbor/security/advisories/new
|
||||
Contact: mailto:security@poli0981.dev
|
||||
Preferred-Languages: en, vi
|
||||
Expires: 2027-07-20T00:00:00.000Z
|
||||
Expires: 2027-07-28T00:00:00.000Z
|
||||
Canonical: https://softharbor.net/.well-known/security.txt
|
||||
Policy: https://git.poli0981.dev/poli0981/softharbor/src/branch/main/SECURITY.md
|
||||
```
|
||||
|
||||
(The mailbox goes live via Email Routing before launch — docs/16 §6 / H5.)
|
||||
Served as `text/plain; charset=utf-8` (a `_headers` rule — RFC 9116 §3).
|
||||
Since 2026-10-21 the address is `security@poli0981.dev` (D27,
|
||||
`src/lib/contacts.ts`); `contact@softharbor.net` is retired everywhere.
|
||||
Mail for `poli0981.dev` is delivered to a Google-hosted mailbox (MX
|
||||
`aspmx.l.google.com`, docs/16 §6). `Expires` rolls forward yearly
|
||||
(docs/13 §6).
|
||||
|
||||
Root `SECURITY.md` (created in P6): supported target = latest deploy only;
|
||||
report via GitHub *Private vulnerability reporting* (action item H4) or the
|
||||
H5 email; acknowledgment ≤ 72 h; scope = the site, its workflows, and the
|
||||
Root `SECURITY.md`: supported target = latest deploy only; report by
|
||||
e-mail to `security@poli0981.dev` — the only private channel since D38
|
||||
(GitHub's private vulnerability reporting, and the second `Contact:` line
|
||||
that pointed at it, went with the GitHub account), never a public issue on
|
||||
the GitLab mirror; acknowledgment ≤ 72 h; scope = the site, its
|
||||
build, its workflows, **the `/api/verify` endpoint** (`worker/`) and the
|
||||
dataset (wrong/dangerous link reports are explicitly welcome and handled via
|
||||
the quarantine flow); out of scope = vulnerabilities in *listed third-party
|
||||
apps themselves* → report to their vendors, but tell us too so we can flag.
|
||||
|
||||
## 6. Data-vetting checklist (before `security.status: "clean"`)
|
||||
|
||||
Run all steps; record date in `checkedAt`; link scan in `evidence` when
|
||||
available. This checklist is the *definition* of "clean".
|
||||
Run all steps before an entry is first marked `clean`, and again whenever
|
||||
its links change; link the scan in `evidence`. This checklist is the
|
||||
*definition* of "clean". Since 2026-10-23 `checkedAt` is the date of the
|
||||
**latest scan** (step 5): `vt-recheck.yml` re-runs that step at least every 90
|
||||
days and moves the date, while steps 1–4 stay with the maintainer (D30).
|
||||
|
||||
1. **Domain authenticity** — homepage/download domain matches the vendor's
|
||||
known official domain (cross-check the project's repo, Wikipedia infobox,
|
||||
@@ -158,15 +309,27 @@ available. This checklist is the *definition* of "clean".
|
||||
4. **Installer hygiene** — release notes/installer page shows no bundled
|
||||
third-party offers; if the vendor publishes checksums/signatures, note
|
||||
that on the entry's `tags` (`signed-releases`) — optional.
|
||||
5. **VirusTotal (when feasible)** — scan the download-page URL; for
|
||||
directly-linked binaries of less-known apps, scan the file. Paste the
|
||||
permalink into `evidence`.
|
||||
5. **VirusTotal** — scan the download-page URL; for directly-linked
|
||||
binaries of less-known apps, scan the file. The permalink goes into
|
||||
`evidence` — **required**: since v1.1 the schema refuses `clean` (and
|
||||
`flagged`) without an `evidence` URL (docs/04 §2). **Assisted since
|
||||
2026-10-23** (docs/12 §4b): `scripts/vt-recheck.mjs` submits
|
||||
`links.download` through the VirusTotal API and writes the permalink and
|
||||
date; dispatched on a data branch it scans a PR's new entries before
|
||||
merge, and daily on `main` it re-scans every check older than 90 days. It
|
||||
never decides `clean` or `flagged`: zero detections keep the status, any
|
||||
detection drops `clean` to `unverified` and opens a `[vt] <slug>` issue,
|
||||
and a promotion to `clean` happens only for slugs the maintainer lists
|
||||
(`promote`).
|
||||
6. **Judgment call** — anything uneasy ⇒ leave `unverified` (listable) or
|
||||
`flagged` (quarantine) — never "clean by default".
|
||||
|
||||
Flag procedure (any time after listing): set `status: "flagged"` via PR or
|
||||
let the quarantine workflow act on a maintainer-labeled issue; the workflow
|
||||
moves the file and opens the tracking issue (docs/12 §4).
|
||||
Flag procedure (any time after listing): set `status: "flagged"` and run
|
||||
`pnpm quarantine` in the same PR — `validate:data` fails a flagged entry
|
||||
left in `src/data/apps/`. If a flagged entry ever reaches `main` anyway, the
|
||||
quarantine workflow (on data pushes and nightly) moves it in a signed PR and
|
||||
opens the tracking issue (docs/12 §4). The workflow acts on files only — it
|
||||
does not read issue labels.
|
||||
|
||||
## 7. Supply-chain hygiene
|
||||
|
||||
@@ -188,29 +351,129 @@ moves the file and opens the tracking issue (docs/12 §4).
|
||||
Current allowlist, each entry a decision: `esbuild: true` (native binary,
|
||||
the build cannot run without it), `lefthook: true` (installs our git
|
||||
hooks), `workerd: false` (Cloudflare's local Worker runtime, pulled in by
|
||||
wrangler — we ship pure static assets and never run a Worker locally).
|
||||
Flipping any entry to `true` requires a decision-log line.
|
||||
- Renovate weekly + `osv-scanner` + `pnpm audit --prod` gate (docs/01 §5,
|
||||
docs/12 §6).
|
||||
- All GitHub Actions pinned to **commit SHAs** with a version comment.
|
||||
wrangler). The `workerd` comment in `pnpm-workspace.yaml` still says we
|
||||
"never run a Worker locally"; since D25 there is a Worker, but it is
|
||||
tested under Vitest in Node with a stubbed Siteverify and validated by
|
||||
`wrangler deploy --dry-run` in CI, neither of which needs `workerd`.
|
||||
Whether `wrangler dev` (with `.dev.vars`) runs with the script blocked:
|
||||
⚠ verify. Flipping any entry to `true` requires a decision-log line.
|
||||
- **`overrides`** in `pnpm-workspace.yaml` force patched floors —
|
||||
today only `fast-uri` (≥ 3.1.9, the advisory ids in a comment; ajv 8.20
|
||||
still ranges `^3.0.1`), reached only through `@astrojs/check`'s language
|
||||
server; nothing ships to a visitor. `minimatch` (GHSA-g3hv-75wg-m249,
|
||||
≥ 11.0.1, added 2026-11-04) was **retired on 2026-11-24**:
|
||||
typescript-eslint 8.73 asks for ^11.0.1 itself. It had crossed a major for
|
||||
that one caller, accepted only because the caller used API 11 kept, and
|
||||
had been scoped to it since 2026-11-16 — eslint 10.15 and
|
||||
`@eslint/config-array` asked for ^11.0.5 themselves, and a global
|
||||
`^11.0.1` floor had held them on 11.0.4, below their own range: an
|
||||
override must never be looser than what a caller already asks for. Every
|
||||
minimatch 11 requires
|
||||
brace-expansion ≥ 5.0.12, so that floor was retired the same day, as was
|
||||
`miniflare>undici` once miniflare itself pinned the fixed 7.30.1.
|
||||
`glob` (GHSA-3g3m-2fjr-6pw4) and `serialize-javascript`
|
||||
(GHSA-m5mm-p8h7-m29v) were retired on 2026-11-09: both came in through
|
||||
`@vite-pwa/astro` 1 → `workbox-build` 7, which left the tree with
|
||||
`@vite-pwa/astro` 2 (nothing depends on glob any more;
|
||||
`@vite-pwa/workbox-build` 8 asks for serialize-javascript ≥ 7.1.4 itself).
|
||||
CI's OSV-Scanner step fails `gates` on any of them, so a new transitive
|
||||
advisory blocks every PR — Renovate's included — until it is handled
|
||||
here. Remove a line once upstream's own range moves past it.
|
||||
- **`packageExtensions`** (2026-11-09 → 2026-11-24) gave
|
||||
`@astrojs/astro2tsx` 0.1.3 the `@emnapi/runtime` 1.11.3 that matched the
|
||||
`@emnapi/core` it pinned: Rolldown 1.3.0 (Astro 7.4.7) had brought
|
||||
`@emnapi/runtime` 2.0.0-beta.2 into the graph, pnpm resolved astro2tsx's
|
||||
peer to it, and the mismatched pair threw on import — which `astro check`
|
||||
reported as "`@astrojs/check` is not installed" (GitHub Dependabot PR
|
||||
#67). **Retired on 2026-11-24:** astro2tsx 0.1.4 declares the runtime
|
||||
itself. If `astro check` ever claims it is not installed again, import
|
||||
the package directly with Node to see the real error.
|
||||
- **`@vite-pwa/astro` 2** (adopted 2026-11-09 at 2.0.1, a rewrite on
|
||||
`@unplugin-pwa` 0.0.x). 2.0.0 was refused on 2026-11-04: under pnpm's
|
||||
strict layout it emitted a service worker with bare
|
||||
`@vite-pwa/workbox-swkit/*` imports and an empty precache, and the build
|
||||
still reported success. The cause is resolution, not the plugin: the SW
|
||||
and `registerSW.js` are bundled from the project root, where pnpm does
|
||||
not hoist the plugin's own dependencies. So four packages are direct
|
||||
devDependencies — `rolldown`, `magicast`, `@vite-pwa/workbox-swkit`,
|
||||
`@vite-pwa/workbox-window` (knip ignores the last two: nothing imports
|
||||
them by name) — and the two workbox packages must resolve to the exact
|
||||
version `@vite-pwa/workbox-build` pins. `check:sw` now also fails on an
|
||||
ES `import` in `sw.js` or `registerSW.js` (both run as classic scripts),
|
||||
on an `importScripts()` target the build did not emit, and on a missing
|
||||
`cleanupOutdatedCaches()` (a 1.x default, opt-in in 2.x). Verified in a
|
||||
browser: the SW registers and controls the page, precaches the same 16
|
||||
entries as 1.2.0, and serves the styled `/offline` page when the server
|
||||
is gone.
|
||||
- **Advisories no release fixes yet** cannot get an override, so they are
|
||||
skipped by id instead — narrowly, in two places that must agree:
|
||||
`osv-scanner.toml` (`[[IgnoredVulns]]`, each with an `effectiveUntil`
|
||||
expiry — osv-scanner 2.x deprecated `ignoreUntil` — and a reason, so the
|
||||
gate fails again and makes someone look) and `auditConfig.ignoreGhsas` in
|
||||
`pnpm-workspace.yaml` for `pnpm audit --prod`. Only for code that merges
|
||||
or reads our own input at build time and ships nothing to a visitor.
|
||||
**No entry today.** The last one, `deepmerge` ≤ 4.3.1
|
||||
(GHSA-gcqx-w48m-w2h4, low; skipped 2026-10-30, through
|
||||
`@sveltejs/vite-plugin-svelte` merging `svelte.config.js`), was
|
||||
**withdrawn** by its publisher on 2026-11-16; osv-scanner reported the
|
||||
skip unused, and both lines went on 2026-11-24.
|
||||
- **pnpm 11's default 24 h `minimumReleaseAge`** refuses any release younger
|
||||
than a day; Renovate's 3-day release age keeps its PRs installable under
|
||||
`--frozen-lockfile` (docs/12 §6).
|
||||
- **Renovate** (since D38, the owner's self-hosted Renovate on Gitea —
|
||||
`renovate.json` extends `poli0981/renovate-config`, docs/12 §6): grouped
|
||||
non-major PRs, a 3-day release age for npm, and OSV security PRs that
|
||||
skip the wait. (Dependabot did this from 2026-10-21 until the GitHub
|
||||
account was suspended.) `osv-scanner` + `pnpm audit --prod` gate every PR
|
||||
and push to `main` (`ci.yml` `gates` job — docs/01 §5, docs/12 §2). The
|
||||
ops `security.yml` — gitleaks over the whole history, Opengrep SAST,
|
||||
osv-scanner — runs on PRs, pushes and weekly, replacing CodeQL; Qodana
|
||||
(`qodana-js`, D35) adds WebStorm's inspections, its findings in Qodana
|
||||
Cloud. SonarQube Cloud left with GitHub (D38).
|
||||
- Every action in this repository's workflows is pinned to a **commit
|
||||
SHA** with a version comment (Renovate bumps both); the ops repository's
|
||||
reusable workflows are pinned to the commit of an ops tag (bumped by
|
||||
hand), never a moving branch. `notify.yml` passes the one secret it needs,
|
||||
not `secrets: inherit`.
|
||||
- **Signed commits:** the maintainer's are GPG-signed and Gitea verifies
|
||||
them against the key on the account; branch protection does **not**
|
||||
require them since D38, because the bots' commits (quarantine,
|
||||
vt-recheck) cannot be signed through Gitea's API (docs/12 §4/§8).
|
||||
- Dependency budget: adding any new runtime dependency requires a
|
||||
decision-log entry; prefer zero-dependency utilities.
|
||||
|
||||
## 8. Privacy (implementation-level; user-facing text in docs/14 §3b)
|
||||
|
||||
Client storage inventory — the complete list:
|
||||
Client storage inventory — the complete list. Every localStorage key has
|
||||
exactly one typed reader/writer in `src/lib/` (lint-enforced, docs/10 §3)
|
||||
— `theme.js` mirrors three of them pre-paint — which is what keeps this
|
||||
table true:
|
||||
|
||||
| Key / store | Content | Lifetime |
|
||||
|---|---|---|
|
||||
| `sh:legal` | accepted legal version string | until cleared |
|
||||
| `sh:lang` | `en` \| `vi` preference | until cleared |
|
||||
| `sh:legal` | accepted legal version string (`LEGAL_VERSION`) | until cleared |
|
||||
| `sh:human` | expiry timestamp (ms) of the human check: +48 h after a pass, +1 h when the gate let the visitor through unchecked (§4a) | self-expiring; until cleared |
|
||||
| `sh:lang` | `en` \| `vi` — the language suggestion was answered | until cleared |
|
||||
| `sh:theme` | `light` \| `dark` (absent = system) | until cleared |
|
||||
| SW cache | offline shell (offline page, fonts, favicon) | managed by Workbox |
|
||||
| Ring buffer | in-memory only (docs/05 §A5) | page lifetime |
|
||||
| `sh:scrollbar` | `thin` \| `hidden` (absent = default) | until cleared |
|
||||
| `sh:motion` | `reduce` (absent = follow the OS) | until cleared |
|
||||
| `sh:keys` | `off` (absent = the "/" shortcut is on; v1.4, WCAG 2.1.4) | until cleared |
|
||||
| SW cache | offline page, its CSS, the three head scripts, the latin + Vietnamese body/display fonts, favicon | managed by Workbox |
|
||||
| Ring buffer | `window.__shErrors`, in memory only (docs/05 §A5) | page lifetime |
|
||||
| Session fallbacks | `globalThis` flags holding the gate's acceptance / check result when storage throws | page lifetime |
|
||||
|
||||
No cookies, no fingerprinting, no analytics (D14), no third-party requests
|
||||
(CSP-enforced). Network operator: Cloudflare serves requests and therefore
|
||||
processes IPs/logs as infrastructure provider under its own policies —
|
||||
disclosed in the Privacy Policy. Bug reports happen on GitHub under GitHub's
|
||||
terms; the prefilled URL shows the user *exactly* what would be submitted
|
||||
before they post it (docs/05 §A6) — nothing is sent automatically.
|
||||
**SoftHarbor sets no cookies** and does no fingerprinting. Who else sees
|
||||
what — the list the Privacy Policy mirrors (`/legal/privacy`):
|
||||
|
||||
| Party | When | What |
|
||||
|---|---|---|
|
||||
| Cloudflare (hosting) | every request | connection data such as IP addresses, as infrastructure provider under its own policy; we see aggregate counts only |
|
||||
| Our Worker's rate limit (D32) | every page, feed and data request | the IP address (IPv6: its /64) as the key of a counter Cloudflare's rate limiter keeps for 10 s; never logged — a refusal logs only its kind (docs/08 Part F) |
|
||||
| Cloudflare Web Analytics (D26) | page loads on `softharbor.net` only, **never** when `navigator.globalPrivacyControl === true` | page URL, referrer, load timings, user-agent; cookieless; we see totals |
|
||||
| Cloudflare Turnstile (D25) | once, after the documents are accepted | browser/device signals inside its iframe; the token plus IP go to Siteverify via our Worker (§4a) |
|
||||
| GitLab (the mirror, D38) | only if the visitor opens "Report a bug" | the prefilled URL carries page URL, user-agent and recent error lines — GitLab receives them **when the link is opened**; nothing is filed until the visitor submits (docs/05 §A6). GitHub until 2026-11-24 |
|
||||
| Google | only if someone emails us | `@poli0981.dev` mail is delivered to a Google-hosted mailbox |
|
||||
|
||||
Adding a party, a key or a store is a change to this table, to the
|
||||
Privacy Policy and — for a third-party runtime request — a decision-log
|
||||
entry (hard rule 7).
|
||||
@@ -14,20 +14,31 @@
|
||||
}
|
||||
```
|
||||
|
||||
Rules: no `any` (use `unknown` + narrowing); no non-null `!` outside tests;
|
||||
no `enum` (union literals); ESM only; type-only imports use `import type`.
|
||||
Shared types derive from Zod (`z.infer<typeof apps.schema>`) — never
|
||||
hand-duplicate the data shape.
|
||||
Rules: no `any` (use `unknown` + narrowing); no non-null `!` outside tests
|
||||
(lint-enforced; `*.test.ts` is the one exception); no `enum` (union
|
||||
literals); ESM only; type-only imports use `import type` (lint-enforced).
|
||||
Shared types derive from the collection schema (`CollectionEntry<'apps'>`)
|
||||
— never hand-duplicate the data shape. Under `exactOptionalPropertyTypes`,
|
||||
`foo?: string` means "absent or string", not "may be passed `undefined`":
|
||||
props filled from optional lookups say `| undefined` explicitly.
|
||||
|
||||
**Two deliberate non-TypeScript corners.** `src/scripts/*.js` (the head
|
||||
scripts — docs/02 §4) are plain *classic* browser JavaScript: Vite copies
|
||||
them verbatim, so no imports, no TypeScript, linted with browser globals in
|
||||
`sourceType: script`. `scripts/*.mjs` are plain Node and never import from
|
||||
`src/` or `astro:content`.
|
||||
|
||||
## 2. Naming
|
||||
|
||||
| Thing | Convention | Example |
|
||||
|---|---|---|
|
||||
| Components (static) | `Sh` + PascalCase `.astro` | `ShAppCard.astro`, `ShBadge.astro` |
|
||||
| Components (static) | `Sh` + PascalCase `.astro` | `ShAppCard.astro`, `ShIcon.astro` |
|
||||
| Page bodies | PascalCase `…Page.astro` in `components/pages/` | `AppDetailPage.astro` |
|
||||
| Islands | `Sh` + PascalCase `.svelte` in `components/islands/` | `ShSearch.svelte` |
|
||||
| Lib modules | camelCase `.ts` | `issueUrl.ts` |
|
||||
| Constants | SCREAMING_SNAKE | `LEGAL_VERSION`, `BUDGET` |
|
||||
| Constants | SCREAMING_SNAKE | `LEGAL_VERSION`, `BUDGET`, `PASS_TTL_MS` |
|
||||
| CSS custom props | `--sh-*` | `--sh-accent` |
|
||||
| CSS classes (global) | `sh-*` | `sh-panel`, `sh-anim`, `sh-nudge-x` |
|
||||
| localStorage | `sh:` prefix | `sh:theme` |
|
||||
| Data files | slug kebab-case | `7-zip.json` |
|
||||
| Branches | `feat/…`, `fix/…`, `data/…`, `docs/…`, `chore/…` | `data/add-vscodium` |
|
||||
@@ -35,49 +46,102 @@ hand-duplicate the data shape.
|
||||
Islands are leaf components: an island never imports another island;
|
||||
cross-island communication goes through nanostores only.
|
||||
|
||||
**Contacts are never hard-coded.** Every email address on the site — pages,
|
||||
legal documents — comes from `src/lib/contacts.ts` (D27); `security.txt`,
|
||||
`SECURITY.md` and the other root files must match it.
|
||||
|
||||
## 3. Lint & format
|
||||
|
||||
`eslint.config.js` (flat): `typescript-eslint` strict-type-checked +
|
||||
`eslint-plugin-astro` + `eslint-plugin-svelte` recommended sets, plus
|
||||
project rules:
|
||||
`eslint.config.js` (flat): `@eslint/js` recommended + `typescript-eslint`
|
||||
**strict** + `eslint-plugin-astro` + `eslint-plugin-svelte` recommended
|
||||
sets; on `.ts` files, type-aware rules via `projectService`
|
||||
(`consistent-type-imports`, `no-floating-promises`, `no-misused-promises`,
|
||||
`await-thenable`, `no-unnecessary-type-assertion` — every island awaits a
|
||||
fetch or a dynamic import). Project rules:
|
||||
|
||||
- `no-restricted-syntax` bans `set:html` (T4) and direct
|
||||
`localStorage`/`document.cookie` access outside `src/lib/` (all storage
|
||||
goes through typed helpers).
|
||||
- `no-restricted-imports` bans importing `minisearch` outside
|
||||
`src/lib/search.ts` and `src/pages/search-index.json.ts`.
|
||||
- **`astro/no-set-html-directive`** bans `set:html` (T4). (An earlier
|
||||
hand-rolled `no-restricted-syntax` selector matched nothing for months —
|
||||
never replace this with a custom selector.) **One carve-out, scoped to
|
||||
five named files**, each injecting only build-time or constant markup:
|
||||
`ShIcon.astro` (Lucide SVG via `src/lib/icon.ts` — *the* UI-icon
|
||||
component, so the carve-out covers one component instead of every page),
|
||||
`ShAppCard.astro` and `AppDetailPage.astro` (app logos via
|
||||
`src/lib/logo.ts`), `ShJsonLd.astro` (JSON-LD, `<` escaped) and
|
||||
`Base.astro` (the one inline style constant, `src/lib/inlineCss.ts`).
|
||||
The only data-derived input is a schema-constrained icon/logo **key**,
|
||||
never interpolated into markup; an unknown key throws at build time.
|
||||
- **`astro/no-unsafe-inline-scripts`** — Astro hashes only the scripts it
|
||||
bundles, so a hand-written inline `<script>` body would ship unhashed and
|
||||
be refused by the browser. JSON-LD data blocks are allowed.
|
||||
- **`no-restricted-globals: localStorage`** everywhere in `src/` except
|
||||
`src/lib/` — all storage goes through the typed helpers (`legal.ts`,
|
||||
`human.ts`, `theme.ts`, `prefs.ts`, `lang.ts`), so every key has exactly
|
||||
one reader and writer and the privacy inventory (docs/09 §8) stays true.
|
||||
- `src/scripts/*.js` lint as classic browser scripts; `scripts/**` and root
|
||||
configs with Node globals.
|
||||
|
||||
MiniSearch is imported statically only by `src/lib/search.ts` (build time)
|
||||
and dynamically by `src/lib/searchIndex.ts` (client) — a convention, not a
|
||||
lint rule (`searchOptions.ts` must stay free of it, or the library lands
|
||||
back in every page's bundle).
|
||||
|
||||
**Icons.** In `.astro`: `<ShIcon name="arrow-right" motion="nudge-x" />` —
|
||||
build-time Lucide, decorative unless given a `label`. In islands:
|
||||
`import IconX from '~icons/lucide/x'` (`unplugin-icons`, `compiler:
|
||||
'svelte'`). Never an `<img>` icon, never a runtime fetch.
|
||||
|
||||
**No inline styles — ever.** No `style="…"` attribute in markup and no
|
||||
`el.style.*` write at runtime: CSP `style-src` drops both silently (docs/09
|
||||
§4). Use Tailwind utilities — every design token is one (`text-sh-muted`,
|
||||
`bg-sh-surface`, `border-sh-control`, `shadow-sh-2`) — or a class in
|
||||
`global.css`; hide with the `hidden` attribute, reorder by moving nodes.
|
||||
`pnpm check:csp` fails the build on any `style=` in `dist/`; runtime writes
|
||||
are caught only by the e2e suite's CSP-violation check, so do not write
|
||||
them.
|
||||
|
||||
Prettier 3 + `prettier-plugin-astro` + `prettier-plugin-svelte` +
|
||||
`prettier-plugin-tailwindcss` (class sorting). No style debates: Prettier
|
||||
wins; ESLint covers correctness only.
|
||||
wins; ESLint covers correctness only. `docs/` and `CLAUDE.md` are
|
||||
Prettier-ignored on purpose — they are hand-wrapped at ~76 columns with
|
||||
hand-aligned tables.
|
||||
|
||||
## 4. Dead code & hooks
|
||||
|
||||
`knip.json`: entries = `astro.config.ts`, `src/pages/**`, `scripts/*.mjs`;
|
||||
knip runs in CI; unused exports/deps fail the build.
|
||||
`knip.json`: entries = `src/pages/**/*.{astro,ts}`, `scripts/*.mjs`,
|
||||
`src/scripts/*.js`; project = `src/**` (CSS included, so knip follows
|
||||
`global.css`'s `@import`s to Fontsource and `tailwindcss` — until
|
||||
2026-11-04 those were listed under `ignoreDependencies` instead), `scripts/**`,
|
||||
`e2e/**`, `worker/**`. knip runs in CI (`build` job); unused files, exports
|
||||
or deps fail it.
|
||||
|
||||
`lefthook.yml`:
|
||||
`lefthook.yml` (lefthook 2 `jobs:` syntax):
|
||||
|
||||
```yaml
|
||||
pre-commit:
|
||||
parallel: true
|
||||
commands:
|
||||
format:
|
||||
jobs:
|
||||
- name: format
|
||||
glob: '*.{ts,js,mjs,astro,svelte,css,json,jsonc,yml,yaml,md}'
|
||||
exclude: ['src/data/apps/*.json']
|
||||
run: pnpm prettier --write {staged_files}
|
||||
stage_fixed: true # fix-and-restage beats fail-and-retype
|
||||
lint:
|
||||
- name: format-data # by directory: a bulk data change once
|
||||
glob: 'src/data/apps/*.json' # overran Windows' 8 KB command line
|
||||
run: pnpm prettier --write src/data/apps
|
||||
stage_fixed: true
|
||||
- name: lint
|
||||
glob: '*.{ts,js,mjs,astro,svelte}'
|
||||
run: pnpm eslint {staged_files}
|
||||
data:
|
||||
- name: data
|
||||
glob: 'src/data/**'
|
||||
run: pnpm validate:data
|
||||
i18n: # separate glob — see docs/07 §3
|
||||
- name: i18n # separate glob — see docs/07 §3
|
||||
glob: 'src/i18n/**'
|
||||
run: pnpm i18n:check
|
||||
pre-push:
|
||||
commands:
|
||||
test: { run: pnpm test }
|
||||
jobs:
|
||||
- name: test
|
||||
run: pnpm test
|
||||
```
|
||||
|
||||
The `data` and `i18n` hooks are two commands on two globs on purpose. Folding
|
||||
@@ -89,15 +153,24 @@ break parity would be the one edit that skips the gate.
|
||||
|
||||
Conventional Commits, lowercase, imperative: `feat:`, `fix:`, `data:`
|
||||
(dataset changes — custom type, allowed), `docs:`, `chore:`, `ci:`,
|
||||
`refactor:`, `test:`. Scope optional (`feat(search): …`). One logical
|
||||
change per PR; PR description links the doc section it implements. Squash
|
||||
merge; the squash title must itself be a valid conventional commit (it
|
||||
feeds the changelog).
|
||||
`refactor:`, `test:`. Scope optional (`feat(search): …`); dependency PRs
|
||||
(Renovate's, or the maintainer's upkeep) use `chore(deps)` / `fix(deps)`. One logical change per PR; PR
|
||||
description links the doc section it implements and follows
|
||||
`.github/PULL_REQUEST_TEMPLATE.md` (checks, the accessibility checklist,
|
||||
data-PR checklist — v1.4).
|
||||
|
||||
The maintainer's commits are **GPG-signed**; Gitea verifies them against
|
||||
the key on the account. Branch protection does not *require* signatures
|
||||
since D38 — the bots cannot sign (docs/12 §8). **Squash is the merge
|
||||
method**: one commit per change on `main`, a linear history. The
|
||||
squash title must itself be a valid conventional commit (it feeds the
|
||||
changelog), and the squash body lists every commit subject of the branch.
|
||||
|
||||
## 6. License headers
|
||||
|
||||
Every `.ts/.mjs/.astro/.svelte` source file starts with the short SPDX
|
||||
form:
|
||||
Every `.ts/.mjs/.js/.astro/.svelte/.css` source file starts with the short
|
||||
SPDX form (as a `/* */` block in `.js`/`.css`, an HTML comment in
|
||||
`.svelte`):
|
||||
|
||||
```ts
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
@@ -117,10 +190,29 @@ same PR — divergence is a defect.
|
||||
|
||||
## 8. Definition of Done (per PR)
|
||||
|
||||
1. `pnpm lint` + `pnpm test` + `pnpm build` + `pnpm validate:data` +
|
||||
`pnpm i18n:check` green.
|
||||
2. New/changed behavior covered by a unit test when it lives in `src/lib/`.
|
||||
3. Both locales updated when a UI string changed (CI parity check green).
|
||||
4. No new dependency without a decision-log line (docs/15 §4).
|
||||
1. `pnpm lint` + `pnpm check` + `pnpm coverage` (thresholds hold) +
|
||||
`pnpm build` (which runs validate:data, i18n:check and every `dist/`
|
||||
gate) + `pnpm knip` + `pnpm e2e` (after the build) green — CI runs all of
|
||||
them and none is advisory.
|
||||
2. New/changed behavior covered by a test where it lives: a unit test in
|
||||
`src/lib/`, an island test for island state, a script test for a build
|
||||
script, a Worker test for `worker/`, an e2e test for anything only a
|
||||
real browser shows (CSP, top layer, layout).
|
||||
3. Both locales updated when a UI string changed (CI parity check green),
|
||||
keys kept alphabetical.
|
||||
4. No new dependency without a decision-log line (docs/15 §4); no new
|
||||
third-party runtime origin or Worker route without one either (hard
|
||||
rules 1 and 7).
|
||||
5. Docs updated in the same PR when behavior diverges from `docs/**`.
|
||||
6. For data PRs: vetting checklist run (docs/09 §6), `checkedAt` fresh.
|
||||
6. For data PRs: vetting checklist run (docs/09 §6), `checkedAt` fresh,
|
||||
`evidence` linked for `clean`.
|
||||
7. Legal text changed materially (Disclaimer, Terms, Privacy) →
|
||||
`LEGAL_VERSION` bumped with `LEGAL_UPDATED` (docs/14 Part 2); a test
|
||||
enforces it.
|
||||
8. **Accessibility** (ACCESSIBILITY.md, docs/06 §9): anything a visitor sees
|
||||
or operates passes axe in the e2e suite (critical/serious/moderate fail),
|
||||
gets one keyboard-only pass and a screen-reader spot check, and keeps
|
||||
working at 320 px, at 200 % zoom and in forced colours. A rule that
|
||||
cannot be met is explained in the PR, never disabled silently.
|
||||
9. After the squash merge: the merge commit's CI run — its `deploy` job
|
||||
included — is green and production is verified (docs/13 §3).
|
||||
@@ -3,38 +3,70 @@
|
||||
## 1. Shape
|
||||
|
||||
```
|
||||
▲ manual: launch checklist (docs/13 §2) — a11y, visual VI diacritics,
|
||||
│ real-device offline, screen readers
|
||||
│ build-as-integration-test: astro build + validate-data + parity
|
||||
│ + lychee (offline mode) over dist/ internal links
|
||||
│ unit (vitest): src/lib/** — the only place real logic lives
|
||||
▲ manual: launch checklist (docs/13 §2) — screen readers, visual VI
|
||||
│ diacritics, real-device offline, production-only checks
|
||||
│ e2e (Playwright + axe): the BUILT site under `astro preview`,
|
||||
│ desktop Chrome + Pixel 7, and the Worker under
|
||||
│ `wrangler dev` — docs/11 §5
|
||||
│ build-as-integration-test: `pnpm build` and its gates —
|
||||
│ validate:data, i18n:check, check:csp, check:assets,
|
||||
│ check:sw, check:feed (docs/12 §2)
|
||||
│ Vitest, four projects: unit · islands · scripts · worker
|
||||
▼
|
||||
```
|
||||
|
||||
No Playwright in v1 (decision: the site has six islands and no forms;
|
||||
build + units + the checklist cover it). Revisit post-v1 if islands grow.
|
||||
**Playwright is in, since v1.1 — this reverses v1's "No Playwright in v1"**
|
||||
(decision log, docs/15 §4). The old reasoning — six islands, no forms,
|
||||
build + units + a checklist cover it — did not survive contact with this
|
||||
stack: the bugs that actually shipped were a script or style the CSP
|
||||
silently refused, a dialog the platform could dismiss, an island that threw
|
||||
on hydration, a page that overflowed a phone — every one with all unit
|
||||
tests green. Only a real browser on the real build sees them.
|
||||
|
||||
**Island tests run in happy-dom** (added in S4). `vitest.config.ts` declares
|
||||
two projects: `unit` (node, `src/lib/**`) and `islands` (happy-dom,
|
||||
`src/components/**`), the latter with `resolve.conditions: ['browser']` or
|
||||
Svelte resolves to its SSR build and `mount()` throws. This is not a
|
||||
substitute for Playwright and does not pretend to be: it asserts island
|
||||
*state machines* — open/close, keyboard interception, lifecycle across
|
||||
simulated `astro:after-swap` — never layout, top-layer stacking, or visual
|
||||
appearance. Those stay on the manual checklist (docs/13 §2).
|
||||
**Vitest projects** (`vitest.config.ts`, all via `getViteConfig` so tests
|
||||
resolve and compile exactly like the build):
|
||||
|
||||
| Project | Environment | Includes | Asserts |
|
||||
|---|---|---|---|
|
||||
| `unit` | node (a file may opt into happy-dom) | `src/{lib,i18n,styles,scripts}/**/*.test.ts`, `src/pages/**/_*.test.ts`, `src/*.test.ts` | pure logic, plus `contrast.test.ts` reading `global.css` (docs/06 §2); the Zod schema (`content.config.test.ts`) and the three data endpoints (`src/pages/_endpoints.test.ts` — the `_` keeps it out of routing) with `astro:content` stubbed; the verbatim head scripts re-imported per test in happy-dom (`src/scripts/head.test.ts`) |
|
||||
| `islands` | happy-dom, `resolve.conditions: ['browser']` (else Svelte resolves to its SSR build and `mount()` throws) | `src/components/**/*.test.ts` | island *state machines* — open/close, keyboard interception, storage, fail-open paths — never layout or the top layer (that is e2e) |
|
||||
| `scripts` | node | `scripts/**/*.test.ts` | the **real** build scripts, run as child processes inside throwaway project trees (`scripts/fixture.ts`), exit code and all |
|
||||
| `worker` | node | `worker/**/*.test.ts` | `/api/verify` against a stubbed Siteverify — Node has every Web API it uses |
|
||||
|
||||
**Coverage** (`pnpm coverage`, V8) measures every analysed source since
|
||||
2026-10-23: `src/lib/**`, `src/i18n/**`, `src/scripts/*.js`, the endpoints
|
||||
in `src/pages/**/*.ts`, `src/content.config.ts`, the island `.svelte` files,
|
||||
`worker/**` **and the build scripts** — they run as child processes, and
|
||||
`coverage.autoAttachSubprocess` (Vitest 5) hands each child
|
||||
`NODE_V8_COVERAGE`, so their real runs count. Never also import a script
|
||||
in-process: Vitest merges the two kinds of coverage for one file wrongly.
|
||||
Thresholds are a **ratchet**: statements 96 · branches 85 · functions 95 ·
|
||||
lines 97, just under the measured 96.7 / 85.6 / 95.5 / 97.6 (2026-10-23;
|
||||
they were 93/78/90/93 over the narrower scope). Raise them when coverage
|
||||
rises; never lower them to land a change. CI runs `pnpm coverage` as *the*
|
||||
unit step, so a drop fails the PR. (Until D38 the `sonar` job also sent
|
||||
`coverage/lcov.info` to SonarQube Cloud; the report is still written, for
|
||||
local reading.)
|
||||
|
||||
## 2. Unit targets (`vitest`)
|
||||
|
||||
| Module | Cases |
|
||||
|---|---|
|
||||
| `normalize.ts` | full vector table docs/05 §A1 incl. NFC vs NFD inputs, `đ/Đ`, whitespace collapse, empty string |
|
||||
| `search.ts` | index round-trip (`toJSON`/`loadJSON`); `trinh duyet` → browsers; prefix (`fire` → Firefox); fuzzy (see note); AND semantics; empty query behavior; `tags` array flattened by `extractField` |
|
||||
| `stores.ts` + filter fn | OR-within/AND-across facets; clear-all; sort orders incl. VN names |
|
||||
| `issueUrl.ts` | budget respected; truncation drops oldest lines first; empty buffer; URL-encoding of `#`/`&`/newlines |
|
||||
| feed builder | deterministic output; top-50 cutoff; stable guid |
|
||||
| `i18n/index.ts` | var substitution; missing-key fallback; parity assertion (en/vi key sets equal — the same check CI runs) |
|
||||
| `legal.ts` | version equality (stale **and** newer both re-open); garbage value; route exemptions incl. near-miss paths (`/legalish`, `/offlinely` must stay gated); hostile localStorage fails open per session |
|
||||
| `validate-data.mjs` | fixture-based: dup slug, dup name (diacritic-insensitive), unknown category, http URL, flagged-in-main-tree each produce the right error row |
|
||||
| `search.ts` / `searchIndex.ts` | index round-trip (`toJSON`/`loadJSON`); `trinh duyet` → browsers; prefix (`fire` → Firefox); fuzzy (see note); AND semantics; empty query behavior; `tags` array flattened by `extractField`; one download per page; a failed load reported and retried |
|
||||
| `stores.ts` + `filter.ts` + `grid.ts` | OR-within/AND-across facets, empty facet = no constraint; sort orders incl. VN names, locale-independent collation, relevance rank; DOM reorder by node moves and never an inline style (checked to fail against the old `style.order` version); cleared query drops cached hits; plural count templates. "Clear all" end to end: e2e |
|
||||
| `urlstate.ts` | parse/serialize round-trip; junk facet values and unknown sorts dropped; stable key order; default view → empty string |
|
||||
| `issueUrl.ts` / `ringbuffer.ts` | budget respected; truncation drops oldest lines first; empty buffer; URL-encoding of `#`/`&`/newlines; reader tolerates a missing buffer |
|
||||
| `feed.ts` | deterministic output; top-50 cutoff; stable guid; export sorted by slug |
|
||||
| `i18n/index.ts` | var substitution; an unreplaced placeholder stays visible; parity assertion (en/vi key sets equal — the same check CI runs), no empty value, VI actually translated; locale routing — `canonicalPath()` strips `.html`, `localePair()` symmetric |
|
||||
| `legal.ts` | version equality (stale **and** newer both re-open); garbage value; hostile localStorage fails open per session; **every accepted document's `LEGAL_UPDATED` ≤ `LEGAL_VERSION`**; every date real and past. (Route exemptions left this module — pages declare `gateExempt`; e2e covers them.) |
|
||||
| `human.ts` / `turnstile.ts` | 48 h / 1 h lifetimes; far-future and garbage values refused; memory fallback; `api.js` injected once; timeouts, 403 → fresh challenge (max 3), every other failure → *unverified*, never a throw |
|
||||
| `theme.ts` / `prefs.ts` / `lang.ts` | defaults on garbage; system/auto stored as "no key"; **`prefs.test.ts` runs the real `src/scripts/theme.js`** so pre-paint and island rules cannot drift |
|
||||
| `licenses.ts` / `logo.ts` / `paths.ts` | generated package table (installed versions, legacy and missing licenses); logo forms incl. monogram, no `style` attribute, escaped initials; category-page order (`byAddedDesc`) |
|
||||
| `contrast.test.ts` | WCAG ratios for every token pair, both themes; no-JS dark block identical to the dark theme (docs/06 §2) |
|
||||
| `scripts/*` (scripts project) | `validate-data` (each rule → its error row), `check-csp`, `check-i18n-parity`, `check-service-worker`, `check-feed`, `quarantine` — real script, temp tree, exit code |
|
||||
| `worker/*` (worker project) | `/api/verify`: method, origin, media type, size (declared and streamed), token shape, rate limit, Siteverify verdicts (host, action, age, test secrets), retry with the same idempotency key, 503 without a secret, security headers on every response. The site-wide limit (`limit.test.ts`, D32): key per IPv4 or /64, the 429 page (status, `Retry-After`, `no-store`, no `ETag`, the asset server's headers kept, `HEAD`), JSON under `/api/` with CORS on the dataset only, plain-text fallback, fail-open (no binding, no address, a throwing limiter), one log line without the address; `wrangler.jsonc` read back to hold `period` = `RETRY_AFTER_S` and the negative patterns |
|
||||
| islands | one test file per island (`Sh*.test.ts`): gate steps and Esc handling, search races and URL writes, filter sheet counts, language switch carrying the query, display menu storage, bug-report URL |
|
||||
|
||||
**Fuzzy vectors — resolved by S2 (2026-07-27), decision D22.** The old
|
||||
`gmip` → GIMP case is a *transposition* (2 edits on 4 characters) and needs
|
||||
@@ -45,8 +77,9 @@ spelled `gimp` from being an exact match (table in docs/05 §A2). It was
|
||||
also pins the *precision* side — `gimp` → only GIMP, `archiver` → only 7-Zip
|
||||
— so a future fuzzy miss cannot be "fixed" by raising the constant.
|
||||
|
||||
Coverage gates: `src/lib/**` ≥ 90 % lines (normalize/issueUrl at 100 %);
|
||||
no gate on `.astro/.svelte` (rendered output is checked by build + manual).
|
||||
Coverage gates: the global ratchet in §1 (statements 96 · branches 85 ·
|
||||
functions 95 · lines 97) over everything listed there. `.astro` files carry no coverage gate — their rendered output is
|
||||
checked by the build gates and the e2e suite.
|
||||
|
||||
## 3. P0 spikes — run before feature work (phase P1)
|
||||
|
||||
@@ -73,7 +106,8 @@ changed the spec:
|
||||
2. Island hydration emits inline scripts ⇒ D18 unachievable, replaced by the
|
||||
split CSP of D20 (docs/09 §4). ClientRouter itself is external, so View
|
||||
Transitions are safe.
|
||||
3. TypeScript 7 breaks `astro check` ⇒ hold at 6.x (D21).
|
||||
3. TypeScript 7 breaks `astro check` ⇒ hold at 6.x (D21; since 2026-10-23
|
||||
TS 6 and TS 7 run side by side — docs/01 §2).
|
||||
4. `ignore-scripts=true` does **not** "break nothing" — it stops the build
|
||||
outright, and pnpm ≥ 10 supersedes it anyway (docs/09 §7).
|
||||
|
||||
@@ -91,6 +125,9 @@ Neither is optional — both change shipped behavior:**
|
||||
*If it fails:* drop `<ClientRouter />` — and with it View Transitions
|
||||
(docs/02 §6, docs/06 §7). Log the branch taken. Do **not** resolve this by
|
||||
adding hashes back without re-reading docs/09 §4.
|
||||
*(Answered by D20 in P1. ClientRouter itself was later dropped anyway —
|
||||
2026-10-21, for native cross-document transitions — because its soft
|
||||
navigation kept the first page's meta CSP; docs/02 §6.)*
|
||||
2. **`trailingSlash: 'never'` × Workers `html_handling`.** (docs/02 §4/§7.)
|
||||
Deploy and `curl -sI` **both** `/apps/7-zip` and `/apps/7-zip/`.
|
||||
*Exit:* exactly one canonical URL returns 200 and the other 301s to it —
|
||||
@@ -105,7 +142,13 @@ Neither is optional — both change shipped behavior:**
|
||||
- **Exit:** all green; `trinh duyet`, `trình duyệt`, `TRINH DUYET`,
|
||||
decomposed `trình duyệt` return identical result sets.
|
||||
|
||||
### S3 — GitHub Issue-Forms prefill limit
|
||||
### S3 — Issue prefill limit (GitHub, then GitLab)
|
||||
|
||||
> **2026-11-24 (D38):** bug reports moved to the GitLab mirror, which takes a
|
||||
> Markdown `issue[description]` instead of form fields. Re-measured on
|
||||
> gitlab.com: 4 000 – 8 000 characters → `302` (signed out: to sign-in),
|
||||
> 12 000 → `400`; `BUDGET = 5000` stands (docs/05 §A6). The GitHub
|
||||
> record below is history.
|
||||
- **Goal:** find the real max URL length github.com accepts with form-field
|
||||
prefill, and confirm params map to field ids.
|
||||
- **Method:** hand-craft URLs against a scratch repo's `bug_report.yml`,
|
||||
@@ -168,6 +211,17 @@ items (docs/13 §2), because the environment has no browser: real top-layer
|
||||
stacking/backdrop, actual focus trapping by the UA, and "no visual flash".
|
||||
The tests assert the *state machine* that drives those, not their rendering.
|
||||
|
||||
**S4 superseded, 2026-10-21.** `<ClientRouter />` is gone (docs/02 §6), so
|
||||
there is no swap to survive: the gate mounts on every non-exempt page, with
|
||||
no `transition:persist` and no `astro:after-swap` re-assert, and it carries
|
||||
only its own page's strings. Both design bugs above are therefore gone by
|
||||
construction. Exemptions moved from a path regex to a page-declared
|
||||
`gateExempt`. The browser-only gaps listed above are now covered by
|
||||
Playwright (`e2e/gate.spec.ts`, §5): real top layer, Esc pressed twice
|
||||
against Chromium's close-watcher, `closedby="none"`, persistence across a
|
||||
reload, exempt pages. Screen-reader and visual checks stay manual (first
|
||||
recorded pass: keyboard + Narrator, owner, 2026-11-09 — docs/13 §2).
|
||||
|
||||
### S5 — PWA offline on the real origin
|
||||
- **Goal:** offline fallback works where users are: `softharbor.net`.
|
||||
- **Method:** deploy the spike build (a versioned preview URL is fine for
|
||||
@@ -208,12 +262,78 @@ rendering both languages, online navigation still serving real pages.
|
||||
fonts, `/offline` cache-servable, online navigation still serving real pages,
|
||||
zero console errors.
|
||||
|
||||
**Re-verified after the move to `@vite-pwa/astro` 2.0.1** (2026-11-09, local
|
||||
`astro preview`, Chromium): SW active **and controlling**, the same 16
|
||||
precache entries as 1.2.0, zero console errors; with the preview server
|
||||
stopped, a navigation to `/apps/7-zip` was answered by the styled `/offline`
|
||||
page (stylesheet and fonts from the precache). The upgrade first produced two
|
||||
more silent failures of the S5 kind — bare ES imports in `sw.js` and in
|
||||
`registerSW.js`, which both run as classic scripts — so `check:sw` now fails on
|
||||
those too (docs/09 §7).
|
||||
|
||||
**Still outstanding:** the actual airplane-mode pass on desktop **and Android
|
||||
Chrome**, which is a device test. The software wiring above is what can be
|
||||
verified without one.
|
||||
|
||||
## 4. Continuous wiring
|
||||
|
||||
CI order (docs/12 §2): install → lint → test → validate:data → build →
|
||||
lychee(dist, internal) — failure anywhere blocks merge. The weekly external
|
||||
link check and CodeQL run on schedule, not per-PR.
|
||||
CI (`ci.yml`, docs/12 §2), every PR and push to `main` — failure anywhere
|
||||
blocks merge:
|
||||
|
||||
- **`build` job:** install (frozen) → `pnpm lint` → `pnpm check` →
|
||||
`pnpm coverage` (the unit run, thresholds enforced) → `pnpm build`
|
||||
(validate:data → i18n:check → astro build → postbuild:html → check:csp →
|
||||
check:assets → check:sw → check:feed; 701 pages) → `wrangler deploy
|
||||
--dry-run` (bundles `worker/`, validates `wrangler.jsonc`) → `pnpm knip` →
|
||||
Playwright e2e on that build (Chromium cached per Playwright version; the
|
||||
HTML report uploaded as an artifact on failure).
|
||||
- **`gates` job:** validate:data, i18n:check, osv-scanner, `pnpm audit
|
||||
--prod`, and on PRs a lychee sweep of the official links the PR changed.
|
||||
|
||||
The ops `security.yml` (gitleaks, Opengrep, osv-scanner) also runs per PR
|
||||
— not required. The weekly full link
|
||||
sweep runs on schedule (docs/12 §5). There is no lychee pass over `dist/`
|
||||
internal links; `check:assets` verifies every same-origin asset a page
|
||||
references, and page-to-page links are covered by the e2e page set.
|
||||
|
||||
## 5. End-to-end (Playwright + axe)
|
||||
|
||||
`playwright.config.ts`, specs in `e2e/`. Runs against the **built** site
|
||||
served by `astro preview` on `127.0.0.1:4321` — the per-page meta CSP is
|
||||
exactly as shipped (`ASTRO_PREVIEW_BACKGROUND=0` keeps the server in the
|
||||
foreground; Astro ≥ 7.2 backgrounds it under CI). Three projects:
|
||||
`desktop` (Desktop Chrome) and `mobile` (Pixel 7 — bottom sheets, the
|
||||
wrapped header, touch targets) against `astro preview`, and `worker`
|
||||
(D32), which alone runs `e2e/worker.spec.ts` against a second server:
|
||||
`wrangler dev` on `127.0.0.1:8799` serving the same `dist/` with the real
|
||||
`wrangler.jsonc`. CI: one retry, traces kept on failure, report artifact.
|
||||
|
||||
**Shared fixture** (`e2e/fixtures.ts`, auto-applied): a test **fails** if
|
||||
its page logged a console error, threw an uncaught exception, or fired a
|
||||
`securitypolicyviolation` (collected by an init script — the meta policy
|
||||
cannot report anywhere else). Messages from inside Cloudflare's Turnstile
|
||||
iframe are ignored (its own CSP probes, docs/09 §4); a test may whitelist an
|
||||
expected line (Chrome's "status of 404" on the 404 test). Helpers:
|
||||
`acceptGate()` pre-seeds `sh:legal` and `sh:human` for tests about
|
||||
something else; `stubTurnstile()` serves a fake `api.js` **from its real
|
||||
URL** (so the page CSP is still exercised) and answers `/api/verify` — which
|
||||
`astro preview` does not run — with 200, 503, or blocks the script;
|
||||
`waitForIsland()` waits for hydration; `settled()` waits for entrance
|
||||
animations before axe measures contrast; `axeViolations()` runs axe with the
|
||||
WCAG 2.0/2.1 A+AA and 2.2 AA tags (optionally on one component) and returns
|
||||
the critical, serious **and moderate** findings — one line per rule (v1.4,
|
||||
D33; it was serious/critical only).
|
||||
|
||||
| Spec | Covers |
|
||||
|---|---|
|
||||
| `smoke.spec.ts` | 18 pages in both locales (home, grid, detail, categories, legal incl. third-party and accessibility, offline, contact): status < 400, an `h1`, a resolved `data-theme`, **no horizontal overflow**; an unknown URL → real 404 without the gate; **axe** (`axeViolations()`) on 13 pages — every page type in both locales, the tables of third-party notices, contact rows, offline — in **light and dark**, plus the 404 page |
|
||||
| `a11y.spec.ts` | ACCESSIBILITY.md's automated half: axe on the **open** legal gate, filter sheet and display menu; the first Tab reaches the skip link, which skips the header; Esc returns focus to the filter and display buttons; the focused display choice has a ring that differs from its fill (2.4.7); the "/" switch turns the shortcut, its hint and the placeholder's "( / )" off and stays off on the next document (2.1.4); **reflow at 320 × 640** on 13 pages (desktop project; 1.4.10); **forced colours** keep the current section underlined and the chosen segment/language filled |
|
||||
| `gate.spec.ts` | blocks a first visit until accepted *and* checked; Esc twice cannot dismiss; **no Cloudflare request before acceptance**; check remembered ~48 h across a reload; blocked script or 503 → visitor let through with the "skipped" note and a 1 h retry; a lapsed check re-runs step 2 only; linked documents and error/offline pages are exempt |
|
||||
| `worker.spec.ts` (project `worker`) | pages pass through the Worker with `_headers`, the 404 page and the trailing-slash redirect intact; a flood gets **exactly** the configured budget of 200s, then 429s — the branded page with `Retry-After` and `no-store`; while refused, `/api/apps.json` and `/api/verify` answer JSON (the dataset CORS-readable) and a page's CSS, the service worker and the favicon still load; the 429 page renders styled in Chrome with no CSP violation and no gate; everyone is back in when the window passes. Serial, and each test first waits for a fresh window (Miniflare counts in fixed windows aligned to the clock, refusals not counted) |
|
||||
| `prefs-search.spec.ts` | display choices apply at once and are restored pre-paint on the next document; `/` from any page lands focused in `/apps#search`; Vietnamese search ignores diacritics, writes `?q=` and switches to "Best match"; a shared URL restores the view and "Clear all" really clears it |
|
||||
|
||||
**Not covered by `astro preview`:** `_headers` and the Worker — which is
|
||||
why the `worker` project exists. What neither server can show — the real
|
||||
edge, the production secret, Cloudflare's distributed counters — is
|
||||
verified in production after each merge, by the CI `deploy` job's own
|
||||
check and docs/13 §3 (preview versions went with Workers Builds, D38).
|
||||
@@ -1,359 +1,442 @@
|
||||
# 12 — CI/CD & Repo Automation
|
||||
|
||||
> **Forge since 2026-11-24 (D38):** the repository lives on the owner's
|
||||
> Gitea, `https://git.poli0981.dev/poli0981/softharbor` (`origin`); CI is
|
||||
> **Gitea Actions** in `.gitea/workflows/`; the public files issues and merge
|
||||
> requests on the push mirror `gitlab.com/poli0981/softharbor`, where no CI
|
||||
> runs. The GitHub account was suspended in November 2026 — the `github`
|
||||
> remote is kept for history and never pushed. The procedure every repository
|
||||
> of the owner followed is the runbook `docs/GITEA-MIGRATION.md` in
|
||||
> `poli0981/.github` (its `docs/migration/softharbor.md` is this
|
||||
> repository's guide); for migration topics it wins over this file.
|
||||
|
||||
## 1. Overview
|
||||
|
||||
```
|
||||
PR ──▶ ci (build + gates, both local) ──▶ review ──▶ squash to main
|
||||
│
|
||||
┌─────────────────────────────────┤
|
||||
▼ ▼
|
||||
Cloudflare Workers Builds quarantine.yml (paths)
|
||||
(git integration — NOT a workflow)
|
||||
cron ─▶ link-check.yml (weekly) · quarantine.yml (nightly) · codeql · renovate
|
||||
PR ──▶ CI (build + gates) + Security + Qodana ──▶ review ──▶ squash to main
|
||||
│
|
||||
┌───────────────────────────────────────────────────────┤
|
||||
▼ ▼
|
||||
CI `deploy` job (push to main only) quarantine.yml (paths)
|
||||
pnpm build ─▶ wrangler deploy ─▶ wait until production serves the build
|
||||
cron (13:00–16:00 UTC only) ─▶ quarantine 13:17 daily · vt-recheck 13:59 daily
|
||||
· link-check Mon 14:43 · Security Tue 15:37 · Renovate (central, 13:31)
|
||||
release published by hand ─▶ notify.yml ─▶ Discord
|
||||
```
|
||||
|
||||
**Deployment is not a GitHub workflow.** The repository is connected to
|
||||
Cloudflare via the Workers dashboard git integration, which builds and deploys
|
||||
on every push to `main` and produces PR previews itself. `deploy.yml` and
|
||||
`preview.yml` were removed on 2026-07-28: they duplicated that pipeline, and
|
||||
they failed anyway — the API token they used carries Workers scopes but not
|
||||
**Zone → Workers Routes → Edit** / **Zone → DNS → Edit**, which
|
||||
`wrangler deploy` needs the moment `wrangler.jsonc` declares a `custom_domain`
|
||||
(`Authentication error [code: 10000]`). The dashboard integration deploys with
|
||||
account-level credentials and has no such gap.
|
||||
**The runner is the maintainer's PC.** One Gitea runner, user-scoped to the
|
||||
`poli0981` repositories; `ubuntu-latest` jobs run in Docker
|
||||
(`docker.gitea.com/runner-images`) **as root**. Consequences:
|
||||
|
||||
Consequences worth knowing:
|
||||
- **Jobs run only while the PC is on.** A scheduled run whose slot passes
|
||||
while it is off waits as "waiting" and starts when the runner comes back;
|
||||
after 24 h unpicked it is cancelled (Gitea's `ABANDONED_JOB_TIMEOUT`).
|
||||
Delays are accepted (runbook §7).
|
||||
- **Every cron sits inside 13:00–16:00 UTC** (20:00–23:00 Vietnam), on a
|
||||
minute no other repository of the owner uses — the slots are registered in
|
||||
`poli0981/.github` `docs/migration/README.md`. Never schedule inside Gitea's
|
||||
nightly backup window (19:30–19:45 UTC). No `TZ=` prefix.
|
||||
- **Background processes die with their step** (a server started with `&` is
|
||||
gone in the next step), and inside the container `localhost` can resolve to
|
||||
`::1` for a server and to `127.0.0.1` for a client — so `playwright.config.ts`
|
||||
binds and calls `127.0.0.1` explicitly, and starts its servers itself.
|
||||
- **Artifact uploads are `continue-on-error`.** They use
|
||||
`christopherhx/gitea-upload-artifact` (upstream v4 refuses non-GitHub
|
||||
servers), and the route from the runner to the artifact store has dropped
|
||||
uploads mid-way (ticktune, 2026-11-23) — a lost report must never make a
|
||||
red run confusing.
|
||||
- **No macOS runner, no OIDC, no code-scanning UI, no Dependabot, no
|
||||
CodeQL** (runbook §1). What replaced each is below.
|
||||
|
||||
- `wrangler.jsonc` is still the source of truth for routes and asset handling —
|
||||
Workers Builds runs `wrangler deploy` against it, so the two custom domains
|
||||
(§16 §3) and `html_handling` still apply.
|
||||
- The **build environment is now Cloudflare's**, not a GitHub runner. It must
|
||||
match `.nvmrc` (Node 24) and use pnpm, or the deployed output can differ from
|
||||
what CI validated. Verify after any toolchain bump (docs/13 §2).
|
||||
- `CLOUDFLARE_API_TOKEN` / `CLOUDFLARE_ACCOUNT_ID` repo secrets (action item
|
||||
H3) are **no longer used by any workflow**. They can be deleted, and should
|
||||
be if nothing else claims them — an unused deploy credential is pure risk.
|
||||
- A local `wrangler deploy` still works for the maintainer and is the fastest
|
||||
way to ship a hotfix, but it bypasses `ci`. Prefer pushing.
|
||||
**Permissions.** Every workflow declares `permissions: {}` at the top and
|
||||
grants per job; checkouts use `persist-credentials: false`. The job token is
|
||||
`${{ github.token }}` (Gitea also calls it `GITEA_TOKEN`); its API is
|
||||
`${{ github.api_url }}` (`https://git.poli0981.dev/api/v1`). Gitea knows
|
||||
`contents`, `issues`, `pull-requests`, `actions` and `packages`; GitHub-only
|
||||
scopes (`id-token`, `checks`, `security-events`, `statuses`, …) are gone from
|
||||
every workflow.
|
||||
|
||||
Everything else uses the default `GITHUB_TOKEN` with **explicit least
|
||||
`permissions:` blocks in every caller** — the Phase-5 lesson: a caller stub
|
||||
without its own `permissions:` block silently defaults to `none` and the
|
||||
reusable workflow fails.
|
||||
**Two Gitea facts shape the bots** (runbook §6):
|
||||
|
||||
**The rule is stricter than "not none": a caller's permissions must be a
|
||||
SUPERSET of every job in the workflow it calls — including jobs that will be
|
||||
skipped.** GitHub validates this before running anything, so the failure mode
|
||||
is `startup_failure` in ~1 second with no logs and no annotation pointing at
|
||||
the cause. Both callers hit this on 2026-07-28: `codeql` was missing
|
||||
`packages: read`, and `ci` could not satisfy `reusable-web-react.yml`'s
|
||||
Pages-deploy job (`pages: write`, `id-token: write`) even with
|
||||
`deploy-pages: false`. When a caller dies at startup, read the *reusable*
|
||||
workflow's job-level `permissions:` blocks first.
|
||||
1. **An event caused by the job token starts no workflow** — as on GitHub.
|
||||
A branch the bot pushes, or a PR it opens, runs no `pull_request` checks,
|
||||
so the bot **dispatches** `ci.yml` and `security.yml` on its branch.
|
||||
2. **A dispatched run writes no commit status** (measured on Gitea 28.4 by
|
||||
poli0981-dev, 2026-11-24): its checks never meet branch protection.
|
||||
`ci.yml`'s `record` job therefore writes build's and gates' results as
|
||||
statuses itself, named `CI / build (workflow_dispatch)` and
|
||||
`CI / gates (workflow_dispatch)` — names the protection patterns match.
|
||||
|
||||
**`CLOUDFLARE_API_TOKEN` needs zone scopes, not just Workers.** The "Edit
|
||||
Cloudflare Workers" template alone fails with `Authentication error
|
||||
[code: 10000]` on `/zones/…/workers/routes` as soon as `wrangler.jsonc`
|
||||
declares a `custom_domain`. Add **Zone → Workers Routes → Edit** and
|
||||
**Zone → DNS → Edit**. A local `wrangler deploy` will not reveal this: local
|
||||
wrangler uses OAuth with full rights, so CI is the only place the gap shows.
|
||||
`scripts/gitea.mjs` is the bots' side of the forge — PRs, dispatches,
|
||||
issues, statuses — over the REST API with the job token (no `gh`: it only
|
||||
talks to github.com). Its tests run it against an in-process stand-in for
|
||||
the API (`scripts/gitea.test.ts`).
|
||||
|
||||
All third-party actions **in this repository's own workflows** are pinned to
|
||||
commit SHAs (`@<sha> # vX.Y.Z` comment); Renovate maintains the pins. The rule
|
||||
is scoped deliberately: the `poli0981/.github` reusable workflows pin their
|
||||
internal actions by **major tag** (`actions/checkout@v7`, `setup-node@v6`), and
|
||||
that is the ops repo's call, not ours — do not file it as a defect here.
|
||||
**Pinning.** Every third-party `uses:` is pinned to a full commit SHA with
|
||||
the release in a comment (`@<sha> # vX.Y.Z`); Renovate bumps both. A bare
|
||||
`owner/action@ref` resolves to github.com; a Gitea-hosted action needs its
|
||||
full URL. The ops repository's workflows are pinned to the commit of an ops
|
||||
tag — `8e6582af… # ops v2026.11.2` — **by hand**: Renovate reads no version
|
||||
in `# ops …` and skips them. Tools downloaded by checksum (osv-scanner in
|
||||
`gates`) are bumped by hand too, version and SHA-256 together.
|
||||
|
||||
**Action major versions** below reflect the ops repo's verified-2026-07-06
|
||||
baseline: `checkout@v7`, `setup-node@v6`, `pnpm/action-setup@v6`. Confirm the
|
||||
current majors when the pins are first resolved to SHAs.
|
||||
Pinned as of 2026-11-24: `actions/checkout` v7.0.1 · `pnpm/action-setup`
|
||||
v6.1.1 (no `version:` — it reads `packageManager`) · `actions/setup-node`
|
||||
v7.1.0 (`node-version-file: .nvmrc`) · `actions/cache` v6.1.0 ·
|
||||
`christopherhx/gitea-upload-artifact` v4 · `lycheeverse/lychee-action`
|
||||
v2.9.0 · osv-scanner v2.7.1 (binary) · ops v2026.11.2 (`security.yml`,
|
||||
`reusable-qodana.yml`, `announce-release.yml`).
|
||||
|
||||
## 2. Callers to `poli0981/.github` reusable workflows
|
||||
## 2. The workflows
|
||||
|
||||
> **Inventory verified 2026-07-27** via
|
||||
> `gh api repos/poli0981/.github/contents/.github/workflows`. The ops repo
|
||||
> publishes `reusable-web-react.yml`, `reusable-codeql.yml` and
|
||||
> `announce-release.yml`. There is **no `reusable-node-ci.yml`** and **no
|
||||
> `reusable-notify.yml`** — earlier drafts of this doc called both, which
|
||||
> would have failed on the first CI run. Re-check the listing before adding
|
||||
> any new caller.
|
||||
`.gitea/workflows/ci.yml` (**CI**) — self-contained, deliberately. It once
|
||||
called `poli0981/.github` → `reusable-web-react.yml`, which ran lint /
|
||||
typecheck / test only *if a matching package script existed*: rename a
|
||||
script and CI silently stops checking while still going green. This
|
||||
project's gates *are* the product, and it has shipped silent no-ops before (a
|
||||
dead `set:html` lint rule, workbox globs matching nothing, an unregistered
|
||||
service worker, CSP-dropped inline styles). The duplicated "logic" is a
|
||||
handful of `pnpm` invocations. Triggers: `pull_request`, `push` to `main`,
|
||||
`workflow_dispatch` (the bots, §4). Concurrency cancels superseded runs
|
||||
except on `main`. Jobs:
|
||||
|
||||
`.github/workflows/ci.yml` — **self-contained, two jobs (`build`, `gates`).**
|
||||
- **`build`** (30 min cap) — install (frozen lockfile) → `pnpm lint`
|
||||
(ESLint + Prettier) → `pnpm check` (types) → **`pnpm coverage`** (the unit
|
||||
run itself, failing below the thresholds in `vitest.config.ts`) →
|
||||
**`pnpm build`** — the *same* command the `deploy` job runs, carrying its
|
||||
own gates: `validate:data → i18n:check → astro build → postbuild:html →
|
||||
check:csp → check:assets → check:sw → check:feed` → **`wrangler deploy
|
||||
--dry-run`** (bundles `worker/` and validates `wrangler.jsonc` — bindings,
|
||||
assets, `run_worker_first` — without credentials) → `pnpm knip` →
|
||||
**Playwright e2e** on that build (docs/11 §5) — `astro preview` for the
|
||||
pages, `wrangler dev` for the Worker and its rate limits; the Chromium
|
||||
download is cached per Playwright version (on a hit only the OS libraries
|
||||
are installed), and the HTML report is kept as an artifact when the job
|
||||
fails.
|
||||
- **`gates`** (15 min cap) — `validate:data`, `i18n:check`, **osv-scanner**
|
||||
over `pnpm-lock.yaml` (the pinned, checksum-verified binary the ops
|
||||
`security.yml` uses; `osv-scanner.toml` next to the lockfile holds the
|
||||
time-boxed exceptions, docs/09 §7), `pnpm audit --prod`, and on PRs the
|
||||
changed-links lychee sweep (§5).
|
||||
- **`record`** — only on `workflow_dispatch`: records `build` and `gates` as
|
||||
commit statuses (§1, fact 2). Cancelled or skipped jobs record nothing.
|
||||
- **`deploy`** — only on a push to `main`, after `build` and `gates` pass (§3).
|
||||
|
||||
It is deliberately NOT a caller. An earlier version delegated to
|
||||
`reusable-web-react.yml` and every run ended in `startup_failure`, for two
|
||||
independent reasons:
|
||||
`.gitea/workflows/security.yml` (**Security**) — a caller of the ops
|
||||
repository's `security.yml` with `node: true`, on pushes to `main`, PRs, a
|
||||
weekly slot (`37 15 * * 2`) and dispatch. It replaced CodeQL, which Gitea
|
||||
does not have:
|
||||
|
||||
1. That workflow's Pages-deploy job declares `pages: write` and
|
||||
`id-token: write`. A caller cannot request less than a called workflow
|
||||
needs, so GitHub rejected the run before any step — even though the job is
|
||||
skipped by `deploy-pages: false`. Granting them would hand a
|
||||
Workers-deployed site the ability to mint OIDC tokens it never uses.
|
||||
2. It runs lint / typecheck / test **only if a matching package script
|
||||
exists**. Rename a script and CI silently stops checking while still going
|
||||
green. This project's gates *are* the product, and it has already shipped
|
||||
four separate silent no-ops (a dead `set:html` lint rule, workbox globs
|
||||
matching nothing, an unregistered service worker, CSP-dropped inline
|
||||
styles). A quietly-skipping CI is the wrong tool here.
|
||||
- **secrets** — gitleaks over the whole history. Public identifiers it
|
||||
would flag (the Turnstile site key, the Web Analytics token, test
|
||||
fixtures) are listed in `.gitleaksignore` as `commit:file:rule:line`, each
|
||||
with its reason. A real secret never goes there: it is rotated.
|
||||
- **sast** — Opengrep with pinned community rules for JavaScript/TypeScript,
|
||||
`--taint-intrafile`; report-only, the SARIF kept as an artifact.
|
||||
- **deps** — osv-scanner over every lockfile it finds; fails on a known
|
||||
vulnerability.
|
||||
|
||||
The duplicated "logic" is six `pnpm` invocations — a fair price for a gate that
|
||||
fails loudly. Jobs:
|
||||
Not a required check: `gates` is the one that blocks a merge on an advisory.
|
||||
|
||||
- **`build`** — `pnpm lint`, `check`, `test`, `build`, then **`check:styles`**
|
||||
(must run after `build`; it inspects `dist/`) and `knip`.
|
||||
- **`gates`** — `validate:data`, `i18n:check`, `osv-scanner`, `pnpm audit
|
||||
--prod`, and on PRs the changed-files lychee sweep.
|
||||
`.gitea/workflows/qodana.yml` (**Qodana**, D35) — a caller of the ops
|
||||
`reusable-qodana.yml` (the Qodana CLI 2026.3.1, pinned and checksum-
|
||||
verified) with `package-manager: pnpm`, `node-version-file: .nvmrc` and
|
||||
`prepare-command: pnpm exec astro sync`; secret `QODANA_TOKEN` (the Qodana
|
||||
Cloud project token that carries the **Ultimate** licence `qodana-js`
|
||||
needs). On PRs, pushes to `main` and dispatch; no schedule. Scope and gate
|
||||
live in `qodana.yaml`:
|
||||
|
||||
Two action references that do not work the obvious way: the OSV scanner lives
|
||||
in a **subdirectory** of its repo and publishes **no rolling major tag**, so it
|
||||
is `google/osv-scanner-action/osv-scanner-action@v2.3.8` — `@v2` does not
|
||||
resolve at all.
|
||||
- **Native mode** (`withinDocker: 'false'`): the linter runs in the job's
|
||||
own container after the install, so it resolves imports against the real
|
||||
install on Node 26.
|
||||
- Profile **`qodana.recommended`**; the dataset, build/test output and local
|
||||
tool state excluded. `qodana-js` reads `.ts`/`.js`/`.mjs`, JSON, YAML,
|
||||
Markdown and CSS; `.astro` and `.svelte` are outside its language list.
|
||||
**JetBrains' Astro and Svelte plugins were tried and dropped**
|
||||
(2026-11-15): under Qodana their type checks were not deterministic (one
|
||||
commit flipped between 0 and 15 errors). `astro check`, ESLint, the Vitest
|
||||
island suites and e2e cover those files.
|
||||
- **Gate:** `failureConditions.severityThresholds.any: 0` — any finding turns
|
||||
the job red. A false positive with a known cause is switched off **in
|
||||
`qodana.yaml`, with its reason** — never with `noinspection` comments.
|
||||
- Findings live in **Qodana Cloud** (project `softharbor`) and the run's
|
||||
`qodana-report` artifact; Gitea has no code-scanning UI, so the SARIF
|
||||
upload to GitHub code scanning went (D38). Runs started by `renovate-bot`
|
||||
skip the scan: Gitea gives same-repo PRs the secrets, and such a run
|
||||
installs the very update under review.
|
||||
- **Not required:** a Qodana Cloud outage or a lapsed licence must never
|
||||
block a merge. **The licence runs until 2026-12-31** — renew it, or every
|
||||
run turns red from 2027-01-01. The Qodana Cloud project's VCS URL must
|
||||
name the Gitea repository (maintainer).
|
||||
|
||||
`.github/workflows/codeql.yml` — `reusable-codeql.yml` **does** exist (verified
|
||||
2026-07-27). Two things it is easy to get wrong, both fatal at startup:
|
||||
`.gitea/workflows/notify.yml` (published release → Discord) — a caller of the
|
||||
ops `announce-release.yml`, pinned to the ops tag's commit, with `ops_ref`
|
||||
set to the same SHA (the notifier script is loaded from that commit) and
|
||||
only `DISCORD_RELEASES_WEBHOOK` passed — never `secrets: inherit`. It reads
|
||||
the release from Gitea's API. **Publish the release by hand** in Gitea
|
||||
(docs/13 §3): a release a workflow created with the job token would fire no
|
||||
`release: published` event. Re-announce with Actions → notify → Run workflow
|
||||
and the tag. Release notes go straight to Discord, so they must be final
|
||||
before publishing.
|
||||
|
||||
- `languages` is a **JSON array string** — it is fed to `fromJSON()` for a
|
||||
matrix. `'["javascript-typescript"]'`, not `javascript-typescript`.
|
||||
- the caller must grant **`packages: read`** (CodeQL fetches query packs) on
|
||||
top of the obvious three.
|
||||
**Scope note.** `notify.yml` fires once per *tagged release* and reaches
|
||||
**Discord only**. The multi-platform `notify.py` cross-poster consumes
|
||||
`/rss.xml` on its own schedule (docs/03 §7, docs/13 §5): per-app
|
||||
announcements need no workflow here — only a valid, deterministic feed.
|
||||
|
||||
```yaml
|
||||
name: codeql
|
||||
on:
|
||||
push: { branches: [main] }
|
||||
schedule: [{ cron: '31 3 * * 1' }]
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
packages: read # easy to miss — reusable workflow declares it
|
||||
security-events: write
|
||||
jobs:
|
||||
codeql:
|
||||
uses: poli0981/.github/.github/workflows/reusable-codeql.yml@main
|
||||
with: { languages: '["javascript-typescript"]' }
|
||||
```
|
||||
**Removed with GitHub (D38):** `codeql.yml` (→ `security.yml`), the `sonar`
|
||||
job and `sonar-project.properties` (SonarQube Cloud dropped in every
|
||||
repository of the owner, runbook D1 — Qodana and Opengrep cover the
|
||||
analysis), the SARIF upload, `.github/dependabot.yml` (→ Renovate, §6), and
|
||||
the "Allow GitHub Actions to create pull requests" setting the bots needed.
|
||||
|
||||
`.github/workflows/notify.yml` (tagged release → Discord announcement):
|
||||
## 3. Deploy
|
||||
|
||||
```yaml
|
||||
name: notify
|
||||
on:
|
||||
release: { types: [published] }
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag: { required: true, type: string }
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
announce:
|
||||
uses: poli0981/.github/.github/workflows/announce-release.yml@main
|
||||
secrets: inherit # DISCORD_RELEASES_WEBHOOK / _REPO_WEBHOOK / _PING_ROLE_ID
|
||||
```
|
||||
|
||||
**Scope note.** This fires once per *tagged release* and reaches **Discord
|
||||
only** — that is all `announce-release.yml` does. The multi-platform
|
||||
`notify.py` cross-poster (Telegram / Bluesky / Mastodon / X / Facebook) is
|
||||
deliberately **not wired here**: it consumes `/rss.xml` on its own cron in its
|
||||
own repo (docs/03 §7, docs/13 §5). Per-app announcements therefore need no
|
||||
workflow in this repository — only a valid, deterministic feed.
|
||||
|
||||
## 3. Deploy & previews (Cloudflare git integration)
|
||||
|
||||
There are **no deploy or preview workflows in this repo**. Cloudflare Workers
|
||||
Builds is connected to the GitHub repository and owns both:
|
||||
`ci.yml`'s **`deploy`** job is the only thing that deploys (D38). Cloudflare
|
||||
Workers Builds pulled from the GitHub repository and stopped with it; it is
|
||||
**not** reconnected to the GitLab mirror, which would deploy a second time on
|
||||
every mirror push (runbook D3).
|
||||
|
||||
| Trigger | What happens |
|
||||
|---|---|
|
||||
| push to `main` | Cloudflare builds and deploys to `softharbor.net` |
|
||||
| pull request | Cloudflare builds a preview and reports it on the PR |
|
||||
| push to `main` | after `build` + `gates` pass: install → `pnpm build` → `pnpm exec wrangler deploy --message "main <sha7>"` — assets **and** the Worker — then poll `https://softharbor.net/api/apps.json?deploy=<sha>` until its `generatedAt` equals `dist/api/apps.json`'s (30 × 5 s) |
|
||||
| pull request | nothing — **no preview versions** |
|
||||
|
||||
Rollback stays where it was: dashboard → the Worker → **Deployments** → promote
|
||||
a previous version, or `wrangler rollback` locally.
|
||||
|
||||
Preview URLs remain unlisted, short-lived and carry no sitemap; the indexing
|
||||
risk is accepted, and a static `_headers` file cannot vary `X-Robots-Tag` by
|
||||
host (docs/16 §3). Never link one publicly.
|
||||
|
||||
**Do not re-add a `deploy.yml`.** Two pipelines racing on the same Worker is
|
||||
worse than either alone, and the token a workflow would need carries zone-level
|
||||
write scopes that nothing else in this repo requires (§1).
|
||||
- `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` are **user-level** Gitea
|
||||
Actions secrets (shared by the owner's Workers projects) and appear in the
|
||||
`deploy` job only, which runs only for pushes to `main`. Gitea gives
|
||||
same-repository PRs the secrets — Renovate's included — so no job a branch
|
||||
can run ever sees the token; that is also why PR previews went.
|
||||
- The token needs **Workers Scripts → Edit** on the account. `wrangler.jsonc`
|
||||
declares **no routes** (docs/16 §3): the two custom domains are attached in
|
||||
the dashboard, and a deploy leaves them alone — so no zone scopes are
|
||||
needed. If a route or `custom_domain` is ever declared, the token needs
|
||||
**Zone → Workers Routes → Edit** and **Zone → DNS → Edit** too (a local
|
||||
`wrangler deploy` uses OAuth with full rights and will not reveal the gap).
|
||||
- The Worker's runtime secret `TURNSTILE_SECRET` lives on the Worker and
|
||||
survives every deploy. Build-time variables do not exist: the build reads
|
||||
no environment.
|
||||
- **Verify** after the job (docs/13 §3): the job already waits for the new
|
||||
build; spot-check the response headers, `/api/verify` answering JSON,
|
||||
`/rss.xml`, and the hashed `/_astro/` names (builds are not byte-identical:
|
||||
each `astro-island` carries a random `uid`).
|
||||
- **Rollback:** dashboard → the Worker → **Deployments** → promote a previous
|
||||
version, or `wrangler rollback` locally. A local `pnpm deploy` still works
|
||||
for the maintainer but bypasses CI; prefer reverting on `main`.
|
||||
- `preview_urls` stays `true` in `wrangler.jsonc`, and `_headers` still marks
|
||||
`*.workers.dev` hosts `noindex`: a hand-made `wrangler versions upload`
|
||||
remains possible, but nothing makes one.
|
||||
|
||||
## 4. Quarantine workflow (repo-local)
|
||||
|
||||
`.github/workflows/quarantine.yml` — enforces hard rule 5 mechanically:
|
||||
`.gitea/workflows/quarantine.yml` — enforces hard rule 5 mechanically. On
|
||||
data pushes to `main`, daily at **13:17 UTC** (was 02:17 on GitHub) and on
|
||||
dispatch; `concurrency: quarantine`. The job (`contents`, `pull-requests`,
|
||||
`issues`, `actions: write`):
|
||||
|
||||
```yaml
|
||||
name: quarantine
|
||||
on:
|
||||
push: { branches: [main], paths: ['src/data/apps/**'] }
|
||||
schedule: [{ cron: '17 2 * * *' }]
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
jobs:
|
||||
sweep:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@<pinned-sha> # v4
|
||||
- uses: actions/setup-node@<pinned-sha> # v4
|
||||
with: { node-version: 24 }
|
||||
- id: sweep
|
||||
run: node scripts/quarantine.mjs # moves flagged files, writes summary
|
||||
- if: steps.sweep.outputs.moved != ''
|
||||
uses: peter-evans/create-pull-request@<pinned-sha> # v7
|
||||
with:
|
||||
branch: quarantine/auto
|
||||
title: 'data: quarantine flagged entries'
|
||||
commit-message: 'data: quarantine ${{ steps.sweep.outputs.moved }}'
|
||||
labels: security, quarantine
|
||||
body: |
|
||||
Automated sweep: entries with `security.status: "flagged"` moved
|
||||
to `data/quarantine/`. Evidence & discussion in the linked issue.
|
||||
- if: steps.sweep.outputs.moved != ''
|
||||
uses: actions/github-script@<pinned-sha> # v7
|
||||
with:
|
||||
script: | # open one tracking issue per moved slug (title: [quarantine] <slug>)
|
||||
…
|
||||
```
|
||||
1. `node scripts/quarantine.mjs` (also `pnpm quarantine`, for the
|
||||
maintainer): scans `src/data/apps/*.json` and **moves** each
|
||||
`status === 'flagged'` file to `data/quarantine/` (a rename; the
|
||||
directory is created on first use). It skips unparseable files (L1/L2's
|
||||
job), refuses a non-slug filename, never overwrites a quarantined copy and
|
||||
emits the `moved` output (space-separated slugs). Idempotent.
|
||||
2. If anything moved: commit to `quarantine/auto` as *SoftHarbor bot*
|
||||
(`actions@noreply.git.poli0981.dev`) and **force-push** it with the job
|
||||
token (an `AUTHORIZATION: basic` extra header, the way `actions/checkout`
|
||||
persists credentials — but only for this push, never while repository
|
||||
code runs).
|
||||
3. `gitea.mjs pr` opens — or updates — the PR `quarantine/auto` → `main`
|
||||
(labels `security`, `quarantine`), `gitea.mjs dispatch` runs `ci.yml` and
|
||||
`security.yml` on the branch, and `gitea.mjs quarantine-issues` opens
|
||||
`[quarantine] <slug>` for each slug that has no open issue yet.
|
||||
|
||||
`scripts/quarantine.mjs`: scans `src/data/apps/*.json`, for each
|
||||
`status === 'flagged'` performs `git mv` to `data/quarantine/`, emits
|
||||
`moved` output (space-separated slugs). Idempotent; exits 0 when nothing to
|
||||
do. The PR (not direct push) keeps a human in the loop on `main` while the
|
||||
nightly cron guarantees a flagged entry never survives more than 24 h even
|
||||
if a PR reviewer missed it.
|
||||
The PR (not a direct push) keeps a human in the loop on `main`, while the
|
||||
daily run guarantees a flagged entry does not outlive the next evening even
|
||||
if a reviewer missed it. Normally it never fires: `validate:data` fails a PR
|
||||
that flags an entry without moving it. Step outputs reach shell bodies only
|
||||
through `env:`, never `${{ }}` inside `run:`; `gitea.mjs` validates slugs
|
||||
before they reach an issue title.
|
||||
|
||||
**Repo setting required (action item H10).** `peter-evans/create-pull-request`
|
||||
fails — even with the correct `permissions:` block — unless *Settings → Actions
|
||||
→ General → **Allow GitHub Actions to create and approve pull requests*** is
|
||||
enabled. Without it the nightly sweep silently cannot open its PR, which
|
||||
defeats hard rule 5.
|
||||
**The bot's commits are unsigned** — Gitea has no API that signs a commit
|
||||
for the job token — which is why branch protection does not require signed
|
||||
commits (§8). A label that does not exist on the repository is left off with
|
||||
a notice (Gitea's API attaches labels by id and creates none).
|
||||
|
||||
## 4b. VirusTotal re-check (repo-local)
|
||||
|
||||
`.gitea/workflows/vt-recheck.yml` + `scripts/vt-recheck.mjs` (added
|
||||
2026-10-23, D30) — docs/09 §6 step 5 made assisted, so no dated security
|
||||
claim can go stale unnoticed.
|
||||
|
||||
- **What it scans:** each entry's `links.download` page. `POST /urls`
|
||||
submits it, a second pass reads `GET /analyses/{id}`, and the permalink is
|
||||
`https://www.virustotal.com/gui/url/<sha256>`. The canonical form keeps a
|
||||
`#fragment`: the API puts it in the id (measured 2026-10-23), while a scan
|
||||
submitted from a browser never sends one.
|
||||
- **What it writes:** only the three `security` lines, patched in place so
|
||||
Prettier's layout survives; never `addedAt`/`updatedAt` — the feed orders
|
||||
by `addedAt`, and notify.py announces anything it has not seen.
|
||||
- **The rules:** zero malicious/suspicious ⇒ fresh `evidence` + `checkedAt`,
|
||||
status unchanged; any detection ⇒ `clean` becomes `unverified` and a
|
||||
`[vt] <slug>` issue (label `security`) asks the maintainer to decide;
|
||||
`promote` slugs go `unverified` → `clean` only on a clean scan. It never
|
||||
sets `flagged` — quarantine stays a human `pnpm quarantine` (§4). An
|
||||
analysis in which no engine answered is "not checked", not clean.
|
||||
- **Who is due:** the `slugs` input first, then never-scanned entries, then
|
||||
drifted evidence (at most weekly), then checks older than `max_age`
|
||||
(default 90 days), oldest first.
|
||||
- **Limits:** the Public API allows 4 requests a minute and 500 a day
|
||||
(reset at 00:00 UTC), and counts every call. The script paces at 15.5 s,
|
||||
spends at most `budget` (default 440, capped at 500) with no more than
|
||||
half of it on submissions, backs off 60 s once on a 429 and treats a
|
||||
second as the day's quota — keeping what it finished. A refused key fails
|
||||
the step; a missing key is a no-op that says so. `concurrency: vt-recheck`
|
||||
keeps two runs off one key. Daily at **13:59 UTC** (was 00:41 on GitHub,
|
||||
right after the reset; any hour fits one run's 440 requests).
|
||||
- **On `main` (daily cron, or dispatch):** one PR, `vt/recheck`. While it is
|
||||
open (`gitea.mjs pr-open`), each run first **carries** its results
|
||||
(`git archive` of the branch into `$RUNNER_TEMP`; a block is adopted only
|
||||
if its download link is unchanged and its check is newer), so the PR
|
||||
accumulates day by day. Then it commits `src/data/apps` to `vt/recheck`
|
||||
and force-pushes — **only if the tree differs** from the branch's, since
|
||||
the carried results alone make `changed` non-zero every day — opens or
|
||||
updates the PR, dispatches `ci.yml` and `security.yml` on it, and opens
|
||||
`[vt] <slug>` issues (`gitea.mjs vt-issues`). Merged branches are deleted,
|
||||
and a PR closed unmerged is never carried.
|
||||
- **On any other branch (preview):** dispatch it on the data branch (Actions
|
||||
→ vt-recheck → Run workflow → the branch) and it scans only the `slugs`
|
||||
given — or, with none, the entries without a scan, i.e. a data PR's new
|
||||
apps. It **prints the diff of the patched `security` blocks in the log**
|
||||
(readable without signing in to download anything) and keeps the files
|
||||
and the report as the `vt-preview` artifact (7 days). No PR, no issues: the
|
||||
maintainer copies **only the `security` blocks** into the data PR — a whole
|
||||
file from the dispatch commit would revert later edits.
|
||||
- **Terms:** VirusTotal offers the Public API to sites "free to consumers";
|
||||
it "must not be used in business workflows that do not contribute new
|
||||
files" and "can not be used as a substitute for antivirus products".
|
||||
SoftHarbor is free, carries no ads and only submits public download URLs;
|
||||
the site copy keeps making no safety claim (hard rule 4).
|
||||
|
||||
## 5. Link check (repo-local)
|
||||
|
||||
`.github/workflows/link-check.yml`:
|
||||
`.gitea/workflows/link-check.yml` — the weekly full sweep, **Monday 14:43
|
||||
UTC** (was 04:43): `scripts/extract-urls.mjs` lists every `links.*` and
|
||||
evidence URL, lychee checks them (`--max-concurrency 4 --retry-wait-time 10
|
||||
--max-retries 5 --timeout 45 --accept '200..=299,403,429'`, `fail: false`),
|
||||
and `gitea.mjs link-rot` keeps **one** tracking issue, `link-check: broken
|
||||
official links` (label `link-rot`): replaced with the new report and a
|
||||
comment linking the run while the sweep fails, opened on the first failure,
|
||||
closed the first week it comes back clean. On GitHub an earlier version
|
||||
opened a fresh issue on every red run and left 12 duplicates open.
|
||||
|
||||
```yaml
|
||||
name: link-check
|
||||
on:
|
||||
schedule: [{ cron: '43 4 * * 1' }]
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
jobs:
|
||||
lychee:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@<pinned-sha> # v7
|
||||
- run: node scripts/extract-urls.mjs > /tmp/urls.txt # all links.* from data
|
||||
- uses: lycheeverse/lychee-action@<pinned-sha> # v2
|
||||
with:
|
||||
args: --max-concurrency 4 --retry-wait-time 2 /tmp/urls.txt
|
||||
fail: false
|
||||
- uses: peter-evans/create-issue-from-file@<pinned-sha> # v5
|
||||
if: env.lychee_exit_code != 0
|
||||
with: { title: 'link-check: broken official links', path: ./lychee/out.md, labels: 'link-rot' }
|
||||
```
|
||||
**403 and 429 count as reachable** in both sweeps (decision of 2026-07-30,
|
||||
docs/15 §4): 14 of the first 26 failures were bot mitigation on plainly
|
||||
live vendor sites. 404/5xx/connection failures still fail. Do **not** add
|
||||
`--user-agent`: spoofing a browser cleared the 403s but made other vendors
|
||||
answer 406/400.
|
||||
|
||||
PR-time link checking covers only files changed in the PR. It runs as the last
|
||||
two steps of `ci.yml`'s **`gates` job** (§2) — *not* inside the reusable-workflow
|
||||
call, which cannot accept extra steps. The weekly job above owns the full sweep.
|
||||
PR-time link checking covers only the links the PR adds or edits — the URLs
|
||||
on the added lines of its diff. It runs as the last two steps of `ci.yml`'s
|
||||
**`gates` job** (§2): `git diff -U0` runs under `set -euo pipefail` and pipes
|
||||
into `extract-urls.mjs --added` (a failed diff stops the job rather than
|
||||
silently narrowing the check), and lychee is **skipped** when there is
|
||||
nothing to check — an empty input is a configuration error to lychee, and a
|
||||
skipped step stays visible where a green "0 links" would not. *Changed
|
||||
2026-10-23:* it used to check every link of every touched file, and the
|
||||
first `vt/recheck` PR — 198 rewritten security blocks — failed three times
|
||||
on ~700 unrelated vendor links.
|
||||
|
||||
## 6. Dependency & scanning automation
|
||||
|
||||
`renovate.json`:
|
||||
**Renovate** (D38) replaces Dependabot: the owner's self-hosted Renovate runs
|
||||
from `poli0981/renovate-config` daily at 13:31 UTC over every repository the
|
||||
`renovate-bot` user can write to. `renovate.json` extends the shared preset
|
||||
(`local>poli0981/renovate-config`):
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["config:best-practices", ":pinAllExceptPeerDependencies",
|
||||
"helpers:pinGitHubActionDigests"],
|
||||
"schedule": ["before 6am on monday"],
|
||||
"packageRules": [
|
||||
{ "groupName": "minor+patch", "matchUpdateTypes": ["minor", "patch"] },
|
||||
{ "matchUpdateTypes": ["major"], "dependencyDashboardApproval": true }
|
||||
]
|
||||
}
|
||||
```
|
||||
| What the preset does | |
|
||||
|---|---|
|
||||
| base | `config:recommended`, the Dependency Dashboard issue |
|
||||
| actions | every `uses:` pinned to a SHA with its version comment, looked up over git (`git ls-remote`) — there is no github.com token |
|
||||
| grouping | all minor + patch updates in one PR; majors separate |
|
||||
| age | a new npm release is proposed only once it is **3 days** old — which also keeps pnpm 11's own 24 h `minimumReleaseAge` from failing a release-day update at `pnpm install --frozen-lockfile` |
|
||||
| security | OSV advisories open their own PRs (labels `dependencies` + `security`) without the age wait; the dashboard lists the open ones |
|
||||
|
||||
Plus `osv-scanner` (`google/osv-scanner-action`, lockfile mode) and
|
||||
`pnpm audit --prod`, both as steps of `ci.yml`'s **`gates` job** (§2) — again,
|
||||
not inside the reusable-workflow call. Critical findings fail the PR
|
||||
(policy docs/01 §5).
|
||||
This repository adds three rules: **no majors** for `typescript` /
|
||||
`@typescript/native` (D21 as amended — the TS 6 API wrapper and TS 7 run side
|
||||
by side), for `node` / `@types/node` (the typings track the Node major in
|
||||
`.nvmrc`, docs/01 §5 rule 4) and for `pnpm` (11.x by decision). Those are
|
||||
platform moves, made deliberately. No `schedule` here: the runner's cron is
|
||||
the schedule. The ops pins (`# ops v…`) and the osv-scanner binary are bumped
|
||||
by hand. Maintainer setup (once): `renovate-bot` as a Write collaborator and
|
||||
the labels `dependencies` + `security` (`maintainer/gitea-repo-setup.ps1` in
|
||||
the ops repository; both labels exist since 2026-11-23).
|
||||
|
||||
## 7. Issue forms
|
||||
Scanning: osv-scanner and `pnpm audit --prod` in `gates` (required, every PR
|
||||
and push), the ops `security.yml` (gitleaks, Opengrep, osv-scanner) and
|
||||
Qodana. A finding in `gates` fails the job (policy docs/01 §5).
|
||||
|
||||
`.github/ISSUE_TEMPLATE/bug_report.yml` — field `id`s are load-bearing:
|
||||
they are the prefill query params used by `issueUrl.ts` (docs/05 §A6).
|
||||
**Renaming an id is a breaking change to shipped clients.**
|
||||
## 7. Issue templates
|
||||
|
||||
```yaml
|
||||
name: Bug report
|
||||
description: Something on the site is broken
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: input
|
||||
id: page-url
|
||||
attributes: { label: Page URL }
|
||||
validations: { required: true }
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes: { label: What happened / expected }
|
||||
validations: { required: true }
|
||||
- type: input
|
||||
id: environment
|
||||
attributes: { label: Browser & OS, description: Auto-filled when you use the in-site button }
|
||||
- type: textarea
|
||||
id: console-output
|
||||
attributes: { label: Console output, render: shell, description: Auto-filled; feel free to trim }
|
||||
```
|
||||
Two sets, kept in step:
|
||||
|
||||
`.github/ISSUE_TEMPLATE/app_request.yml`:
|
||||
- **`.gitlab/issue_templates/`** — what the public uses, on the GitLab
|
||||
mirror: `Bug.md`, `App request.md`, `Listing change.md`,
|
||||
`Accessibility.md`, and `.gitlab/merge_request_templates/Default.md`. Each
|
||||
ends with a `/label ~…` quick action (applied when the maintainer edits the
|
||||
issue). GitLab reads no issue forms, so these are Markdown with checklists.
|
||||
- **`.github/ISSUE_TEMPLATE/*.yml`** + `.github/PULL_REQUEST_TEMPLATE.md` —
|
||||
the forms Gitea reads (it reads `.gitea/ISSUE_TEMPLATE`,
|
||||
`.github/ISSUE_TEMPLATE` and `.github/issue_template`); only the maintainer
|
||||
can open issues there.
|
||||
|
||||
```yaml
|
||||
name: App request
|
||||
description: Suggest software for the directory
|
||||
labels: [app-request]
|
||||
body:
|
||||
- type: input
|
||||
id: app-name
|
||||
attributes: { label: App name }
|
||||
validations: { required: true }
|
||||
- type: input
|
||||
id: homepage
|
||||
attributes: { label: Official homepage (https) }
|
||||
validations: { required: true }
|
||||
- type: dropdown
|
||||
id: pricing
|
||||
attributes: { label: Pricing, options: [Free, Free + optional one-time purchase, One-time purchase] }
|
||||
validations: { required: true }
|
||||
- type: checkboxes
|
||||
id: platforms
|
||||
attributes:
|
||||
label: Platforms
|
||||
options: [{ label: Windows }, { label: macOS }, { label: Linux }]
|
||||
- type: checkboxes
|
||||
id: criteria
|
||||
attributes:
|
||||
label: Inclusion criteria (docs/00 §3)
|
||||
options:
|
||||
- { label: 'Not subscription-only (free tier is self-sufficient, or one-time purchase)', required: true }
|
||||
- { label: 'Links above are the developer''s official pages', required: true }
|
||||
- { label: 'Actively maintained or stable-and-finished', required: true }
|
||||
```
|
||||
`Bug.md` is the layout the site's **Report a bug** link fills in
|
||||
(`src/lib/issueUrl.ts`, docs/05 §A6): `### Page URL`, `### What happened /
|
||||
expected`, `### Browser & OS`, `### Console output`. Change one with the
|
||||
other. *Until 2026-11-24* the GitHub form's field ids (`page-url`,
|
||||
`environment`, `console-output`) were the prefill query parameters.
|
||||
|
||||
`.github/ISSUE_TEMPLATE/config.yml`: `blank_issues_enabled: false`, contact
|
||||
link → Discussions (or the gaming Discord) for general questions.
|
||||
The **Accessibility** template (D33) asks only what got in the way and the
|
||||
page address; steps, environment, a severity (Critical / Serious / Moderate
|
||||
/ Minor — confirmed in triage) and a screenshot are optional; it names the
|
||||
e-mail route `accessibility@poli0981.dev` (no account needed) and never asks
|
||||
about disability. **Listing change** (D36): which app, what should change
|
||||
(remove / correct a link / correct a detail / re-check), the evidence; it
|
||||
sends a suspected malicious download to `security@` by e-mail and a
|
||||
developer to `takedown@`. `.github/ISSUE_TEMPLATE/config.yml`: blank issues
|
||||
off; contact links to `code@` (questions), the Accessibility statement and
|
||||
SECURITY.md (e-mail only).
|
||||
|
||||
## 8. Branch protection (repo settings — H1 follow-up)
|
||||
The PR template (v1.4; v1.4.1 adds the D36 box): what and why with the
|
||||
linked issue, the CI gates, docs and i18n parity, the **accessibility
|
||||
checklist** and a data-PR block (docs/00 §3, docs/09 §6, original EN/VI
|
||||
summaries, `unverified` entry, official links).
|
||||
|
||||
`main`: require PR, require linear history, dismiss stale approvals on push.
|
||||
Required status checks — name **both** `ci` jobs, not the workflow: `ci / build`,
|
||||
`ci / gates`, plus `codeql`. Naming only the workflow leaves the `gates` job
|
||||
(validate:data, i18n parity, osv-scanner, link check) unenforced.
|
||||
## 8. Branch protection (Gitea, `main`)
|
||||
|
||||
CODEOWNERS: `* @poli0981` with explicit entries for `.github/**`, `scripts/**`,
|
||||
`src/data/**` (T6).
|
||||
Gitea branch protection on `main` (D6 in the runbook; set by the maintainer
|
||||
in Settings → Branches):
|
||||
|
||||
- **Changes arrive by pull request**; pushing to `main` is the owner's only;
|
||||
no force push, no deletion; **0 required approvals** (single-maintainer
|
||||
repository — `.gitea/CODEOWNERS` only *requests* the review).
|
||||
- **Required status checks:** the patterns `CI / build (*)` and
|
||||
`CI / gates (*)`. Gitea names a check `<workflow> / <job> (<event>)`, so
|
||||
the `(*)` matches the `pull_request`, `push` and `workflow_dispatch` runs
|
||||
alike — the last written by `record` (§1). **Renaming the workflow (`CI`)
|
||||
or a job breaks the rule** until it follows. `Security` and `Qodana` are
|
||||
not required: an outside service's outage must never block a merge.
|
||||
- **Signed commits are not required:** the bots' commits cannot be signed
|
||||
(§4). The maintainer's own commits are still GPG-signed locally, and Gitea
|
||||
verifies them against the key on the account
|
||||
(`https://git.poli0981.dev/poli0981.gpg`).
|
||||
- **Merge method: squash.** The squash title must be a valid conventional
|
||||
commit, and the body should carry every commit subject from the branch
|
||||
(docs/10 §5). A branch stacked on a squashed one is replayed with
|
||||
`git rebase --onto origin/main <old-branch>`.
|
||||
|
||||
`.gitea/CODEOWNERS` (Gitea reads it from the root, `docs/` or `.gitea/`
|
||||
only, and treats each pattern as a **regular expression**): `.*` plus the
|
||||
high-risk paths `^\.gitea/`, `^scripts/`, `^src/data/`, `^worker/` (T6).
|
||||
*Until 2026-11-24* this was GitHub's ruleset "Run" (PR, signed commits,
|
||||
linear history, checks `build`, `gates`, `codeql / Analyze
|
||||
(javascript-typescript)`).
|
||||
@@ -3,24 +3,50 @@
|
||||
## 1. Versioning model
|
||||
|
||||
The **site** deploys continuously from `main` — no version numbers on
|
||||
content. Git tags mark milestones only: `v1.0.0` at public launch, minor
|
||||
tags when a feature phase ships (they trigger `notify.yml`). Data changes
|
||||
never tag. `CHANGELOG.md` (Keep-a-Changelog) records feature work, not app
|
||||
additions — the RSS feed *is* the data changelog.
|
||||
content. Git tags mark milestones only: **`v1.0.0`** at public launch
|
||||
(tagged and released 2026-07-30), **`v1.1.0`** for the post-launch review
|
||||
(tagged and released 2026-10-21; `package.json` `version` follows the tag),
|
||||
**`v1.2.0`** for the upkeep release — re-check automation, Node 26 /
|
||||
TypeScript 7, CI-based SonarQube Cloud, catalogue batch 2 (2026-10-23),
|
||||
**`v1.3.0`** for the site-wide rate limit (D32, 2026-10-26),
|
||||
**`v1.4.0`** for accessibility — the statement, the "/" switch, the WCAG
|
||||
2.2 fixes and the Accessibility category (D33, D34, 2026-11-09),
|
||||
**`v1.4.1`** for the start of maintenance mode and Qodana (D36, D35,
|
||||
2026-11-15), **`v1.5.0`** for the move to Gitea — the forge, CI, deploy and
|
||||
the GitLab bug report — with catalogue batch 4 alongside (D38, D39,
|
||||
2026-11-24; the first release tagged and published on Gitea),
|
||||
minor tags when a feature phase ships. Publishing a release — on Gitea since
|
||||
D38, by hand — fires `notify.yml` → Discord (docs/12 §2). Tags v1.0.0–v1.4.1
|
||||
were GitHub releases; the tags moved to Gitea with the code, their release
|
||||
pages did not. Data changes never tag. `CHANGELOG.md`
|
||||
(Keep-a-Changelog, dates UTC) records feature work and anything a visitor
|
||||
should know — v1.1.0 leads with the privacy changes — not app additions:
|
||||
the RSS feed *is* the data changelog.
|
||||
|
||||
**In maintenance mode (D36)** a tag follows a fix, not a feature: a
|
||||
**patch** (`v1.4.x`) when a fix is worth announcing — a security fix, a
|
||||
bug or accessibility fix a visitor would notice, an urgent dependency or
|
||||
runtime update — and a **minor** for a platform major (TypeScript 7
|
||||
alone, Astro, Wrangler, the forge — D38). Routine dependency merges
|
||||
(Renovate's) and data changes still never tag.
|
||||
|
||||
## 2. Launch checklist (gate for calling it v1.0.0)
|
||||
|
||||
> **Status 2026-07-28.** The infra section below is **green** — verified
|
||||
> against production after the M6 deploy: `http→https` 301, `www→apex` 301 with
|
||||
> path and query preserved, apex 200, branded 404, HSTS present, no
|
||||
> `X-Robots-Tag`, workers.dev route dead (404), DMARC resolving, and
|
||||
> `/api/apps.json`, `/rss.xml`, `/sitemap-index.xml`, `security.txt` all 200.
|
||||
> **Status 2026-10-21.** **v1.0.0 shipped on 2026-07-30** (tag + GitHub
|
||||
> Release) once the content blocker below cleared: 326 apps, 320 `clean` and
|
||||
> 6 held at `unverified`, every one with its scan linked. **v1.1.0**, the
|
||||
> post-launch review (CHANGELOG.md), was released on 2026-10-21; its last
|
||||
> merge (#25) is deployed (checked in production the same day). Unchecked
|
||||
> boxes below are still open, not forgotten; items added for v1.1 are
|
||||
> marked *(v1.1)*.
|
||||
>
|
||||
> **What still blocks v1.0.0 is content, not infrastructure:** the dataset
|
||||
> holds 5 entries against the 32 in §4, and every one is
|
||||
> `security.status: "unverified"` because the §6 vetting checklist has not been
|
||||
> run against them. Tagging v1.0.0 before that would put the project's own
|
||||
> honesty claim (hard rule 4) on a dataset nobody has checked.
|
||||
> **Status 2026-07-28** (kept for the record). The infra section below was
|
||||
> **green** — verified against production after the M6 deploy: `http→https`
|
||||
> 301, `www→apex` 301 with path and query preserved, apex 200, branded 404,
|
||||
> HSTS present, no `X-Robots-Tag`, workers.dev route dead (404), DMARC
|
||||
> resolving, and `/api/apps.json`, `/rss.xml`, `/sitemap-index.xml`,
|
||||
> `security.txt` all 200. What blocked v1.0.0 then was content: 5 entries,
|
||||
> all `unverified`.
|
||||
|
||||
Infra & correctness
|
||||
|
||||
@@ -28,28 +54,48 @@ Infra & correctness
|
||||
- [ ] `pnpm build` clean; validate:data clean; i18n parity clean
|
||||
- [ ] `curl -I` shows full header set (docs/09 §4); observatory scan grade A
|
||||
- [ ] `/apps/nonexistent` → HTTP 404 branded page; airplane-mode → offline page
|
||||
- [ ] `/api/apps.json`, `/rss.xml`, `/sitemap-index.xml` valid (W3C feed validator)
|
||||
- [ ] **PWA icons exist** — `public/icons/` 192, 512 and maskable PNGs, wired
|
||||
into the manifest. `favicon.svg` is a placeholder anchor mark and the
|
||||
manifest ships `icons: []` until the real wordmark lands (docs/06 §4),
|
||||
so there is currently no install prompt.
|
||||
- [ ] `security.txt` `Expires` is in the future (annual task, §6)
|
||||
- [ ] `/api/apps.json`, `/rss.xml`, `/sitemap-index.xml` valid (W3C feed
|
||||
validator). Since v1.1 `check:feed` asserts the emitted feed's guids,
|
||||
links and order on every build (docs/05 §A4).
|
||||
- [x] **PWA icons exist** *(v1.1)* — `public/icons/` 192, 512 and maskable
|
||||
512 PNGs plus `apple-touch-icon.png` and `favicon.ico`, generated by
|
||||
`pnpm icons`; the manifest lists them and `Base.astro` links it, so
|
||||
the site is installable (docs/08 Part D).
|
||||
- [x] `security.txt` `Expires` is in the future — 2027-07-28 (annual task, §6)
|
||||
- [ ] Domain package verified end-to-end (docs/16 §10 command block):
|
||||
DNSSEC signing, `www` → 301 apex with path+query, http → https,
|
||||
workers.dev main route dead, HSTS phase P1 header present,
|
||||
DMARC record resolves, `contact@softharbor.net` receives a test mail
|
||||
workers.dev main route dead, HSTS header present (P3 observed
|
||||
2026-10-21), DMARC record resolves, and *(v1.1)* a test mail to the
|
||||
`@poli0981.dev` purpose addresses arrives (D27 — the old
|
||||
`contact@softharbor.net` is retired)
|
||||
- [x] No stray `workers.dev` references in the repo. `git grep workers.dev`
|
||||
outside `docs/` and the lockfile should return only **`CLAUDE.md`'s
|
||||
hosting summary** — that and docs/16 §3 are deliberate descriptions of
|
||||
the disabled route, not live URLs. Anything else is a real stray.
|
||||
- [ ] **`X-Robots-Tag: noindex` removed from `public/_headers`.** It was added
|
||||
pre-launch so an empty site could be deployed without being indexed;
|
||||
leaving it in would silently keep the finished site out of every search
|
||||
engine. Verify with `curl -sI https://softharbor.net/ | grep -i robots`
|
||||
returning nothing.
|
||||
outside `docs/` and the lockfile should return only deliberate ones:
|
||||
`CLAUDE.md`'s hosting summary, the `wrangler.jsonc` comments, the
|
||||
`_headers` rule that marks PR previews `noindex`, and a Turnstile
|
||||
test fixture host. Anything else is a real stray.
|
||||
- [x] **`X-Robots-Tag: noindex` removed from `public/_headers`** (2026-07-28).
|
||||
It was added pre-launch so an empty site could be deployed without
|
||||
being indexed. Verify with `curl -sI https://softharbor.net/ | grep -i
|
||||
robots` returning nothing — only PR preview hosts carry it now.
|
||||
- [ ] Search Console **Domain property** for `softharbor.net` verified;
|
||||
sitemap `https://softharbor.net/sitemap-index.xml` submitted; Bing
|
||||
imported from GSC; Crawler Hints enabled (docs/16 §8)
|
||||
imported from GSC; Crawler Hints enabled (docs/16 §8). The
|
||||
`google-site-verification` TXT record is published (observed
|
||||
2026-10-21); the rest ⚠ verify.
|
||||
- [x] *(v1.1)* **Runtime secret `TURNSTILE_SECRET` set** on the production
|
||||
Worker (docs/08 Part E). A `POST /api/verify` with a junk token and a
|
||||
same-origin `Origin` must answer `403 {"error":"rejected"}`, not
|
||||
`503 {"error":"not_configured"}` — without the secret the gate fails
|
||||
open for everyone, silently. Verified 2026-10-21 (403 `rejected`,
|
||||
`no-store` JSON from the Worker). Re-check whenever the Worker is
|
||||
re-created.
|
||||
- [x] *(v1.1)* After the merge, the "Workers Builds" check on the merge
|
||||
commit is green **and** production has been verified (§3) — never
|
||||
assume a merge reached production. Done for #25 (2c40baf) on
|
||||
2026-10-21: `Workers Builds: softharbor`, `build`, `gates` and
|
||||
`codeql` green; production served `/contact`, the v1.1 CSP meta, a
|
||||
single immutable `Cache-Control` on hashed assets and `403 rejected`
|
||||
from `/api/verify`. Repeat on every merge (§6).
|
||||
|
||||
Content & legal
|
||||
|
||||
@@ -57,31 +103,98 @@ Content & legal
|
||||
with the scan permalink in `security.evidence`, zero `flagged`
|
||||
— **done 2026-07-30**: 320 `clean`, 6 held at `unverified`
|
||||
- [ ] Summaries proof-read in both locales (L4, docs/03 §2 — still open)
|
||||
- [ ] Legal drafts reviewed by Kokone (H6), contact email live (H5),
|
||||
`LEGAL_VERSION` set; gate tested on a fresh profile in both locales
|
||||
- [ ] LICENSE (GPL-3.0) + LICENSE-DATA.md present; footer license line correct
|
||||
- [ ] Legal text reviewed by Kokone — H6 approved the drafts on 2026-07-28;
|
||||
sign-off on the 2026-10-21 rewrite ⚠ verify. Contacts live (D27),
|
||||
`LEGAL_VERSION` = 2026-10-21 (docs/14 Part 2); gate — both steps —
|
||||
tested on a fresh profile in both locales (automated since v1.1 in
|
||||
`e2e/gate.spec.ts`; a manual pass on real hardware still worth doing)
|
||||
- [x] LICENSE (GPL-3.0) + LICENSE-DATA.md present; footer license line
|
||||
"Code GPL-3.0 · Data CC BY-SA 4.0" correct
|
||||
|
||||
Quality bar
|
||||
|
||||
- [ ] Lighthouse mobile on `/apps`: Performance ≥ 95 · A11y = 100 ·
|
||||
Best Practices = 100 · SEO = 100
|
||||
- [ ] JS on `/apps` < 80 KB gzip (docs/00 §2.5)
|
||||
- [x] JS on `/apps` < 80 KB gzip (docs/00 §2.5) — every first-party
|
||||
`/_astro/*.js` file *combined* is ~41 KB gzip (local build,
|
||||
2026-10-21), MiniSearch included; `/apps` loads a subset of that. The
|
||||
page's HTML is the heavier part (~119 KB gzip, docs/15 §2 item 9).
|
||||
- [ ] Both gates above are **enforced in CI**, not just checked once here —
|
||||
Lighthouse CI (assert A11y = 100) and a `size-limit` budget on the
|
||||
`/apps` bundle, wired into `ci.yml`'s `gates` job (docs/12 §2). A
|
||||
launch-day-only check is a number that starts regressing on day two.
|
||||
`/apps` bundle, wired into `ci.yml` (docs/12 §2). A launch-day-only
|
||||
check is a number that starts regressing on day two. *(v1.1: the
|
||||
Playwright suite now enforces axe — serious/critical findings in
|
||||
light and dark — console- and CSP-clean pages and no sideways
|
||||
overflow on every PR; Lighthouse and the size budget are still not
|
||||
wired. v1.4: moderate findings fail too, axe also runs on the open
|
||||
gate, filter sheet and display menu, and reflow at 320 px and forced
|
||||
colours are tested — `e2e/a11y.spec.ts`.)*
|
||||
- [x] *(v1.1)* **End-to-end suite enforced in CI** — Playwright + axe on the
|
||||
built site, desktop + Pixel 7, in `ci.yml`'s `build` job on every PR
|
||||
and push to `main` (docs/11 §5); a red e2e run blocks the merge like
|
||||
any other required check.
|
||||
- [x] *(v1.4)* Keyboard-only + Narrator (Windows 11; Chrome, Brave,
|
||||
Firefox) pass on the whole site — owner, 2026-11-09, no barriers
|
||||
found; recorded in ACCESSIBILITY.md and `/legal/accessibility`
|
||||
- [ ] VoiceOver (macOS) + NVDA (Windows) pass on grid, filter sheet, gate
|
||||
- [ ] Vietnamese diacritics visually clean in all three fonts at all scale
|
||||
steps (docs/06 §3)
|
||||
|
||||
## 3. Launch-day sequence
|
||||
## 3. Release sequence (every merge, every tagged release)
|
||||
|
||||
1. Merge the final seed PR → auto-deploy.
|
||||
2. Tag `v1.0.0`, publish GitHub Release (notes = feature summary EN) →
|
||||
`notify.yml` fires the cross-poster once for the launch itself.
|
||||
3. Manual posts where the cron doesn't reach (Discord announcement channels
|
||||
with role pings, pinned messages).
|
||||
4. Enable the RSS→notify.py cron for ongoing per-app announcements (§5).
|
||||
**After every merge to `main` — verify production, never assume it.**
|
||||
The merge commit's CI run deploys: `build` and `gates`, then the `deploy`
|
||||
job (`wrangler deploy`, docs/12 §3). The runner is the maintainer's PC, so
|
||||
the run waits while it is off.
|
||||
|
||||
1. **Wait** until the merge commit's **CI run is green, its `deploy` job
|
||||
included** — that job's last step already polls `/api/apps.json` until
|
||||
production answers with the new build's `generatedAt`. (Until D38 this
|
||||
step waited for Workers Builds' "Workers Builds: softharbor" check.)
|
||||
2. **Then verify production itself:**
|
||||
- the new content-hashed `/_astro/` asset names are served (compare the
|
||||
page source with the local `dist/`), so the new build is live;
|
||||
- the headers: `curl -sI https://softharbor.net/` — header CSP exactly
|
||||
`frame-ancestors 'none'`, the security headers, HSTS; one hashed asset
|
||||
with a single `Cache-Control: public, max-age=31536000, immutable`;
|
||||
- the per-page CSP meta lists the two Cloudflare origins (docs/09 §4);
|
||||
- `/api/verify` is answered by the **Worker**:
|
||||
`curl -s -X POST -H 'Origin: https://softharbor.net' -H 'Content-Type:
|
||||
application/json' -d '{"token":"x"}' https://softharbor.net/api/verify`
|
||||
→ `403 {"error":"rejected"}` (a `503 not_configured` means the runtime
|
||||
secret is missing; a bare `405` from the asset server means the Worker
|
||||
is not deployed);
|
||||
- the site-wide rate limit (D32, docs/08 Part F) answers a burst over
|
||||
**one connection** — one `curl` with many URLs reuses its connection;
|
||||
parallel `curl`s would land on different machines and pass (Part F):
|
||||
`curl -s $(for i in $(seq 70); do printf -- '-o /dev/null https://softharbor.net/robots.txt '; done) -w "%{http_code}\n" | sort | uniq -c`
|
||||
→ about 60 × `200`, then `429`s; add `--next -s -D - -o /dev/null
|
||||
https://softharbor.net/apps` to the same command to see a refused
|
||||
page: `429`, `Retry-After: 10`, `Cache-Control: no-store` and the
|
||||
`_headers` set. Ten seconds later everything is `200` again;
|
||||
- `/rss.xml` serves the expected items (guid = slug, docs/05 §A4).
|
||||
3. **Prefer re-running the `deploy` job to a hand `wrangler deploy`** —
|
||||
a local deploy bypasses CI (docs/08 A3).
|
||||
|
||||
**Tagged release** (`v1.1.0` and later):
|
||||
|
||||
1. Merge (squash — docs/12 §8), then complete the three steps above.
|
||||
2. Update `CHANGELOG.md` and `package.json` `version` in the release PR;
|
||||
after it is merged and verified, push a **signed** annotated tag
|
||||
(`git tag -s vX.Y.Z`, then `git push origin vX.Y.Z`) and **publish the
|
||||
Gitea release by hand** (https://git.poli0981.dev/poli0981/softharbor/releases → New release → the tag; notes
|
||||
from the CHANGELOG section, links only — no binaries). **Release notes
|
||||
must be accurate before publishing**: `notify.yml` announces them to
|
||||
Discord at once (docs/12 §2; a manual re-run takes a `tag` input, passed
|
||||
on as `tag_override`). A release a workflow created with the job token
|
||||
would not fire `release: published`, which is why this step is manual.
|
||||
3. Manual posts where the automation doesn't reach (Discord announcement
|
||||
channels with role pings, pinned messages).
|
||||
|
||||
**Launch day (v1.0.0, 2026-07-30)** followed the same shape: final seed PR
|
||||
merged → production verified → tag + release → Discord via `notify.yml` →
|
||||
manual posts → the RSS → notify.py cron enabled for ongoing per-app
|
||||
announcements (§5).
|
||||
|
||||
## 4. Seed list — 32 launch apps (proposed; H7 approves)
|
||||
|
||||
@@ -124,9 +237,13 @@ free tier self-sufficient → `free` (C3); Sublime Text — perpetual license
|
||||
## 5. Ongoing announcements (notify.py integration)
|
||||
|
||||
The existing cross-poster consumes `/rss.xml` (guid = slug, docs/03 §7) on
|
||||
its GitHub Actions cron and posts new items to Telegram, Discord webhook,
|
||||
Bluesky, Mastodon, X, Facebook. SoftHarbor-side contract: never reuse a
|
||||
slug; never backdate `addedAt`; feed stays deterministic. Message template
|
||||
its own schedule, in its own repository, and posts new items to Telegram, Discord webhook,
|
||||
Bluesky, Mastodon, X, Facebook. It announces **every `<guid>` it has not
|
||||
seen**, so its failure modes are public and irreversible. SoftHarbor-side
|
||||
contract: never reuse or rename a slug; never backdate `addedAt`; the feed
|
||||
stays deterministic (pinned collator, docs/05 §A4); never change the guid
|
||||
shape or the 50-item window's order without meaning to announce.
|
||||
`check:feed` enforces the emitted shape on every build. Message template
|
||||
(configured on the notify.py side):
|
||||
`🆕 {name} — {summary.en} · {site}/apps/{slug}`.
|
||||
|
||||
@@ -135,19 +252,24 @@ slug; never backdate `addedAt`; feed stays deterministic. Message template
|
||||
| Cadence | Task |
|
||||
|---|---|
|
||||
| per-PR | vetting checklist on new/changed entries |
|
||||
| per issue / PR | triage against D36 (maintenance mode): listings, re-checks, bugs, UI/UX and accessibility are in scope; a feature request is closed as *not planned* with `wontfix` |
|
||||
| **after every merge** | wait for the merge commit's CI run (its `deploy` job), then verify production (§3) |
|
||||
| daily (auto) | quarantine sweep (docs/12 §4) |
|
||||
| weekly (auto) | link-check triage — fix, replace with official mirror, or flag |
|
||||
| weekly (auto) | Renovate window + osv findings |
|
||||
| monthly (manual, ~30 min) | re-verify the 10 oldest `checkedAt` entries; refresh dates |
|
||||
| weekly (auto) | link-check triage — the one `link-rot` issue is refreshed or closed (docs/12 §5); fix, replace with official mirror, or flag |
|
||||
| daily (auto, 13:31 UTC) | Renovate (central, D38): a grouped non-major PR when something is due (npm releases ≥ 3 days old, action pins), OSV security PRs at once — merge when CI is green; osv/audit findings fail CI on their own. The Dependency Dashboard issue lists what is pending |
|
||||
| daily (auto, 13:59 UTC) | VirusTotal re-check (docs/12 §4b): checks older than 90 days are re-scanned into the one `vt/recheck` PR — review and merge it; triage any `[vt] <slug>` issue (false positive → back to `clean` with a note; confirmed → `flagged` + `pnpm quarantine`). Scheduled runs need the maintainer's PC on (13:00–16:00 UTC); a run waits up to 24 h for it |
|
||||
| monthly (manual, ~10 min) | GSC review: Coverage, Core Web Vitals, hreflang errors; skim DMARC reports (docs/16 §6/§8) |
|
||||
| **annually (manual, ~2 min)** | **Roll `Expires` in `public/.well-known/security.txt` forward one year** (docs/09 §5). An expired `security.txt` is treated as invalid by scanners and researchers — and nothing else in this repo would notice. |
|
||||
| once, post-launch | HSTS phase transitions P1 → P2 (+2 weeks) → optional P3/preload (H9) — docs/16 §5 |
|
||||
| **by 2026-12-31** | **Renew the Qodana Ultimate licence** (Qodana Cloud; the scan log prints its end date) — without it every `qodana` run is red from 2027-01-01 (docs/12 §2, D35) |
|
||||
| once, post-launch | HSTS phase transitions P1 → P2 (+2 weeks) → optional P3/preload (H9) — docs/16 §5. Observed 2026-10-21: already at P3 (`preload` in the header) — docs/15 §5 |
|
||||
| quarterly | review category taxonomy & criteria rulings; prune tags |
|
||||
|
||||
## 7. Incident playbook (listed app turns out harmful)
|
||||
|
||||
1. Set `flagged` (PR or label) → workflow quarantines within the day; site
|
||||
updates on merge.
|
||||
1. Set `flagged` and run `pnpm quarantine` in the same PR (`validate:data`
|
||||
rejects a flag left in place); the nightly workflow is the safety net
|
||||
for anything that slips through. Site updates once the merge has
|
||||
deployed — verify it (§3).
|
||||
2. Tracking issue gets evidence links; entry's page 404s (acceptable — the
|
||||
RSS item remains historical, do not rewrite the feed).
|
||||
3. If users were plausibly exposed (app was `clean` at the time), post a
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
# 14 — Legal (licensing · gate · bilingual drafts)
|
||||
|
||||
> ⚠️ These drafts are templates prepared by the project, **not legal
|
||||
> advice**. Kokone reviews and approves before first public deploy (H6).
|
||||
> Since v1.1 the site URL is final (`https://softharbor.net`) and the
|
||||
> contact address is `contact@softharbor.net` — it must be live via Email
|
||||
> Routing (docs/16 §6, H5) before these pages publish. At implementation
|
||||
> time each draft below is split into its own page under `/legal/*` (EN)
|
||||
> and `/vi/legal/*` (VI). English is canonical (docs/07 §8).
|
||||
> All drafts: **Last updated: 2026-07-20**.
|
||||
> advice**. Kokone approved them before the first public deploy (H6,
|
||||
> 2026-07-28). The site URL is final (`https://softharbor.net`). Since
|
||||
> 2026-10-21 (D27) there is **one contact address per purpose** at
|
||||
> `@poli0981.dev` — the table in Part 2 — and `contact@softharbor.net` is
|
||||
> retired everywhere. Each document is its own page under `/legal/*` (EN)
|
||||
> and `/vi/legal/*` (VI); English is canonical (docs/07 §8). The shipped
|
||||
> wording lives in `src/components/legal/*.astro` (Part 3); every document
|
||||
> carries its **own** "Last updated" date (`LEGAL_UPDATED`) — all six read
|
||||
> 2026-10-21 as of v1.1. v1.4 (D33) adds a seventh page, the
|
||||
> **Accessibility Statement** (§3g) — informational, not accepted.
|
||||
|
||||
## Part 1 — Licensing model
|
||||
|
||||
| Scope | License | File |
|
||||
|---|---|---|
|
||||
| Code (everything except below) | **GPL-3.0-only** | `LICENSE` (add via GitHub license picker — full text, unmodified) |
|
||||
| Code (everything except below) | **GPL-3.0-only** | `LICENSE` (the full text, unmodified) |
|
||||
| Dataset `src/data/**` (app entries + category registry) | **CC BY-SA 4.0** | `LICENSE-DATA.md` |
|
||||
| Docs `docs/**` | GPL-3.0-only (with the code) | — |
|
||||
|
||||
@@ -29,7 +32,8 @@ Creative Commons Attribution-ShareAlike 4.0 International license
|
||||
(CC BY-SA 4.0): https://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
**Attribution format:** "SoftHarbor contributors —
|
||||
https://github.com/poli0981/softharbor (CC BY-SA 4.0)".
|
||||
https://git.poli0981.dev/poli0981/softharbor (CC BY-SA 4.0)" — the repository's address since D38 (2026-11-24);
|
||||
an attribution made earlier names `https://github.com/poli0981/softharbor`.
|
||||
|
||||
You may copy, redistribute, and adapt the dataset, including commercially,
|
||||
provided you give the attribution above, link the license, indicate
|
||||
@@ -40,6 +44,8 @@ structure). It does **not** cover the listed applications, their names, or
|
||||
their logos, which belong to their respective owners (see /legal/trademarks).
|
||||
Everything in this repository outside `src/data/` is licensed under
|
||||
GPL-3.0-only — see `LICENSE`.
|
||||
|
||||
Questions about this license or how to attribute: copyright@poli0981.dev.
|
||||
```
|
||||
|
||||
Provenance rule enforcing licensability: summaries are written from scratch
|
||||
@@ -49,25 +55,110 @@ actually grant CC BY-SA on them.
|
||||
## Part 2 — Legal gate specification
|
||||
|
||||
**Purpose:** ensure every user has seen the disclaimer (T1) before using
|
||||
the directory, in the CommandForge tradition, adapted to the web.
|
||||
the directory, in the CommandForge tradition, adapted to the web — and,
|
||||
since v1.1, run a consent-first human check (D25).
|
||||
|
||||
**Two steps, one dialog.** Step 1 is the documents and "I understand and
|
||||
accept". Step 2 — only after step 1 — is a Cloudflare Turnstile check whose
|
||||
token the site's Worker confirms (docs/09 §4a, algorithm docs/05 §A9). A
|
||||
returning visitor whose check has lapsed sees step 2 only.
|
||||
|
||||
| Aspect | Spec |
|
||||
|---|---|
|
||||
| Trigger | First route render when `localStorage['sh:legal'] !== LEGAL_VERSION` (docs/05 §A7) |
|
||||
| Component | `ShLegalGate.svelte`, `client:load`, `transition:persist`, native `<dialog>` `showModal()` |
|
||||
| Exempt routes | `/legal/**`, `/vi/legal/**`, `/404`, `/offline`, `/errors/*` — so the gate can link to the very documents it asks users to accept, and error/offline states never dead-lock |
|
||||
| Content | Locale-matched summary (below) + links to Disclaimer/Privacy/Terms + single accept button. No decline button: the gate itself explains that leaving the site is the alternative |
|
||||
| Interaction | Focus trapped by `showModal()`; **Esc intercepted** (`cancel` event `preventDefault`) pre-accept; page content behind is rendered but `inert` |
|
||||
| Crawlers/SEO | Content renders underneath normally (dialog is an overlay, no cloaking, no JS-gated content); bots don't execute acceptance and don't need to |
|
||||
| Persistence | Accept ⇒ `sh:legal = LEGAL_VERSION`. Version bump (any legal doc change) re-opens for everyone. localStorage unavailable ⇒ fail open per session (in-memory accept) |
|
||||
| Copy EN | **Before you continue** — SoftHarbor is a link directory. We don't host downloads, and we can't guarantee third-party software. Statuses like "no known warnings" reflect checks on the date shown — verify anything you install. By continuing you accept the [Disclaimer], [Terms of Use] and [Privacy Policy]. → **I understand and accept** |
|
||||
| Copy VI | **Trước khi tiếp tục** — SoftHarbor là trang tổng hợp liên kết. Chúng tôi không lưu trữ tệp cài đặt và không thể bảo đảm cho phần mềm bên thứ ba. Trạng thái như "không có cảnh báo đã biết" chỉ phản ánh việc kiểm tra tại ngày ghi kèm — hãy tự xác minh trước khi cài đặt. Khi tiếp tục, bạn chấp nhận [Tuyên bố miễn trừ], [Điều khoản sử dụng] và [Chính sách quyền riêng tư]. → **Tôi hiểu và chấp nhận** |
|
||||
| Trigger | Shown when `sh:legal ≠ LEGAL_VERSION` (step 1, docs/05 §A7) **or** `sh:human` has lapsed (step 2 only) |
|
||||
| Component | `ShLegalGate.svelte`, `client:load`, rendered by `Base.astro` on every non-exempt page — no `transition:persist`: every navigation is a full document load (docs/02 §6), so each page mounts its own gate with its own locale's strings |
|
||||
| Exempt pages | Declared by the page with `gateExempt` — the island is simply not rendered: the seven legal documents (EN + VI, the Accessibility Statement included — someone held up by a barrier, the gate's own included, must be able to read how to report it), `/contact` (EN + VI), `/404`, `/offline`, `/errors/*`. The gate links to the very documents it asks users to accept; error and offline pages must never dead-lock (Workers serves `404.html`, and the SW the offline page, at whatever URL was requested — the old path regex never matched them); a security or copyright notice must never wait behind acceptance |
|
||||
| Content, step 1 | Locale-matched summary (below) + links to Disclaimer, Terms and Privacy under the locale's `/legal` base + a single accept button. No decline button: the copy explains that leaving the site is the alternative. A scale icon tile heads the step |
|
||||
| Content, step 2 | "One moment" — what Turnstile is for, a spinner, and a link to the Privacy Policy's `#turnstile` section; the widget shows itself only if it needs a click (`interaction-only`). If the check cannot run: "The check could not run, so it was skipped. Come on in." for 1.5 s, then the gate closes. A shield icon tile heads the step |
|
||||
| Step 2 outcome | Pass ⇒ `sh:human` = now + 48 h. Anything else — script blocked, widget error, 10 s timeout (120 s once it asks for a click), Worker 429/503/unreachable, three rejected challenges — ⇒ now + 1 h and the visitor is **let in** (fail open, docs/09 §4a) |
|
||||
| Interaction | Native `<dialog>` opened with `showModal()`: focus trapped, everything behind it inert. Focus lands on the step's **heading**, so a screen reader reads the notice before any control. **Esc cannot dismiss it**: `closedby="none"`, `cancel` prevented while required, and if anything closes it early (Chromium's close watcher honours `preventDefault()` only after user activation) it re-opens at once. `body[data-sh-gate="open"]` makes global shortcuts (`/`) stand down (docs/06 §9). On phones (< 40 rem) it is a bottom sheet |
|
||||
| Crawlers/SEO | Content renders underneath normally (dialog is an overlay, no cloaking, no JS-gated content); bots don't execute acceptance and don't need to. With JS off the island never runs and no gate appears |
|
||||
| Persistence | Accept ⇒ `sh:legal = LEGAL_VERSION` (policy below). `sh:human` holds an expiry timestamp. localStorage unavailable ⇒ fail open per page/session (both records held in memory on `globalThis`) |
|
||||
| Copy EN, step 1 | **Before you continue** — SoftHarbor is a link directory. We don't host downloads, and we can't guarantee third-party software. Statuses like "no known warnings" reflect checks on the date shown — verify anything you install. By continuing you accept the [Disclaimer], [Terms of Use] and [Privacy Policy]. → **I understand and accept** |
|
||||
| Copy VI, step 1 | **Trước khi tiếp tục** — SoftHarbor là trang tổng hợp liên kết. Chúng tôi không lưu trữ tệp cài đặt và không thể bảo đảm cho phần mềm bên thứ ba. Trạng thái như "không có cảnh báo đã biết" chỉ phản ánh việc kiểm tra tại ngày ghi kèm — hãy tự xác minh trước khi cài đặt. Khi tiếp tục, bạn chấp nhận [Tuyên bố miễn trừ], [Điều khoản sử dụng] và [Chính sách quyền riêng tư]. → **Tôi hiểu và chấp nhận** |
|
||||
| Copy EN, step 2 | **One moment** — A quick automatic check by Cloudflare Turnstile that you are a person, not a bot. It usually takes a second and needs nothing from you — see the [Privacy Policy]. |
|
||||
| Copy VI, step 2 | **Chờ một chút** — Cloudflare Turnstile đang tự động kiểm tra để xác nhận bạn là người chứ không phải bot. Thường chỉ mất một giây và bạn không cần làm gì — xem [Chính sách quyền riêng tư]. |
|
||||
|
||||
All gate copy lives in the dictionaries (`gate.*`), resolved server-side for
|
||||
the page's locale only and passed to the island as props — importing the
|
||||
dictionaries into the island would bundle every key (docs/07 §3).
|
||||
|
||||
### `LEGAL_VERSION` policy
|
||||
|
||||
- `LEGAL_VERSION` (`src/lib/legal.ts`) is the version of the **accepted
|
||||
set** — Disclaimer, Terms of Use and Privacy Policy (`ACCEPTED_DOCS`),
|
||||
the three documents the gate asks for. **Bump it when one of those three
|
||||
changes materially**: the bump re-opens the gate for everyone, which is
|
||||
the intended behaviour. Typos and formatting do not bump it.
|
||||
- `LEGAL_UPDATED` gives each of the **seven** documents its own "Last
|
||||
updated" date, shown on its page. Trademarks, Third-party notices, the
|
||||
AI Disclosure and the Accessibility Statement move only their own date —
|
||||
they are informational and not part of what is accepted.
|
||||
- **A test enforces the link** (`src/lib/legal.test.ts`): every accepted
|
||||
document's `LEGAL_UPDATED` must be ≤ `LEGAL_VERSION` — editing Privacy
|
||||
without bumping the version fails `pnpm test`. Every date must be a real
|
||||
day that has already happened.
|
||||
- Equality, never ordering: any stored value other than the current one —
|
||||
older, *newer*, garbage — re-opens the gate (docs/05 §A7).
|
||||
- History: **2026-07-28** (H6 approval of these drafts) · **2026-07-30**
|
||||
(while one constant still dated every page, it moved with the new AI
|
||||
Disclosure) · **2026-10-21** (v1.1: Privacy covers Web Analytics and the
|
||||
Turnstile check and names the operator; Terms gained the operator and a
|
||||
copyright-complaint procedure; nine EN/VI wording gaps and two false AI
|
||||
Disclosure claims fixed) · **2026-10-26** (v1.3: Privacy gains
|
||||
`#rate-limit` for the site-wide rate limit, D32 — our own code now
|
||||
processes every visitor's address, if only for seconds, which the gate
|
||||
asks everyone to accept once more) · **2026-11-09** (v1.4, D33: Privacy
|
||||
`#storage` lists `sh:keys`, the display menu's switch for the "/"
|
||||
shortcut — the storage inventory must stay complete, and the test treats
|
||||
any Privacy change as one the gate asks about; the owner chose this over
|
||||
dropping the switch).
|
||||
|
||||
### Contacts (D27)
|
||||
|
||||
One address per purpose, all `@poli0981.dev`, all reaching the one
|
||||
maintainer; `src/lib/contacts.ts` is the single source — pages, legal
|
||||
documents and `security.txt` import from it or match it, never hard-code
|
||||
another. Mail to `poli0981.dev` is delivered to a **Google-hosted** mailbox
|
||||
(MX `aspmx.l.google.com`), which the Privacy Policy says (`#email`).
|
||||
|
||||
| Key | Address | Purpose |
|
||||
|---|---|---|
|
||||
| `security` | `security@poli0981.dev` | vulnerabilities; hijacked or malicious listing links (`security.txt`, `SECURITY.md`, Disclaimer) |
|
||||
| `privacy` | `privacy@poli0981.dev` | the Privacy Policy, data requests |
|
||||
| `accessibility` | `accessibility@poli0981.dev` | a barrier on the site — the Accessibility Statement and ACCESSIBILITY.md (D33, alias created 2026-11-09) |
|
||||
| `legal` | `legal@poli0981.dev` | Terms, Disclaimer, anything else legal |
|
||||
| `dmca` | `dmca@poli0981.dev` | copyright (DMCA-style) notices — the procedure in Terms `#copyright` |
|
||||
| `takedown` | `takedown@poli0981.dev` | a developer asking for their listing or logo to be changed or removed; trademark complaints |
|
||||
| `copyright` | `copyright@poli0981.dev` | licensing of the code (GPL-3.0-only) and the dataset (CC BY-SA 4.0) |
|
||||
| `conduct` | `code@poli0981.dev` | Code of Conduct reports |
|
||||
| `press` | `press@poli0981.dev` | press |
|
||||
| `collab` | `collab@poli0981.dev` | collaboration |
|
||||
|
||||
Deliberately absent: `sponsor@` (a neutral directory takes no paid
|
||||
placement) and `games@` (another project's). The Contact page
|
||||
(`/contact`, `/vi/contact`) lists them in order of urgency and is
|
||||
gate-exempt.
|
||||
|
||||
## Part 3 — Draft legal documents (EN canonical · VI courtesy)
|
||||
|
||||
Every VI page carries: *"Bản tiếng Việt chỉ nhằm mục đích tham khảo; nếu có
|
||||
khác biệt, bản tiếng Anh được ưu tiên áp dụng."*
|
||||
|
||||
**Where the text lives.** The canonical wording is the shipped components,
|
||||
`src/components/legal/{Disclaimer,Privacy,Terms,Trademarks,ThirdParty,
|
||||
AiDisclosure}.astro` — EN and VI in the same file, so a change to one is
|
||||
visibly a change to the other in review — wrapped by `LegalPage.astro`
|
||||
(title, "Last updated", VI notice). Addresses come from
|
||||
`src/lib/contacts.ts`. The drafts below are the approved texts (H6,
|
||||
2026-07-28; the AI Disclosure 2026-07-30), kept as the record and
|
||||
corrected here only where facts changed: the contact addresses (D27), the
|
||||
Privacy Policy and Terms — which v1.1 rewrote and which are therefore
|
||||
**summarised** below instead of quoted — the third-party page's new
|
||||
sections and the AI Disclosure's model list. The shipped Disclaimer and
|
||||
Trademarks also carry small v1.1 wording fixes the drafts do not; for exact
|
||||
wording, read the component.
|
||||
|
||||
### 3a. Disclaimer — `/legal/disclaimer`
|
||||
|
||||
**EN.** SoftHarbor is an independent, non-commercial directory of desktop
|
||||
@@ -85,8 +176,12 @@ our check. Always download from official sources, verify signatures or
|
||||
checksums where offered, and use your own judgment. (5) **Your risk:**
|
||||
installing third-party software is entirely at your own risk; to the
|
||||
maximum extent permitted by law we accept no liability for damages arising
|
||||
from software you obtain via links on this site. (6) Report dangerous or
|
||||
incorrect listings: GitHub issues or `contact@softharbor.net`.
|
||||
from software you obtain via links on this site. (6) **Reporting a
|
||||
listing:** a dangerous one — a hijacked, look-alike or malicious download
|
||||
link — goes privately to `security@poli0981.dev`, not to a public issue, so
|
||||
the bad link is not spread further; outdated or wrong information goes to an
|
||||
issue on the GitLab mirror (a GitHub issue until 2026-11-24, D38); a developer who wants their entry changed or removed writes
|
||||
to `takedown@poli0981.dev`.
|
||||
|
||||
**VI.** SoftHarbor là trang tổng hợp phần mềm desktop độc lập, phi thương
|
||||
mại. (1) **Không liên kết:** chúng tôi không liên kết, không được bảo trợ
|
||||
@@ -103,84 +198,110 @@ Phần mềm có thể bị xâm phạm sau thời điểm kiểm tra. Hãy luô
|
||||
chính thức, xác minh chữ ký/checksum nếu có, và tự cân nhắc. (5) **Rủi ro
|
||||
của bạn:** việc cài đặt phần mềm bên thứ ba hoàn toàn thuộc rủi ro của bạn;
|
||||
trong phạm vi tối đa pháp luật cho phép, chúng tôi không chịu trách nhiệm
|
||||
cho thiệt hại phát sinh. (6) Báo cáo mục nguy hiểm/sai: GitHub issues hoặc
|
||||
`contact@softharbor.net`.
|
||||
cho thiệt hại phát sinh. (6) **Báo cáo một mục:** mục nguy hiểm — liên kết
|
||||
tải về bị chiếm quyền, giả mạo hoặc độc hại — hãy báo riêng tới
|
||||
`security@poli0981.dev`, đừng mở issue công khai, để liên kết xấu không bị
|
||||
lan rộng thêm; thông tin lỗi thời hoặc sai hãy báo qua issue trên bản sao
|
||||
GitLab của dự án; nhà
|
||||
phát triển muốn sửa hoặc gỡ mục của mình có thể viết tới
|
||||
`takedown@poli0981.dev`.
|
||||
|
||||
### 3b. Privacy Policy — `/legal/privacy`
|
||||
|
||||
**EN.** Short version: we collect nothing. (1) **No accounts, no forms, no
|
||||
analytics, no ads, no cookies.** (2) **Local preferences only:** language,
|
||||
theme, and legal-acceptance version are stored in your browser's
|
||||
localStorage (`sh:lang`, `sh:theme`, `sh:legal`) and never transmitted;
|
||||
clearing site data removes them. A service worker caches a small offline
|
||||
page. (3) **Infrastructure:** the site is served by Cloudflare, which
|
||||
processes connection data (such as IP addresses) as a network provider
|
||||
under its own privacy policy. We do not receive or store this data;
|
||||
aggregate request counts are visible to us in Cloudflare's dashboard.
|
||||
(4) **Bug reports:** the "Report a bug" button opens a **prefilled GitHub
|
||||
issue in your browser** containing the page URL, your browser/OS string,
|
||||
and recent console error lines from this site. Nothing is sent until you
|
||||
review and submit it on GitHub, under GitHub's terms and privacy policy.
|
||||
(5) **Third-party links** lead to sites with their own policies.
|
||||
(6) **Changes** to this policy bump the version date and re-show the
|
||||
consent gate. Contact: `contact@softharbor.net`.
|
||||
**Rewritten 2026-10-21 (v1.1) — summary of the shipped text; exact EN and
|
||||
VI wording in `Privacy.astro`.** The v1.0 draft ("we collect nothing … no
|
||||
analytics") stopped being true with D25/D26 and is not reproduced here
|
||||
(git history has it). Section anchors are stable — the gate links
|
||||
`#turnstile`:
|
||||
|
||||
**VI.** Phiên bản ngắn gọn: chúng tôi không thu thập gì. (1) **Không tài
|
||||
khoản, không biểu mẫu, không analytics, không quảng cáo, không cookie.**
|
||||
(2) **Chỉ lưu tuỳ chọn cục bộ:** ngôn ngữ, giao diện sáng/tối và phiên bản
|
||||
điều khoản đã chấp nhận được lưu trong localStorage của trình duyệt
|
||||
(`sh:lang`, `sh:theme`, `sh:legal`), không bao giờ được truyền đi; xoá dữ
|
||||
liệu trang sẽ xoá chúng. Service worker lưu một trang offline nhỏ. (3) **Hạ
|
||||
tầng:** trang được phục vụ bởi Cloudflare — đơn vị xử lý dữ liệu kết nối
|
||||
(như địa chỉ IP) theo chính sách riêng của họ với vai trò nhà cung cấp hạ
|
||||
tầng. Chúng tôi không nhận hay lưu dữ liệu này; chỉ thấy số liệu truy cập
|
||||
tổng hợp trong bảng điều khiển Cloudflare. (4) **Báo lỗi:** nút "Report a
|
||||
bug" mở một **issue GitHub được điền sẵn trong trình duyệt của bạn** gồm
|
||||
URL trang, chuỗi trình duyệt/hệ điều hành và các dòng lỗi console gần đây
|
||||
của trang này. Không có gì được gửi đi cho tới khi bạn xem lại và tự đăng
|
||||
trên GitHub, theo điều khoản và chính sách của GitHub. (5) **Liên kết bên
|
||||
thứ ba** có chính sách riêng. (6) **Thay đổi** chính sách sẽ cập nhật ngày
|
||||
phiên bản và hiển thị lại hộp thoại chấp nhận. Liên hệ: `contact@softharbor.net`.
|
||||
- **Short version** — no accounts, no ads, no cookies, nothing sold or
|
||||
shared for advertising; two Cloudflare services see limited data —
|
||||
statistics that skip you under Global Privacy Control, and a bot check
|
||||
that runs only after you accept; your settings stay in your browser.
|
||||
- **`#who`** — the operator: an individual developer, poli0981
|
||||
(SkullMute), in Vietnam, who decides how the little data described is
|
||||
handled; questions to `privacy@poli0981.dev`.
|
||||
- **`#storage`** — localStorage `sh:legal`, `sh:human`, `sh:lang`,
|
||||
`sh:theme`, `sh:scrollbar`, `sh:motion`, `sh:keys` (v1.4), never sent
|
||||
anywhere; a service
|
||||
worker stores the offline page, styles and fonts; no cookies (docs/09 §8).
|
||||
- **`#analytics`** — Cloudflare Web Analytics: no cookies, nothing stored
|
||||
in the browser; reports page address, referrer, load timings and
|
||||
user-agent; Cloudflare derives a country and shows us totals only, never
|
||||
individual visits or IPs. Never runs under Global Privacy Control, nor
|
||||
on any host but softharbor.net. Basis: legitimate interest.
|
||||
- **`#turnstile`** — after acceptance only, once; runs in a frame from
|
||||
challenges.cloudflare.com; the one-time token goes to `/api/verify`,
|
||||
which forwards it with the IP to Siteverify; requests are counted per IP
|
||||
(per /64 for IPv6) for one minute to prevent abuse; the endpoint logs only
|
||||
success and duration. A pass is remembered 48 h (`sh:human`); if the
|
||||
check cannot run the visitor is let in and it is retried after an hour.
|
||||
Basis: legitimate interest.
|
||||
- **`#rate-limit`** *(2026-10-26, D32)* — the site's own code counts
|
||||
requests for pages, feeds and data per IP (per /64 for IPv6) over a few
|
||||
seconds; a network far above any reader's pace gets a "Too many
|
||||
requests" page until the window passes; counts live only in
|
||||
Cloudflare's rate limiter for that window; no address is recorded — a
|
||||
refusal is logged without it. Basis: legitimate interest. Also one
|
||||
sentence in the short version.
|
||||
- **`#hosting`** — Cloudflare serves the site and the endpoint and
|
||||
processes connection data under its own policy; we see aggregate counts.
|
||||
- **`#email`** — `@poli0981.dev` mail is delivered to a Google-hosted
|
||||
mailbox; used only to deal with what was written; deleted when no longer
|
||||
needed, or sooner on request.
|
||||
- **`#bug-reports`** — "Report a bug" is a link to a new, prefilled issue
|
||||
on the GitLab mirror: **GitLab receives** the page URL, user-agent and
|
||||
recent error lines **as soon as the link is opened**; nothing is filed
|
||||
until the visitor submits it. (GitHub until 2026-11-24 — the change that
|
||||
moved `LEGAL_VERSION` to 2026-11-24, D38.)
|
||||
- **`#links`** — developers' sites have their own policies.
|
||||
- **`#rights`** — Global Privacy Control turns statistics off; blocking
|
||||
challenges.cloudflare.com still lets you in; clearing site data removes
|
||||
everything stored; access, correction, deletion or objection via
|
||||
`privacy@poli0981.dev`; the right to complain to a data protection
|
||||
authority.
|
||||
- **`#changes`** — a change moves the date and the gate asks everyone to
|
||||
accept the new version.
|
||||
|
||||
### 3c. Terms of Use — `/legal/terms`
|
||||
|
||||
**EN.** (1) **Acceptance:** using `https://softharbor.net` means you accept these
|
||||
terms, the Disclaimer, and the Privacy Policy; the consent dialog records
|
||||
acceptance in your browser. (2) **The service:** an informational directory
|
||||
of links and metadata; no downloads are hosted; availability is not
|
||||
guaranteed and the service may change or stop at any time. (3) **Acceptable
|
||||
use:** no scraping at abusive rates (the public dataset at `/api/apps.json`
|
||||
exists — use it), no attempts to disrupt the service, no misrepresentation
|
||||
of SoftHarbor as affiliated with listed vendors. (4) **Intellectual
|
||||
property:** site code is GPL-3.0-only; the dataset is CC BY-SA 4.0 (see
|
||||
LICENSE-DATA); third-party names/logos remain their owners' property.
|
||||
(5) **No warranty / limitation of liability:** the service is provided "as
|
||||
is" without warranties of any kind; to the maximum extent permitted by law,
|
||||
the operator is not liable for any damages arising from use of the service
|
||||
or of third-party software reached through it. (6) **Changes:** material
|
||||
changes bump the version and re-show the consent dialog. (7) **Governing
|
||||
law:** the laws of Vietnam, without regard to conflict-of-law rules; if a
|
||||
provision is unenforceable, the remainder stands. Contact:
|
||||
`contact@softharbor.net`.
|
||||
**Revised 2026-10-21 (v1.1) — clause summary of the shipped text; exact EN
|
||||
and VI wording in `Terms.astro`.** The approved v1.0 clauses (1)–(7) stand
|
||||
in substance; v1.1 added the operator, the bot check and a
|
||||
copyright-complaint procedure, and changed the contact. Shipped order:
|
||||
|
||||
**VI.** (1) **Chấp nhận:** việc sử dụng `https://softharbor.net` đồng nghĩa bạn chấp
|
||||
nhận các điều khoản này, Tuyên bố miễn trừ và Chính sách quyền riêng tư;
|
||||
hộp thoại đồng ý ghi nhận việc chấp nhận trong trình duyệt của bạn.
|
||||
(2) **Dịch vụ:** trang thông tin tổng hợp liên kết và siêu dữ liệu; không
|
||||
lưu trữ tệp tải về; không bảo đảm tính khả dụng; dịch vụ có thể thay đổi
|
||||
hoặc dừng bất kỳ lúc nào. (3) **Sử dụng hợp lệ:** không scrape với tần suất
|
||||
gây hại (đã có bộ dữ liệu công khai tại `/api/apps.json` — hãy dùng nó),
|
||||
không phá hoại dịch vụ, không mạo nhận SoftHarbor liên kết với các nhà phát
|
||||
triển được liệt kê. (4) **Sở hữu trí tuệ:** mã nguồn theo GPL-3.0-only; bộ
|
||||
dữ liệu theo CC BY-SA 4.0 (xem LICENSE-DATA); tên/logo bên thứ ba thuộc chủ
|
||||
sở hữu tương ứng. (5) **Không bảo đảm / giới hạn trách nhiệm:** dịch vụ
|
||||
cung cấp "nguyên trạng" không kèm bất kỳ bảo đảm nào; trong phạm vi tối đa
|
||||
pháp luật cho phép, người vận hành không chịu trách nhiệm cho thiệt hại
|
||||
phát sinh từ việc dùng dịch vụ hoặc phần mềm bên thứ ba truy cập qua dịch
|
||||
vụ. (6) **Thay đổi:** thay đổi trọng yếu sẽ nâng phiên bản và hiển thị lại
|
||||
hộp thoại đồng ý. (7) **Luật áp dụng:** pháp luật Việt Nam; nếu một điều
|
||||
khoản vô hiệu, các điều khoản còn lại vẫn giữ hiệu lực. Liên hệ:
|
||||
`contact@softharbor.net`.
|
||||
1. **`#operator` — Who we are:** `https://softharbor.net` ("SoftHarbor") is
|
||||
a non-commercial project run by an individual developer, poli0981
|
||||
(SkullMute), in Vietnam — "we" or "the operator".
|
||||
2. **Acceptance:** using the site means accepting these terms, the
|
||||
Disclaimer and the Privacy Policy; the consent dialog records acceptance
|
||||
in the browser, *then runs the automatic bot check the Privacy Policy
|
||||
describes*.
|
||||
3. **The service:** an informational directory of links and metadata; no
|
||||
downloads hosted; availability not guaranteed; may change or stop.
|
||||
4. **Acceptable use:** no scraping at abusive rates (use
|
||||
`/api/apps.json`), no attempts to disrupt the service **or to get past
|
||||
its bot check by automated means**, no misrepresentation of SoftHarbor
|
||||
as affiliated with listed vendors.
|
||||
5. **Intellectual property:** code GPL-3.0-only; dataset CC BY-SA 4.0
|
||||
(LICENSE-DATA); third-party names and logos remain their owners'
|
||||
(Trademarks).
|
||||
6. **`#copyright` — Copyright complaints:** email `dmca@poli0981.dev` with
|
||||
the work owned; the material and its address on the site; name and
|
||||
contact details; a good-faith statement that the use is not authorised;
|
||||
a statement that the notice is accurate and the sender owns the right or
|
||||
may act for its owner; a signature (a typed full name is enough). We
|
||||
remove or disable the material promptly and tell whoever added it, who
|
||||
may counter-notify to the same address. A developer wanting a listing or
|
||||
logo changed writes to `takedown@poli0981.dev` instead.
|
||||
7. **No warranty / limitation of liability:** "as is"; to the maximum
|
||||
extent permitted by law the operator is not liable for damages from the
|
||||
service or third-party software reached through it.
|
||||
8. **Changes:** material changes bump the version and re-show the consent
|
||||
dialog (Part 2 policy).
|
||||
9. **Governing law:** Vietnam, without regard to conflict-of-law rules;
|
||||
an unenforceable provision leaves the rest standing.
|
||||
10. **Contact:** `legal@poli0981.dev`.
|
||||
|
||||
### 3d. Trademarks — `/legal/trademarks`
|
||||
|
||||
@@ -194,7 +315,8 @@ vector marks, no distortion), at reasonable UI sizes, next to accurate
|
||||
information, sourced from the Simple Icons set or the vendor's official
|
||||
brand assets. "SoftHarbor" and the SoftHarbor wordmark identify this
|
||||
project. **Takedown:** if you own a mark and want its use changed or
|
||||
removed, email `contact@softharbor.net` or open a GitHub issue — we comply
|
||||
removed, email `takedown@poli0981.dev` or open an issue on our GitLab
|
||||
mirror — we comply
|
||||
promptly and remove the entry's logo (or the entry) while discussing.
|
||||
|
||||
**VI.** Mọi tên sản phẩm, thương hiệu và logo trên SoftHarbor là nhãn hiệu
|
||||
@@ -206,7 +328,7 @@ biến dạng), ở kích thước hợp lý, đi kèm thông tin chính xác, l
|
||||
Simple Icons hoặc bộ nhận diện chính thức của nhà phát triển. "SoftHarbor"
|
||||
và wordmark SoftHarbor nhận diện dự án này. **Yêu cầu gỡ bỏ:** nếu bạn là
|
||||
chủ sở hữu nhãn hiệu và muốn thay đổi/gỡ việc sử dụng, hãy email
|
||||
`contact@softharbor.net` hoặc mở GitHub issue — chúng tôi sẽ xử lý nhanh chóng và
|
||||
`takedown@poli0981.dev` hoặc mở issue trên bản sao GitLab của dự án — chúng tôi sẽ xử lý nhanh chóng và
|
||||
tạm gỡ logo (hoặc mục liên quan) trong quá trình trao đổi.
|
||||
|
||||
### 3e. Third-Party Notices — `/legal/third-party`
|
||||
@@ -221,11 +343,22 @@ asset dependencies and their licenses:
|
||||
| Simple Icons | CC0-1.0 | **Caveat shown verbatim:** the icons are CC0, but the brands they depict remain trademarks of their owners; see /legal/trademarks |
|
||||
| Bricolage Grotesque · Be Vietnam Pro · IBM Plex Mono | SIL OFL 1.1 | self-hosted via Fontsource |
|
||||
|
||||
Full machine-generated dependency list ships as `/legal/third-party`
|
||||
appendix regenerated each release (`pnpm licenses list` → build step).
|
||||
**VI intro.** SoftHarbor được xây dựng trên phần mềm mã nguồn mở; bảng trên
|
||||
liệt kê thành phần và giấy phép; danh sách đầy đủ được tạo tự động mỗi bản
|
||||
phát hành.
|
||||
Since v1.1 the page has two more sections. **`#services`** — the services
|
||||
that receive requests while the site is used, each with a link to its own
|
||||
privacy policy: Cloudflare (hosting and delivery, the `/api/verify`
|
||||
endpoint, Web Analytics, Turnstile) and GitLab (since D38: the public
|
||||
mirror of the repository, issues, the prefilled bug-report issue — the
|
||||
source itself is on the owner's Gitea; GitHub held all three until
|
||||
2026-11-24). **`#packages` — "Every package in this
|
||||
build"**: each `dependencies` entry of `package.json` with its *installed*
|
||||
version and the license it declares, generated at **build time** by
|
||||
`src/lib/licenses.ts` (server-only, read from `node_modules`), so it cannot
|
||||
fall behind the code. (v1.0 promised "a full machine-generated dependency
|
||||
list" and shipped none; `pnpm licenses list` was never wired.) Licensing
|
||||
questions: `copyright@poli0981.dev`.
|
||||
**VI intro.** SoftHarbor được xây dựng trên phần mềm mã nguồn mở. Các thành
|
||||
phần và giấy phép tương ứng: (same table; the services and package
|
||||
sections follow, in Vietnamese).
|
||||
|
||||
### 3f. AI Disclosure — `/legal/ai-disclosure`
|
||||
|
||||
@@ -235,16 +368,22 @@ they cannot see how the list was assembled. It also backs Part 1: the dataset
|
||||
can only carry CC BY-SA 4.0 because the summaries are the project's own words
|
||||
(hard rule 8), and saying so plainly is stronger than leaving it implied.
|
||||
|
||||
Must name the **model, its version identifier, and its developer** — currently
|
||||
Claude Opus 5 (`claude-opus-5`), Anthropic, used through Claude Code.
|
||||
Must name **each model whose work lands, its version identifier, and its
|
||||
developer** — currently Claude models by Anthropic, used through Claude
|
||||
Code: **Claude Opus 5** (`claude-opus-5`) for the site and catalogue
|
||||
through v1.0, and **Claude Opus 5.5** (`claude-opus-5-5`) for the v1.1–v1.3
|
||||
work of October 2026 and the v1.4 work of November 2026; no other AI system
|
||||
contributed. Every claim on the page
|
||||
must stay literally true — update it when a process changes (two false
|
||||
claims were corrected on 2026-10-21).
|
||||
|
||||
| Area | Position |
|
||||
| Area | Position (as shipped, v1.2) |
|
||||
|---|---|
|
||||
| Source code | AI-assisted, maintainer-reviewed, same automated gates as any change |
|
||||
| Tests | AI-drafted, kept only once seen to fail on the bug they claim to cover |
|
||||
| Finding the software | Candidate list AI-assisted; **inclusion is a human decision** against docs/00 §3, links machine-checked per PR and weekly |
|
||||
| Source code | AI-assisted, reviewed and run by the maintainer; the same automated gates as any change — lint, type-check, unit and browser tests, schema validation, EN/VI parity, a build, a CSP guard |
|
||||
| Tests | Drafted with AI assistance, reviewed against the behaviour they describe; run on every change, and nothing merges while one fails |
|
||||
| Finding the software | Candidate list AI-assisted; **inclusion is a human decision** against docs/00 §3; links machine-checked per PR (changed entries) and weekly (whole catalogue), with "forbidden"/"too many requests" counted as reachable |
|
||||
| Summaries | Written from scratch in both locales, never pasted; VI reviewed by a native speaker, not machine-translated |
|
||||
| Security status | **Not AI-decided** — maintainer runs docs/09 §6, and the scan is linked from the app page |
|
||||
| Security status | **Not AI-decided** — "no known warnings" only after the maintainer ran docs/09 §6; from then on `vt-recheck.yml` re-scans every download page on VirusTotal at least every 90 days and moves the date (a fixed rule, not a model: any warning drops the entry to "unverified" and opens an issue; only the maintainer marks clean, flags or removes). The scan is linked from the app page; where a link changed after its scan, the linked scan is of the earlier link until the next re-check. Updated 2026-10-23 (`LEGAL_UPDATED.aiDisclosure`; not an accepted document, so `LEGAL_VERSION` and the gate are unchanged) |
|
||||
|
||||
Closes with the limits being unchanged: AI assistance is neither a warranty
|
||||
nor an excuse, and a mistake here belongs to the maintainer, not a tool.
|
||||
@@ -253,17 +392,66 @@ nor an excuse, and a mistake here belongs to the maintainer, not a tool.
|
||||
Disclaimer, Terms and Privacy only; this page is informational and is reached
|
||||
from the footer. It is still gate-exempt like every other `/legal/*` route.
|
||||
|
||||
### 3g. Accessibility Statement — `/legal/accessibility`
|
||||
|
||||
Added 2026-11-09 (D33, v1.4). The visitor-facing twin of `ACCESSIBILITY.md`
|
||||
at the repository root:
|
||||
the two must state the same target, test record, limitations and response
|
||||
times — change one, change the other in the same PR. Plain language, user
|
||||
experiences rather than criterion numbers; English canonical, Vietnamese a
|
||||
full translation. Informational, **not accepted**, gate-exempt, linked from
|
||||
the footer's legal column and from the Contact page's accessibility row.
|
||||
|
||||
Sections (anchors stable — the issue form and ACCESSIBILITY.md link them):
|
||||
|
||||
- **intro** — who the site should work for (keyboard only, screen reader,
|
||||
magnification, voice control, high-contrast themes).
|
||||
- **`#target`** — WCAG 2.2 AA as a *target*, explicitly not a conformance
|
||||
claim; no independent audit has been done.
|
||||
- **`#features`** — keyboard and skip link, semantic structure and `lang`,
|
||||
tested contrast (7:1 / 4.5:1 / 3:1), nothing by colour alone, the display
|
||||
menu (theme, motion, scrollbar, the "/" switch), system reduced motion
|
||||
and forced colours, 200 % zoom and reflow, announced result counts, no
|
||||
images of text.
|
||||
- **`#tested`** — automated on every change (axe WCAG 2.0–2.2 A/AA, both
|
||||
themes, desktop and phone, keyboard/reflow/forced-colour/contrast tests);
|
||||
by hand 2026-11-09 (keyboard only + Narrator, Windows 11, Chrome, Brave,
|
||||
Firefox); not yet: NVDA, JAWS, VoiceOver, TalkBack, Safari.
|
||||
- **`#limitations`** — Turnstile (third party; fails open after 10 s, or
|
||||
120 s once it asks for a click), vendor sites, two-line card summaries,
|
||||
VI legal pages being translations.
|
||||
- **`#report`** — `accessibility@poli0981.dev` (no account needed) or the
|
||||
Accessibility issue form; what helps; screenshots optional; never asks
|
||||
about disability; English or Vietnamese.
|
||||
- **`#response`** — one maintainer, so modest promises: reply within
|
||||
7 days; Critical 30 days, Serious 60, Moderate/Minor 90; a slip gets a
|
||||
reason, a workaround and a new date.
|
||||
- **`#contributors`** — points to ACCESSIBILITY.md.
|
||||
|
||||
## Part 4 — Review checklist for Kokone (H6)
|
||||
|
||||
- [ ] Confirm `contact@softharbor.net` is live (Email Routing, docs/16 §6)
|
||||
and a test mail arrives before these pages publish (H5).
|
||||
- [ ] Confirm governing-law choice (Vietnam) in Terms §7.
|
||||
- [ ] Confirm the no-decline-button gate wording is acceptable.
|
||||
H6 approved the drafts on 2026-07-28. The 2026-10-21 rewrite (Privacy,
|
||||
Terms, contacts, AI Disclosure) re-opens these items — sign-off on it:
|
||||
⚠ verify.
|
||||
|
||||
- [ ] Confirm the D27 addresses are live and a test mail to each purpose
|
||||
address arrives (the old `contact@softharbor.net` / Email Routing
|
||||
plan of H5 is superseded — docs/16 §6).
|
||||
- [ ] Confirm governing-law choice (Vietnam) in Terms (clause 9 since
|
||||
v1.1; §7 in the v1.0 draft).
|
||||
- [ ] Confirm the no-decline-button gate wording is acceptable, and the
|
||||
step-2 wording about Turnstile.
|
||||
- [ ] Confirm the Privacy Policy's legitimate-interest basis for Web
|
||||
Analytics and Turnstile, and its rights section.
|
||||
- [ ] Confirm the copyright-complaint procedure (Terms `#copyright`) and
|
||||
the operator clause (`#operator`).
|
||||
- [ ] Read both language versions aloud once — tone: calm, plain, no
|
||||
legalese beyond necessity.
|
||||
- [ ] Confirm comfort with C3 free-tier ruling as written in Disclaimer
|
||||
context (pricing can change → covered by 3a(3)).
|
||||
- [ ] Set `LEGAL_VERSION` to the approval date; if drafts change later,
|
||||
bump it (gate re-shows).
|
||||
- [ ] `LEGAL_VERSION` follows the Part 2 policy (2026-10-26 as of v1.3); a
|
||||
later material change to Disclaimer, Terms or Privacy bumps it, and
|
||||
`legal.test.ts` fails if one is dated after it.
|
||||
- [ ] Optional (recommended eventually): a qualified local review of Terms
|
||||
+ Disclaimer. These templates are diligent but are not legal advice.
|
||||
+ Disclaimer + Privacy. These texts are diligent but are not legal
|
||||
advice.
|
||||
@@ -10,30 +10,92 @@
|
||||
| **M3 — Find things** | search index route, ShSearch, ShFilterSheet, sort, nanostores (05) | S2 vectors pass in-app; filters compose; no-JS grid intact | 3 d | ✅ |
|
||||
| **M4 — Trust layer** | legal gate, legal pages ×2 locales, security lines, ShLangSwitch, ShThemeToggle (07, 14) | gate passes S4 checks; parity CI green | 3 d | ✅ |
|
||||
| **M5 — Resilience & pipes** | 404/offline/PWA, dormant errors, /api/apps.json, rss, bug-report button, _headers (08, 09) | launch-checklist infra section fully green | 2–3 d | ✅ |
|
||||
| **M6 — Ship** | CI/CD wiring, branch protection, 30 seed apps, checklist, v1.0.0 (12, 13) | public announcement sent | 3–4 d | ◐ infra done; data + tag + announcement open |
|
||||
| **M6 — Ship** | CI/CD wiring, branch protection, 30 seed apps, checklist, v1.0.0 (12, 13) | public announcement sent | 3–4 d | ✅ 2026-07-30 — v1.0.0 tagged and released with 326 apps |
|
||||
| **M7 — v1.1 review** | post-launch audit: native view transitions, CSP-first head, Harbor UI, display menu, search/URL state, data rules, Playwright e2e, Dependabot; Turnstile + `/api/verify` Worker (D25), Web Analytics (D26), contacts (D27), legal rewrite (all docs) | every gate green in CI; production verified after merge (docs/13 §3) | — | ✅ 2026-10-21 — PRs #23–#25 merged and deployed; v1.1.0 released |
|
||||
| **M8 — v1.2 upkeep** | VirusTotal re-check automation (D30), SonarQube Cloud CI analysis with coverage (D29), Node 26 + TypeScript 6/7 (D28), catalogue batch 2 + two categories (D31) | every gate green in CI, Sonar gate passed; production verified after each merge (docs/13 §3) | — | ✅ 2026-10-23 — PRs #28 #29 #30 #31 #32 and the release PR merged; v1.2.0 released |
|
||||
|
||||
Total ≈ 17–20 focused days, **plus ~1 day for the `softharbor.net` domain
|
||||
package** (docs/16 §10) slotted between M5 and M6. Data entry (M6)
|
||||
parallelizes with earlier milestones once M2 lands.
|
||||
|
||||
**Where it stands (2026-07-28).** `https://softharbor.net` is live and every
|
||||
automated gate is green — `lint · i18n:check · validate:data · test · check ·
|
||||
build · check:styles · knip`, 55 pages from 5 entries, CI and CodeQL passing,
|
||||
deploys handled by Cloudflare Workers Builds on push to `main` (docs/12 §3).
|
||||
**M6 is not closed**: the dataset is 5 of the ~32 seed entries and every one is
|
||||
`security.status: "unverified"`, so **v1.0.0 is deliberately untagged** — see
|
||||
§5. The remaining work is curation and repo settings, not code.
|
||||
**Where it stands (2026-11-24).** **Maintenance mode** since v1.4.1,
|
||||
released 2026-11-15 (D36): the catalogue, fixes and platform upkeep
|
||||
continue; new features do not, and §2's feature items are frozen. **390
|
||||
apps in 15 categories**, 379 `clean` and 11 `unverified` (batch 4,
|
||||
D39, added 15 Windows essentials and Local AI apps). Since D38 the
|
||||
repository lives on the owner's Gitea, CI runs on Gitea Actions and
|
||||
production deploys from CI's `deploy` job; Renovate, the ops security
|
||||
checks and Qodana do what Dependabot, CodeQL and SonarQube Cloud did.
|
||||
|
||||
*Where it stood (2026-11-15), for the record:* v1.4.1 — maintenance mode
|
||||
(D36); 373 apps in 15 categories, 364 `clean` and 9 `unverified`; Qodana
|
||||
joined CodeQL and SonarQube Cloud (D35).
|
||||
|
||||
*Where it stood (2026-11-09), for the record:* v1.4.0, released 2026-11-09 — the
|
||||
accessibility release (D33, D34): **373 apps in 15 categories**, 364 `clean`
|
||||
and 9 `unverified`, an Accessibility Statement and `ACCESSIBILITY.md`, and
|
||||
WCAG 2.2 AA as the target. v1.3.0 (2026-10-26) added the site-wide rate
|
||||
limit (D32).
|
||||
|
||||
*Where it stood (2026-10-23), for the record:* v1.2.0, released 2026-10-23: **364 apps in
|
||||
14 categories**, 341 `clean` and 23 `unverified` — each with its VirusTotal
|
||||
scan linked and re-scanned at least every 90 days by `vt-recheck.yml`
|
||||
(D30; nine popular apps went `unverified` on a single engine's warning in
|
||||
the first run and wait for the maintainer's triage, issues #33–#41). CI adds
|
||||
a `sonar` job (D29) and type-checks `.ts` with TypeScript 7 (D28); the
|
||||
build covers 781 pages.
|
||||
|
||||
*Where it stood (2026-10-21), for the record:* v1.0.0 shipped on 2026-07-30: 326 apps in
|
||||
12 categories, 320 `clean` and 6 held at `unverified`, every one with its
|
||||
scan linked. v1.1.0 (`package.json` 1.1.0, CHANGELOG.md), released on
|
||||
2026-10-21, is the post-launch review recorded in §4's 2026-10-21 rows.
|
||||
Every automated gate is green in
|
||||
CI: `lint · check · coverage (ratchet) · build` — which itself runs
|
||||
`validate:data · i18n:check · astro build · postbuild:html · check:csp ·
|
||||
check:assets · check:sw · check:feed` over 701 pages — `· wrangler deploy
|
||||
--dry-run · knip · e2e (Playwright + axe)`, plus the `gates` job and
|
||||
CodeQL. Deploys are Cloudflare Workers Builds (docs/12 §3): serialized, so
|
||||
a merge is verified in production only after its build check is green
|
||||
(docs/13 §3). What remains is settings and sign-offs (§5), not code.
|
||||
|
||||
*Where it stood (2026-07-28), for the record:* live, gates green, 55 pages
|
||||
from 5 entries, all `unverified` — v1.0.0 deliberately untagged until the
|
||||
data was seeded and vetted.
|
||||
|
||||
## 2. Post-v1 backlog (ordered by current intent)
|
||||
|
||||
**Frozen by D36 (2026-11-15) — maintenance mode.** The feature items —
|
||||
3–7, 12–15 and the feature half of 16 (OpenSearch, a versioned `/api/v1`)
|
||||
— are not started while D36 stands, and issues or PRs that propose them
|
||||
are closed as *not planned*. Maintenance stays open: 8 (Lighthouse CI and
|
||||
a size budget — gates, not features), 11 (data hygiene, fixed in the
|
||||
data), the TypeScript 7 half of 16, the rest of 17 (a recorded NVDA and
|
||||
VoiceOver pass, and fixing what it finds), and 1 and 9 on evidence only —
|
||||
an attack, or `/apps` past its budget. Lifting D36 is the owner's call and
|
||||
its own decision-log entry; the order below is kept for the record.
|
||||
|
||||
**Next up after v1.1 (agreed 2026-10-21), in this order:** item 2 first —
|
||||
it has a deadline — then 10 → 11 → 12 (with 3) → 13 → 14 → 15 → 16. The
|
||||
rest wait for evidence. Item numbers are stable because other docs cite
|
||||
them (item 9 especially), so new work is appended, never renumbered.
|
||||
|
||||
1. **Zone upgrades on evidence, not by default** — revisit the
|
||||
deliberately-OFF trio (rate limiting, Bot Fight Mode, Pro-zone Custom
|
||||
Errors) only if abuse or 403/429 UX ever becomes real (docs/16 §9);
|
||||
plus the `?q=` search deep-link that would unlock a `SearchAction`
|
||||
JSON-LD node (docs/16 §7).
|
||||
2. **VirusTotal automation** — scheduled workflow scanning `links.download`
|
||||
via VT API, writing `evidence` + opening flag issues on detections
|
||||
(turns docs/09 §6.5 from manual to assisted).
|
||||
Errors) only if abuse or 403/429 UX ever becomes real (docs/16 §9) —
|
||||
*rate limiting done another way on 2026-10-26: in the Worker, with our
|
||||
own 429 page (D32); the zone rule is now an optional edge layer, §9.1*;
|
||||
plus a `SearchAction` JSON-LD node (docs/16 §7) — its prerequisite, the
|
||||
`/apps?q=` deep link, **shipped in v1.1** (`src/lib/urlstate.ts`).
|
||||
2. ~~**VirusTotal automation — deadline 2027-01-26.**~~ **Done 2026-10-23
|
||||
(D30, docs/12 §4b):** `vt-recheck.yml` re-scans every check older than
|
||||
90 days daily, inside the Public API limits, into one accumulating
|
||||
signed-commit PR that dispatches `ci.yml`/`codeql.yml`; a detection drops
|
||||
`clean` to `unverified` and opens an issue (a confirmed one goes through
|
||||
`pnpm quarantine`, never deletion); dispatched on a data branch it scans a
|
||||
PR's new entries first. The drifted scans turned out to be 8, not ~11
|
||||
(dosbox-staging, forklift, netbird, nomacs, unity scanned an earlier
|
||||
link; beeper, spyder, nextcloud-desktop a trailing-slash variant) — the
|
||||
other six suspected ones were `#fragment` links, which VirusTotal drops.
|
||||
3. **Install-command snippets** — optional `install.winget` /
|
||||
`install.brew` fields rendered as copy buttons.
|
||||
4. **Favorites** — localStorage star + "my list" view (stays static).
|
||||
@@ -42,7 +104,11 @@ deploys handled by Cloudflare Workers Builds on push to `main` (docs/12 §3).
|
||||
EN/VI/JP baseline of PhantomMAC/IconForge.
|
||||
7. **Community data automation** — app_request issues auto-drafting data
|
||||
PRs for maintainer review.
|
||||
8. Playwright smoke pack if island count grows past six.
|
||||
8. ~~Playwright smoke pack if island count grows past six.~~ **Done in
|
||||
v1.1** without the island count changing — the bugs that shipped were
|
||||
CSP refusals, dialogs and overflow only a real browser shows (docs/11
|
||||
§5). Still open from the quality bar: Lighthouse CI and a `size-limit`
|
||||
budget (docs/13 §2).
|
||||
9. **Grid pagination — triggered by size, not by date.** `/apps` server-renders
|
||||
every card and filters by toggling `hidden` (docs/05 §A3), which is what
|
||||
keeps the no-JS experience whole. That trade stops paying somewhere around
|
||||
@@ -51,7 +117,60 @@ deploys handled by Cloudflare Workers Builds on push to `main` (docs/12 §3).
|
||||
(docs/00 §2.5). **Trigger:** when the dataset passes 250 apps, or `/apps`
|
||||
HTML passes 200 KB gzip, paginate or virtualize — and keep a full
|
||||
unpaginated listing reachable for no-JS users. Revisit before the count
|
||||
gets there, not after.
|
||||
gets there, not after. *Re-measured 2026-10-21 on a local v1.1 build:
|
||||
`/apps` 119.0 KB gzip (~1.24 MB raw), `/vi/apps` 125.3 KB — up from
|
||||
112.2 / 116.9 KB on 2026-07-29, still inside the 200 KB budget; cards
|
||||
use `content-visibility: auto` so off-screen ones cost no layout.*
|
||||
10. ~~**Catalogue batch 2 (~40 apps).**~~ **Done 2026-10-23 (D31): 38 apps,
|
||||
categories `ai-local` and `cad-3d`; 30 promoted to `clean` by the owner
|
||||
after the VirusTotal preview, 8 held `unverified`.** The candidate list,
|
||||
as planned: Windows: PowerToys,
|
||||
ShareX, Flameshot, Greenshot, AutoHotkey, Ditto, Bulk Crap
|
||||
Uninstaller, EarTrumpet, Twinkle Tray, Scoop, WinGet, PowerShell 7;
|
||||
sharing/remote: LocalSend, KDE Connect, RustDesk, Parsec; hashing:
|
||||
OpenHashTab, QuickHash GUI; macOS: Maccy, AltTab, MonitorControl, Ice,
|
||||
Karabiner-Elements, Shottr; gaming: Prism Launcher, Lossless Scaling,
|
||||
DuckStation, Azahar, ReShade; dev: Fork, Docker Desktop, Insomnia,
|
||||
Kitty, Tabby; local AI: LM Studio, Jan, GPT4All; CAD/3D: KiCad,
|
||||
OpenSCAD, PrusaSlicer, OrcaSlicer, Cura, LibreCAD. Each passes C1–C7
|
||||
on its own (Docker Desktop needs a C3 ruling — paid for larger
|
||||
companies); possible new categories `ai-local` and `cad-3d`. New slugs
|
||||
enter `/rss.xml`, so notify.py announces each one once — expected.
|
||||
The one-app-per-PR rule (docs/03 §1) applies unless a batch exemption
|
||||
is logged like D24.
|
||||
11. **Data hygiene.** SPDX-normalise `license`, consolidate `tags` (663
|
||||
distinct, 68 % used once), unify developer names, record the missing
|
||||
C3 rulings — fixed in the data, then held by `validate-data.mjs`
|
||||
rules so they stay fixed.
|
||||
12. **Install-command generator** (extends item 3): optional
|
||||
`install.{winget,scoop,choco,brew,flatpak}` fields, a copy button per
|
||||
app, and a multi-select on `/apps` that builds ONE combined command —
|
||||
entirely client-side, no new island if it can live in ShSearch's grid
|
||||
controller.
|
||||
13. **Collections** — curated static lists ("Fresh Windows install",
|
||||
"Privacy", "Creator", "Dev setup") from a `collections.json`, each a
|
||||
page in both locales.
|
||||
14. **"Free alternatives to X" pages** — an optional `alternativeTo` field
|
||||
and static landing pages; useful for search, honest only while every
|
||||
listed alternative still passes C1–C7.
|
||||
15. **Anonymous app-suggestion form** — reuses `/api/verify` + Turnstile;
|
||||
the Worker files a GitHub issue with a fine-grained token (runtime
|
||||
secret), rate-limited like D25. A second Worker route, so it needs its
|
||||
own decision-log entry under hard rule 1.
|
||||
16. **Platform upkeep** — ~~Node 26 together with `.nvmrc`, `engines` and
|
||||
the `@types/node` major~~ **done 2026-10-23 (D28)**; TypeScript 7
|
||||
**partly done** — it type-checks every `.ts` file beside the TS 6 API
|
||||
that `astro check` still needs (D28; a TS 7-only setup waits on Astro
|
||||
#18471 and typescript-eslint #10940); still open: an OpenSearch
|
||||
description, a versioned `/api/v1` with a published JSON Schema.
|
||||
17. **Accessibility** — **first pass done 2026-11-09 (D33, v1.4)**:
|
||||
`ACCESSIBILITY.md` + `/legal/accessibility`, the WCAG 2.2 AA target,
|
||||
the "/" switch (2.1.4), focus, forced-colour, reflow, target-size and
|
||||
status-message fixes, axe on every page type and the open dialogs with
|
||||
moderate findings failing, and an Accessibility issue form + PR
|
||||
template. Still open: a recorded NVDA and VoiceOver pass (docs/13 §2),
|
||||
Lighthouse CI (item 8), and — only if reports ask for it — text-size
|
||||
and spacing choices in the display menu.
|
||||
|
||||
## 3. Explicitly rejected (for the record)
|
||||
|
||||
@@ -76,7 +195,7 @@ rule 8) · ads/affiliate links (conflicts with the trust proposition).
|
||||
| 2026-07-15 | Fonts: **Bricolage Grotesque** chosen over Space Grotesk for display | ⚠ review (D9) |
|
||||
| 2026-07-15 | Added **nanostores** as the one cross-island state dep | ⚠ review (D15) |
|
||||
| 2026-07-15 | Legal drafts embedded in docs/14; split into `/legal/*` pages at implementation | ⚠ review |
|
||||
| 2026-07-15 | No analytics in v1 | ✅ from spec session |
|
||||
| 2026-07-15 | No analytics in v1 | ⛔ superseded 2026-10-21 (D26) |
|
||||
| 2026-07-15 | Category taxonomy fixed at 12 ids (docs/04 §4) | ⚠ review |
|
||||
| 2026-07-20 | **`softharbor.net` purchased**; docs suite → v1.1; new docs/16 owns domain/SEO ops | ✅ Kokone |
|
||||
| 2026-07-20 | Canonical = apex `https://softharbor.net`; `www` 301 via zone Redirect Rule; **no auto-anything else** | ⚠ review (N1–N2) |
|
||||
@@ -84,16 +203,16 @@ rule 8) · ads/affiliate links (conflicts with the trust proposition).
|
||||
| 2026-07-20 | Zone plan **Free**; Custom Errors therefore unavailable; `/errors/*` stay dormant | ✅ (plan-gating re-verified) |
|
||||
| 2026-07-20 | Rate limiting + Bot Fight Mode deliberately OFF at launch (recipes in docs/16 §9) | ⚠ review (N6) |
|
||||
| 2026-07-20 | HSTS zone-level, phased P1→P2→optional P3 preload (H9 = Kokone's call) | ⚠ review (N5) |
|
||||
| 2026-07-20 | Contact = `contact@softharbor.net` via Email Routing; SPF + DMARC quarantine→reject | ⚠ review (N7) |
|
||||
| 2026-07-20 | Contact = `contact@softharbor.net` via Email Routing; SPF + DMARC quarantine→reject | ⛔ superseded 2026-10-21 (D27) |
|
||||
| 2026-07-20 | SEO additions: GSC Domain property, Bing import, Crawler Hints/IndexNow ON, JSON-LD `SoftwareApplication` + `BreadcrumbList` (price only for `free`) | ⚠ review (N8) |
|
||||
| 2026-07-27 | **Suite audit → v1.2.** Six build/deploy blockers fixed before any code was written (below) | ✅ |
|
||||
| 2026-07-27 | CI called `reusable-node-ci.yml` and `reusable-notify.yml` — **neither exists** in `poli0981/.github`. Rewired to `reusable-web-react.yml` (generic Node, accepts pnpm) + a local `gates` job, and `announce-release.yml` (Discord-only) | ✅ (verified via `gh`) |
|
||||
| 2026-07-27 | CI called `reusable-node-ci.yml` and `reusable-notify.yml` — **neither exists** in `poli0981/.github`. Rewired to `reusable-web-react.yml` (generic Node, accepts pnpm) + a local `gates` job, and `announce-release.yml` (Discord-only) | ⛔ superseded 2026-07-28 (self-contained `ci.yml`) |
|
||||
| 2026-07-27 | **D16** `developer` required in schema + rendered (docs/04 §2 documented a field the `.strict()` schema rejected) | ⚠ review |
|
||||
| 2026-07-27 | **D18** CSP: zero inline scripts, `script-src 'self'`, no hash pipeline; theme → `public/theme.js` | ⚠ review — **S1 must confirm ClientRouter survives** |
|
||||
| 2026-07-27 | **D18** CSP: zero inline scripts, `script-src 'self'`, no hash pipeline; theme → `public/theme.js` | ⛔ superseded 2026-07-27 (D20) |
|
||||
| 2026-07-27 | Card markup: wrapping `<a>` with nested chip links replaced by the stretched-link pattern (nested anchors are invalid HTML) | ✅ |
|
||||
| 2026-07-27 | VI glossary moved out of `vi.json` into docs/07 §9 — a `_glossary` key would fail the strict parity check it was meant to serve | ✅ |
|
||||
| 2026-07-27 | Search index stores **raw** fields; `processTerm` normalizes both sides. No `*Norm` copies, no `storeFields` | ✅ |
|
||||
| 2026-07-27 | `fuzzy: 0.15` marked provisional — the declared `gmip → GIMP` vector needs ~2 edits and cannot pass. **S2 owns the final value** | ⚠ open |
|
||||
| 2026-07-27 | `fuzzy: 0.15` marked provisional — the declared `gmip → GIMP` vector needs ~2 edits and cannot pass. **S2 owns the final value** | ⛔ superseded 2026-07-27 (D22) |
|
||||
| 2026-07-27 | **D17** pnpm 10 kept despite npm siblings | ✅ |
|
||||
| 2026-07-27 | Toolchain majors corrected against `poli0981-dev`: TypeScript 6, ESLint 10, lefthook 2, knip 6 | ✅ (verified) |
|
||||
| 2026-07-27 | Action pins bumped to `checkout@v7` / `setup-node@v6` / `pnpm/action-setup@v6`; SHA-pinning rule scoped to repo-local workflows | ✅ |
|
||||
@@ -103,13 +222,13 @@ rule 8) · ads/affiliate links (conflicts with the trust proposition).
|
||||
| 2026-07-27 | **P1/M0 executed.** Scaffold builds; S1 and S2 passed; findings below | ✅ |
|
||||
| 2026-07-27 | **B7 / D15 amended** — `@nanostores/svelte` **does not exist** (registry 404). Not needed: nanostores atoms satisfy Svelte's store contract natively | ✅ (verified) |
|
||||
| 2026-07-27 | **D20 supersedes D18** — Astro island hydration emits inline scripts, so "nothing inline" is unachievable. CSP split: Astro `security.csp` meta owns script-src/style-src with generated hashes; `_headers` owns only `frame-ancestors` | ✅ (S1, hashes re-verified) |
|
||||
| 2026-07-27 | ClientRouter is an **external** script — View Transitions survive. The M1 fallback risk is closed | ✅ (S1) |
|
||||
| 2026-07-27 | ClientRouter is an **external** script — View Transitions survive. The M1 fallback risk is closed | ⛔ superseded 2026-10-21 (ClientRouter removed — native view transitions) |
|
||||
| 2026-07-27 | **D21** hold TypeScript at 6.x — TS 7's native compiler breaks `astro check` | ✅ (S1, reproduced) |
|
||||
| 2026-07-27 | **D22** `FUZZY = 0.25`; `gmip → GIMP` vector retired as not worth its false positives | ✅ (S2, measured) |
|
||||
| 2026-07-27 | `ignore-scripts=true` removed — pnpm ≥ 10 blocks dep scripts by default; the flag also suppresses the `allowBuilds` allowlist and stops the build entirely. pnpm line corrected 10.x → 11.x | ✅ (S1) |
|
||||
| 2026-07-27 | Prettier ignores `docs/` + `CLAUDE.md` — the suite is hand-wrapped, and reformatting would bury every future docs diff | ✅ |
|
||||
| 2026-07-27 | **S4 passed**, catching two design bugs: a `transition:persist`ed `<dialog>` loses top-layer state across a swap (fixed by re-asserting `showModal()` on `astro:after-swap`), and a persisted island keeps its first `locale` prop, so EN copy leaked onto `/vi/` pages (fixed by deriving locale from the path) | ✅ |
|
||||
| 2026-07-27 | Island tests added in **happy-dom** (`vitest.config.ts`, two projects). Does **not** reopen the no-Playwright decision — asserts island state machines only; layout/top-layer/visual stay manual (docs/11 §1) | ⚠ review |
|
||||
| 2026-07-27 | **S4 passed**, catching two design bugs: a `transition:persist`ed `<dialog>` loses top-layer state across a swap (fixed by re-asserting `showModal()` on `astro:after-swap`), and a persisted island keeps its first `locale` prop, so EN copy leaked onto `/vi/` pages (fixed by deriving locale from the path) | ⛔ superseded 2026-10-21 (no ClientRouter; the gate mounts per page) |
|
||||
| 2026-07-27 | Island tests added in **happy-dom** (`vitest.config.ts`, two projects). Does **not** reopen the no-Playwright decision — asserts island state machines only; layout/top-layer/visual stay manual (docs/11 §1) | ⛔ superseded 2026-10-21 (Playwright e2e added) |
|
||||
| 2026-07-27 | Legal-gate session fallback moved from a module-local `let` to a `globalThis` key — its scope really is the session, and a module-local silently leaked acceptance between tests | ✅ |
|
||||
| 2026-07-27 | **M1 skeleton done** — tokens, self-hosted fonts, Base/header/footer, Welcome + empty grid in **both** locales, i18n helper + parity gate | ✅ |
|
||||
| 2026-07-27 | `_headers` had a dead `/fonts/*` rule and the PWA a dead `fonts/*.woff2` glob: Astro hashes fonts into `/_astro/`, so the offline shell would have shipped **unstyled**. Both corrected (docs/08 D, docs/09 §4) | ✅ (found by inspecting `dist/`) |
|
||||
@@ -133,106 +252,187 @@ rule 8) · ads/affiliate links (conflicts with the trust proposition).
|
||||
| 2026-07-30 | Link check now accepts **403/429**. 14 of the 26 CI failures were bot mitigation on plainly-live sites (winehq, dolphin-emu, rpcs3, gitlab, MSI, Nexus, Epic, Enpass). A checker wrong about a seventh of the catalogue gets ignored, which costs more than the 403 it would eventually be right about. 404/500/connection failures still break the build. **Spoofing a browser `--user-agent` was tried first and is explicitly rejected**: it cleared the 403s but made gitlab.gnome.org answer 406 and whatsapp.com 400, both of which pass on lychee's default agent — no single UA suits every vendor, so it trades one false-positive set for another | ✅ |
|
||||
| 2026-07-30 | `security.evidence` was collected by the schema and demanded by docs/09 §6 but **rendered nowhere** — it had always been `null`, so the gap was invisible until 327 permalinks landed. The detail page's security line now links it (docs/06 §5, `detail.evidence`) | ✅ |
|
||||
| 2026-07-30 | **C3 rulings approved by H7** — the freemium entries below are confirmed acceptable as `free` | ✅ |
|
||||
| 2026-07-29 | **C3 rulings pending for the freemium communication entries** — Slack (90-day history), Zoom (40-min meetings), Microsoft Teams (60-min calls), Discord, Beeper, and eM Client (`free-onetime`, one device / two accounts) all enter as `free` on the grounds that the free tier is self-sufficient for desktop use. Each summary states its limit rather than hiding it. Hard rule 3 is satisfied — none is subscription-*only* — but docs/04 §3 wants the rulings logged, and these are H7's to confirm | ⚠ Kokone |
|
||||
| 2026-07-29 | **C3 rulings pending for the freemium communication entries** — Slack (90-day history), Zoom (40-min meetings), Microsoft Teams (60-min calls), Discord, Beeper, and eM Client (`free-onetime`, one device / two accounts) all enter as `free` on the grounds that the free tier is self-sufficient for desktop use. Each summary states its limit rather than hiding it. Hard rule 3 is satisfied — none is subscription-*only* — but docs/04 §3 wants the rulings logged, and these are H7's to confirm | ⛔ superseded 2026-07-30 (approved by H7) |
|
||||
| 2026-07-29 | Logo remaps refuse any Simple Icons name that is also a common word (`session`, `wire`, `mumble`, `element`, `line`, `signal`, `zoom`, and the earlier `shell`/`helium`/`dolphin`/`files`/`helix`/`wine`) unless the brand is confirmed against its upstream `source` URL. A wrong match ships another company's trademark, and docs/14 §3d has no room for that. Monogram is the safe default | ✅ |
|
||||
| 2026-07-27 | Page bodies live in `src/components/pages/*.astro`; `src/pages/**` are thin locale wrappers. Implements the docs/07 §2 no-duplication rule for whole pages, not just `getStaticPaths` | ✅ |
|
||||
| 2026-07-27 | i18n parity script also enforces **alphabetical key order** — a 200-key dictionary is unreviewable otherwise | ✅ |
|
||||
| 2026-07-27 | **S1 closed on a real deploy**: `build.format: 'file'` + `html_handling: 'drop-trailing-slash'`. The default pairing 307'd every canonical URL we advertise | ✅ (measured) |
|
||||
| 2026-07-27 | **S5 software passed**, 4 bugs: SW never registered (`@vite-pwa/astro` emits but never references `registerSW.js`); `navigateFallback` served the offline page to *online* visitors; `clientsClaim` false; workbox globs coupled to `build.format`. Device airplane-mode pass still outstanding | ✅ / ⚠ |
|
||||
| 2026-07-27 | **S3 partial**: `BUDGET = 5000`. GitHub 500s between ~7 160 and ~7 960 rather than degrading to 414, so 80 %-of-hard-limit would have landed inside the 500 band. Field-mapping check still needs the template on `main` | ✅ / ⚠ |
|
||||
| 2026-07-27 | Pre-launch `X-Robots-Tag: noindex` in `_headers` while the dataset is empty; removal is a launch-checklist item (docs/13 §2) | ✅ |
|
||||
| 2026-07-27 | Pre-launch `X-Robots-Tag: noindex` in `_headers` while the dataset is empty; removal is a launch-checklist item (docs/13 §2) | ⛔ superseded 2026-07-28 (header removed) |
|
||||
| 2026-07-27 | **`softharbor.net` is LIVE** — apex deployed, DNS + cert provisioned by `wrangler deploy`, M1 skeleton serving. **M0 and M1 complete** | ✅ |
|
||||
| 2026-07-27 | S5 re-verified on the production origin (SW controlling, 15 precache entries, no console errors). Airplane-mode device pass still outstanding | ✅ / ⚠ |
|
||||
| 2026-07-27 | `main` fast-forwarded to the feature branch so `bug_report.yml` reaches the default branch — GitHub reads issue templates only from there | ✅ |
|
||||
| 2026-07-28 | **M2 complete** — Zod schema (L1), `validate-data.mjs` (L2), `extract-urls.mjs` (L3), 12-category registry, 5 seed apps, card/grid/detail/category pages in both locales. 43 pages, deployed | ✅ |
|
||||
| 2026-07-28 | **The T4 `set:html` ban had never worked** — the hand-rolled selector targeted `JSXAttribute`, which astro-eslint-parser does not emit for template directives. Replaced with `astro/no-set-html-directive` and negative-controlled | ✅ |
|
||||
| 2026-07-28 | `unplugin-icons` is static-import-only and cannot resolve a data-driven `logo`. `src/lib/icon.ts` inlines from the same vendored Iconify JSON at build time; the T4 ban carries one carve-out scoped to three named files | ⚠ review |
|
||||
| 2026-07-28 | Seed entries enter as `security.status: "unverified"` — `clean` requires the docs/09 §6 checklist, and hard rule 4 forbids clean-by-default. Licenses/developers still need the L4 pass | ⚠ Kokone |
|
||||
| 2026-07-28 | Seed entries enter as `security.status: "unverified"` — `clean` requires the docs/09 §6 checklist, and hard rule 4 forbids clean-by-default. Licenses/developers still need the L4 pass | ⛔ superseded 2026-07-30 (vetting run) |
|
||||
| 2026-07-28 | Post-deploy edge propagation makes brand-new routes 404 intermittently for a minute or two; documented in docs/16 §10 so it is not mistaken for a config bug | ✅ |
|
||||
| 2026-07-28 | **M3 complete** — `/search-index.json`, nanostores, pure filter/sort in `src/lib/filter.ts`, `ShSearch` + `ShFilterSheet`. S2 vectors verified **in-app**; facets compose; no-JS grid intact | ✅ |
|
||||
| 2026-07-28 | **nanostores' `$name` convention is incompatible with Svelte** — `$` is reserved for auto-subscription, so atoms are exported unprefixed and referenced as `$name` in components (docs/05 §A3) | ✅ |
|
||||
| 2026-07-28 | Grid controller lives in `src/lib/grid.ts`, not a 7th island — docs/02 §5 caps islands at six. Reordering uses CSS `order`, never DOM moves | ✅ |
|
||||
| 2026-07-28 | Grid controller lives in `src/lib/grid.ts`, not a 7th island — docs/02 §5 caps islands at six. Reordering uses CSS `order`, never DOM moves | ✅ / ⛔ CSS-`order` part superseded 2026-07-30 (DOM moves) |
|
||||
| 2026-07-28 | All 5 seed entries share `addedAt`, so the "Newest" sort currently falls through to the name tiebreak. Correct, but it means sort order is only exercised by unit tests until entries land on different days | ⚠ note |
|
||||
| 2026-07-28 | **M4 complete** — legal gate copy moved into the dictionaries, 5 legal documents ×2 locales, `ShLangSwitch` + `ShThemeToggle`, `LICENSE-DATA.md`. Five of six islands now exist (`ShBugReport` is M5) | ✅ |
|
||||
| 2026-07-28 | **Regression caught in M4, introduced by the S1 trailing-slash fix**: `build.format: 'file'` makes `Astro.url.pathname` the emitted FILE name, so all 52 pages shipped `.html` canonicals and hreflangs that disagreed with the sitemap. Fixed via `canonicalPath()` (docs/07 §6) and pinned by tests | ✅ |
|
||||
| 2026-07-28 | Gate strings are passed to the island as props rather than importing `t` — the gate must switch locale without a reload, but importing the dictionaries would bundle all 78 keys into it | ✅ |
|
||||
| 2026-07-28 | Locale ROUTING split into `src/lib/locale.ts` (no dictionary import) so islands can use `localePair` without pulling in every string | ✅ |
|
||||
| 2026-07-28 | Legal drafts are published as written in docs/14. **H6 (Kokone's review) is still outstanding**, and `LEGAL_VERSION` should be reset to the approval date when it happens — bumping it re-opens the gate for everyone, which is the intended behaviour | ⚠ Kokone |
|
||||
| 2026-07-28 | Legal drafts are published as written in docs/14. **H6 (Kokone's review) is still outstanding**, and `LEGAL_VERSION` should be reset to the approval date when it happens — bumping it re-opens the gate for everyone, which is the intended behaviour | ⛔ superseded 2026-07-28 (H6 approved) |
|
||||
| 2026-07-28 | **M5 complete** — `/api/apps.json`, `/rss.xml`, `ShBugReport` (the 6th and final island), dormant `/errors/*`, 404/offline, `security.txt`, `SECURITY.md`, JSON-LD, favicon. **All six islands now exist**; a seventh needs a decision-log entry | ✅ |
|
||||
| 2026-07-28 | Feed determinism **verified by building twice and comparing hashes** — `/rss.xml` byte-identical, so notify.py cannot double-fire. `@astrojs/rss` has no `guid` option, so the slug guid is injected via `customData` (docs/05 §A4) | ✅ |
|
||||
| 2026-07-28 | Ring-buffer listeners moved OUT of `ShBugReport` into `public/errors.js`: the island is `client:visible` in the footer, so hydration-time listeners would have missed every error before the user scrolled (docs/05 §A5) | ✅ |
|
||||
| 2026-07-28 | `public/*.js` is now linted with browser globals rather than ignored — `theme.js` had been exempt | ✅ |
|
||||
| 2026-07-28 | **PNG PWA icons (192/512/maskable) still missing.** ⛔ superseded — Kokone chose to ship the existing SVG: manifest now uses `favicon.svg`, `sizes: "any"`, `purpose: "any maskable"`. Raster PNGs remain an optional upgrade | ✅ |
|
||||
| 2026-07-28 | **PNG PWA icons (192/512/maskable) still missing.** ⛔ superseded — Kokone chose to ship the existing SVG: manifest now uses `favicon.svg`, `sizes: "any"`, `purpose: "any maskable"`. Raster PNGs remain an optional upgrade | ⛔ superseded 2026-10-21 (PNG icons shipped) |
|
||||
| 2026-07-28 | **M6 complete** — CI/CD workflows, `quarantine.mjs`, renovate, CODEOWNERS, issue templates. Infra section of the launch checklist verified green against production | ✅ |
|
||||
| 2026-07-28 | **H6 approved.** `LEGAL_VERSION` set to 2026-07-28; everyone who accepted the pre-approval wording sees the gate once more, as intended | ✅ Kokone |
|
||||
| 2026-07-28 | **`X-Robots-Tag: noindex` removed.** It guarded against indexing an EMPTY site; with real entries, legal pages and a sitemap live that objection no longer holds | ✅ |
|
||||
| 2026-07-28 | **`www` was being deleted by `wrangler deploy`** — a hand-added DNS record is not in the Worker's trigger list, so deploys reconciled it away and the redirect died silently. Fixed by declaring `www.softharbor.net` as a second `custom_domain` so wrangler owns the record. **Redirect Rule R1 is now a hard prerequisite**: without it www would serve a duplicate of the site | ✅ (verified across a deploy) |
|
||||
| 2026-07-28 | **`www` was being deleted by `wrangler deploy`** — a hand-added DNS record is not in the Worker's trigger list, so deploys reconciled it away and the redirect died silently. Fixed by declaring `www.softharbor.net` as a second `custom_domain` so wrangler owns the record. **Redirect Rule R1 is now a hard prerequisite**: without it www would serve a duplicate of the site | ⛔ superseded 2026-07-28 (routes removed, commit 66c6255 — docs/16 §3) |
|
||||
| 2026-07-28 | Quarantine sweep tested end-to-end: a flagged entry vanishes from the detail page, grid, API export, RSS feed **and** search index — all five surfaces | ✅ |
|
||||
| 2026-07-28 | Dead-code sweep: `ShProbe.svelte` (a dead S1 leftover sitting in `islands/`, where docs/02 §5 caps the count at six), 5 unused exports, 2 `exactOptionalPropertyTypes` violations. `knip` now passes clean so the next one is visible | ✅ |
|
||||
| 2026-07-28 | **v1.0.0 NOT tagged.** Infra is green but the dataset is 5 of 32 entries and all are `unverified` — the docs/09 §6 checklist has not been run. Tagging now would rest hard rule 4's honesty claim on unchecked data | ⚠ Kokone |
|
||||
| 2026-07-28 | **v1.0.0 NOT tagged.** Infra is green but the dataset is 5 of 32 entries and all are `unverified` — the docs/09 §6 checklist has not been run. Tagging now would rest hard rule 4's honesty claim on unchecked data | ⛔ superseded 2026-07-30 (v1.0.0 tagged) |
|
||||
| 2026-07-28 | **CSP `style-src` was silently dropping every inline `style` attribute** — 49 of them. The sticky header rendered transparent and content bled through. Tokens are now Tailwind utilities and `check:styles` fails the build on any `style=` in dist (docs/09 §4) | ✅ |
|
||||
| 2026-07-28 | `ci.yml` made **self-contained**, superseding the reusable-workflow caller: `reusable-web-react.yml`'s Pages job declares `pages: write` + `id-token: write`, and a caller cannot grant less, so every run died at `startup_failure` — and its steps run only "if the script exists", which silently green-lights a renamed gate | ✅ |
|
||||
| 2026-07-28 | `reusable-codeql.yml` takes `languages` as a **JSON array string** (`'["javascript-typescript"]'`); a bare value throws in `fromJSON` and kills the run at startup | ✅ |
|
||||
| 2026-07-28 | **`CLOUDFLARE_API_TOKEN` lacks zone permissions** — CI deploy fails with `Authentication error [code: 10000]` on `/workers/routes`. Local deploys worked because wrangler uses OAuth, which masked it | ⛔ moot — deploy workflow removed (below) |
|
||||
| 2026-07-28 | **Deployment moved to Cloudflare Workers Builds** (dashboard git integration). `deploy.yml` and `preview.yml` deleted: they duplicated a pipeline the dashboard already runs, and needed a token with zone-write scopes nothing else requires. `wrangler.jsonc` remains the source of truth for routes; the build environment is now Cloudflare's and must match `.nvmrc` | ✅ Kokone |
|
||||
| 2026-07-28 | `CLOUDFLARE_API_TOKEN` / `CLOUDFLARE_ACCOUNT_ID` repo secrets are now unused by any workflow — **delete them** unless something else claims them (action item H3 is retired) | ⚠ Kokone |
|
||||
| 2026-10-21 | **D25 — one Worker, for `POST /api/verify` only** (amends hard rule 1). The legal gate gains a step 2: Cloudflare Turnstile, loaded only after the documents are accepted, its token checked server-side by `worker/verify.ts` against Siteverify (host, `action: legal_gate`, age ≤ 300 s), rate-limited per IP/64 by the Workers Rate Limiting binding. `assets.run_worker_first: ["/api/verify"]` keeps every page and asset on the unbilled asset path. It gates nothing: a pass is remembered 48 h (`sh:human`), and every failure on our side — no secret, Siteverify down, script blocked, 10 s timeout — **fails open** with a 1 h retry, so a person is never locked out. `TURNSTILE_SECRET` is a *runtime* secret (a Workers Builds build variable is invisible to the Worker) | ✅ (user, 2026-10-21) |
|
||||
| 2026-10-21 | **D26 — Cloudflare Web Analytics, honouring Global Privacy Control** (supersedes "No analytics in v1"; amends hard rule 7). Cookieless beacon injected by `src/scripts/analytics.js` only when `navigator.globalPrivacyControl` is not set and the host is `softharbor.net` (never previews, localhost or e2e). CSP gains exactly `static.cloudflareinsights.com` (script), `cloudflareinsights.com` (connect) and `challenges.cloudflare.com` (script + frame, for D25) — nothing else third-party | ✅ (user, 2026-10-21) |
|
||||
| 2026-10-21 | **D27 — one contact address per purpose** at `poli0981.dev` (supersedes the `contact@softharbor.net` row of 2026-07-20): security, privacy, legal, dmca, takedown, copyright, code (CoC), press, collab — `src/lib/contacts.ts`. `sponsor@` deliberately unused: a neutral directory takes no paid placement. Mail is hosted by Google (MX), which the Privacy Policy now says | ✅ (user, 2026-10-21) |
|
||||
| 2026-10-21 | **`LEGAL_VERSION` → 2026-10-21** with per-document "Last updated" dates (`LEGAL_UPDATED`): Privacy covers D25/D26 and names the operator; Terms gain the operator and a copyright-complaint procedure (`dmca@`); nine EN/VI wording gaps and two false AI-Disclosure claims fixed. A test now fails if an accepted document is dated after the version | ✅ |
|
||||
| 2026-10-21 | **`<ClientRouter />` removed → native cross-document View Transitions.** Astro does not support ClientRouter together with `security.csp`, and in practice a soft navigation kept the *first* page's meta CSP, wiped `<html data-theme>` (theme flicker) and kept module state alive while islands reset (a stale sort). Every navigation is now a full document load. The opt-in is an inline, hashed `<style>` (`src/lib/inlineCss.ts`, hash supplied in `astro.config.ts`) because Chromium settles it when `<body>` is inserted; no `transition:persist`, no `astro:after-swap`; the URL holds the `/apps` view state (`src/lib/urlstate.ts`). Supersedes the S1 "View Transitions survive" and S4 rows (docs/02 §6) | ✅ |
|
||||
| 2026-10-21 | **Playwright + axe end-to-end, enforced in CI — reverses "No Playwright in v1"** (docs/11 §1). Desktop Chrome + Pixel 7 against `astro preview`; a test fails on any console error, uncaught exception, CSP violation or sideways overflow, and on serious/critical axe findings in light and dark; Turnstile is stubbed with `page.route`. Vitest grew to four projects (unit, islands, scripts — the real build scripts in temp trees — and worker) with a coverage ratchet of 93/78/90/93 | ✅ |
|
||||
| 2026-10-21 | **CSP-first head.** Head scripts moved from `public/` to `src/scripts/*.js`, imported with `?url&no-inline` (content-hashed, immutable `/_astro/` files); `errors.js` loads first and blocking — `defer` had made it miss early failures — and now also records CSP violations and hydration errors; `scripts/postbuild.mjs` moves the CSP meta right after `<meta charset>`. `check:styles` became **`check:csp`** (also fails on a missing meta, a script before it, an unhashed inline script); new `check:assets` catches `data:` scripts and missing assets | ✅ |
|
||||
| 2026-10-21 | **`_headers` Cache-Control repaired.** Cloudflare comma-JOINS a header set by several matching rules, so hashed assets were served `public, max-age=0, must-revalidate, public, max-age=31536000, immutable` — revalidated on every load — and the JSON feeds were never cached. `/*` now sets no Cache-Control and each specific rule detaches with `! Cache-Control`. PR preview hosts get `X-Robots-Tag: noindex` from an absolute-URL rule (docs/09 §4) | ✅ (verified live) |
|
||||
| 2026-10-21 | **Dependabot replaces Renovate**, which was never installed (no branch, dashboard or PR ever appeared). Weekly npm + github-actions, 2-day cooldown (pnpm 11's 24 h `minimumReleaseAge` failed same-day PRs #14/#15), minor+patch grouped, TypeScript (D21) and `@types/node` majors ignored. Every action pinned to a commit SHA with a version comment (docs/12 §6) | ✅ |
|
||||
| 2026-10-21 | **Squash is the only merge method.** The `main` ruleset ("Run") requires signed commits and linear history, and GitHub cannot sign a rebase merge. Required checks: `build`, `gates` and `codeql / Analyze (javascript-typescript)` — so CodeQL runs on PRs; a required check that never appears deadlocks merging (docs/12 §8) | ✅ |
|
||||
| 2026-10-21 | **Quarantine workflow hardened**: a PR opened with `GITHUB_TOKEN` triggers no workflows, so it dispatches `ci.yml` + `codeql.yml` on its branch; commits signed via the API; one tracking issue per slug, only if none is open; step outputs pass through `env:`. `pnpm quarantine` plus the `flagged-in-main-tree` rule make flag-and-move one PR (docs/12 §4) | ✅ |
|
||||
| 2026-10-21 | **`ShPrefs` display menu replaces `ShThemeToggle`** — theme, scrollbar (`sh:scrollbar`) and motion (`sh:motion`), all applied pre-paint by `theme.js`, plus the global `/` shortcut. A one-for-one swap: still six islands (docs/05 §A8) | ✅ |
|
||||
| 2026-10-21 | **Legal-gate exemptions are declared by the page** (`gateExempt`), not matched by path: the old regex never matched the real 404 (served at any URL) or the service worker's offline page. `/contact` is exempt too (docs/14 Part 2) | ✅ |
|
||||
| 2026-10-21 | **Search and sort repaired**: race-free (sequence numbers), "Clear all" clears the query too, view state in the URL, "Best match" while querying, MiniSearch by dynamic `import()`, and every name order — grid, category pages — through one pinned `Intl.Collator('en', base, numeric)` (a Czech-locale browser had reordered 81 cards); `/api/apps.json` sorted by slug in code-unit order (docs/05 §A2–A3) | ✅ |
|
||||
| 2026-10-21 | **Data rules enforced, not just promised**: the schema requires `evidence` for `clean`/`flagged` and real, non-future dates; `validate-data.mjs` adds a download-portal denylist, tracking parameters, punycode hosts, invisible/bidi characters, case-sensitive local logos, date order, quarantine-tree rules and a 180-day stale-check warning (docs/03 §2) | ✅ |
|
||||
| 2026-10-21 | **"Harbor" UI refresh** (docs/06): OKLCH chart-paper/night-harbour tokens, hairline `--sh-border` separate from `--sh-control`, soft shadows (the offset shadows are gone), WCAG AA for every token pair held by `contrast.test.ts`, dark mode with JS off. Lucide via `ShIcon.astro`; the `set:html` carve-out now lists five named files (was three) | ✅ |
|
||||
| 2026-10-21 | **PWA installable**: manifest linked, PNG icons (192/512/maskable) + apple-touch + favicon.ico from `pnpm icons`; the SW precaches what `/offline` loads — it had rendered unstyled — and calls `skipWaiting`; `check:sw` asserts both (docs/08 Part D) | ✅ |
|
||||
| 2026-10-21 | **`check:feed`** at the end of `pnpm build` asserts the emitted RSS — slug guids that name real apps, links, newest first, ≤ 50 items — because the `customData` guid seam is invisible to unit tests and notify.py announces every new guid (docs/05 §A4) | ✅ |
|
||||
| 2026-10-21 | **Recorded late: `routes` removed from `wrangler.jsonc`** (commit 66c6255, 2026-07-28). Both custom domains are attached in the dashboard; with no `routes` key a deploy leaves them untouched. Supersedes that day's "declare www as a second custom_domain" row; a Worker re-created from a fresh clone needs both re-attached (docs/16 §3) | ✅ |
|
||||
| 2026-10-21 | **Workers Builds runs one build at a time.** A `main` merge can wait ~20 minutes behind PR builds, a superseded queued `main` build may be skipped (`ff95578` never deployed; `3743cfb` did), and the "Workers Builds" check appears on a commit only once its build starts. A gap in `wrangler deployments list` only means nothing reached `main`. New release step: wait for that check to go green, then verify production (assets, headers, `/api/verify`, RSS); never `wrangler deploy` by hand while builds are queued (docs/13 §3) | ✅ |
|
||||
| 2026-10-21 | **Recorded late: v1.0.0 tagged and released on 2026-07-30** — 326 apps, 320 `clean`, 6 `unverified`. Supersedes the 2026-07-28 "v1.0.0 NOT tagged" row | ✅ |
|
||||
| 2026-10-21 | **v1.1.0 tagged and released** after #23–#25 (merge 2c40baf: `Workers Builds: softharbor`, `build`, `gates`, `codeql` green; production checked — `/contact`, the v1.1 CSP meta, single immutable `Cache-Control`, `/api/verify` answering from the Worker with the runtime secret set) | ✅ |
|
||||
| 2026-10-21 | **Suite v2.0** (site v1.1) — a MAJOR bump by §6's rule, because D25/D26 amend hard rules 1 and 7: docs/00–16 brought in line with the code — D25–D27, the rows above, superseded statuses marked; claims that could not be checked from the repository or a live probe are marked "⚠ verify" | ✅ |
|
||||
| 2026-10-23 | **D28 — Node 26, and TypeScript 6 and 7 side by side** (amends D7, D21). `.nvmrc` `26`, engines `>=26 <27`, `@types/node` 26 — five days before Node 26's LTS promotion (2026-10-28), at the owner's request; Node 24 had entered maintenance on 2026-10-20. TypeScript follows Microsoft's documented pair: `typescript` → `npm:@typescript/typescript6` (re-exports TS 6.0.3: the API `astro check`'s language server asserts, typescript-eslint's project service and svelte2tsx load) and `@typescript/native` → `npm:typescript@7` (bin `tsc`). `pnpm check` is now `astro check && tsc --noEmit` — and that second half is the first type-check `.ts` files ever had: astro check reports `.astro` diagnostics only. Node 25+ ships no Corepack, so laptops reinstall it (`npm i -g corepack`) and Workers Builds downloads Node 26 per build (`PNPM_VERSION` is the fallback) | ✅ (owner, 2026-10-23) |
|
||||
| 2026-10-23 | **D29 — SonarQube Cloud: CI-based analysis with coverage**, replacing Automatic Analysis (which cannot import coverage and must stay off). `ci.yml` job `sonar`, not a required check; `sonar-project.properties` replaces `.sonarcloud.properties`; `sonarqube-scan-action` 8.3 with the newest CLI (8.2); `sonar.projectVersion` from `package.json` so the "previous version" new-code period finally has a baseline (every analysis until now was "not provided"). Coverage now measures what Sonar analyses instead of excluding it: the build scripts through Vitest 5's `autoAttachSubprocess` (their child-process runs count), the head scripts, the endpoints and the schema through new tests — ratchet 93/78/90/93 → **96/85/95/97**. The schema tests caught a real bug: an impossible or malformed date made `toISOString()` throw, crashing `astro build` with a bare RangeError instead of naming the field | ✅ ⛔ superseded 2026-11-24 (D38: SonarQube Cloud left with GitHub) |
|
||||
| 2026-10-23 | **D30 — VirusTotal re-check, assisted not decided** (docs/09 §6 step 5; docs/12 §4b). `scripts/vt-recheck.mjs` + `vt-recheck.yml`: daily on `main`, checks older than 90 days are re-scanned (download page, VT API v3, 4/min, ≤ 440 of 500 requests a day) and only the three `security` lines change; `checkedAt` now means "latest scan" (docs/04, docs/09 §6). The bot never flags and never promotes on its own: a detection turns `clean` into `unverified` plus a `[vt] <slug>` issue, and `unverified` → `clean` happens only for slugs the maintainer passes as `promote`. Dispatched on a data branch it previews a PR's new entries as an artifact. Terms fit: the Public API is offered to sites free to consumers; SoftHarbor is free and ad-free and submits only public URLs. The site's own copy moved with it — the "no known warnings" note and the AI Disclosure now describe the re-scan (`LEGAL_UPDATED.aiDisclosure` 2026-10-23; `LEGAL_VERSION` unchanged) | ✅ (owner, 2026-10-23) |
|
||||
| 2026-10-23 | **D31 — Catalogue batch 2: 38 apps, two categories** (§2 item 10). Exempt from docs/03 §1's one-app-per-PR rule like D24 (38 researched entries, one PR). Categories `ai-local` and `cad-3d` (owner). **Not added:** Docker Desktop and Parsec — both free only under licence terms (Docker: not for larger companies; Parsec: personal, non-commercial use only), a C3 case the owner rules out; GPT4All and Ice — C5, unmaintained with open problems; QuickHash GUI — C4/C5, its only download site unreachable and no release since 2023. **C3 rulings:** LM Studio, Insomnia and RustDesk are `free` — the free tier serves the core purpose without a time limit and their subscriptions are optional add-ons (LM Studio's only for the separate Bionic agent's cloud models). **Store-only delivery meets C4** when the official download page on the developer's own domain hands off to the store (Lossless Scaling → Steam/Humble). **Licences as the sources grant them:** ShareX `GPL-2.0-or-later` (headers), KDE Connect `GPL-2.0-only OR GPL-3.0-only`, EarTrumpet `LicenseRef-EarTrumpet` (MIT plus an exclusion of three named companies), DuckStation `CC-BY-NC-ND-4.0` (source-available). Each entry was researched with AI assistance against docs/09 §6 steps 1–4 and scanned by the `vt-recheck` preview before merge (36 of 38 download pages with no detections); the owner reviewed the Vietnamese and promoted 30 to `clean`. Held `unverified`: Flameshot (unpatched advisory in its stable release), Bulk Crap Uninstaller (unsigned builds, antivirus history), OpenSCAD (2021 stable predates two CVE fixes), LM Studio (closed source, antivirus history), RustDesk (CVE backlog), AutoHotkey and LocalSend (one VirusTotal detection each), Lossless Scaling | ✅ (owner, 2026-10-23) |
|
||||
| 2026-10-26 | **D32 — site-wide rate limit in the Worker** (amends hard rule 1 and D25; owner request, 2026-10-26). `run_worker_first` becomes `/*` minus the files a page loads — `/_astro/*`, `/icons/*`, the favicons, `apple-touch-icon.png`, the manifest, `sw.js`, `registerSW.js`, `workbox-*.js` — so every page, feed and data request runs `worker/limit.ts` first: `SITE_LIMITER` (namespace 4102), **60 per 10 s per IPv4 address or IPv6 /64**, per location. Over it: the built `/errors/429` page with status 429 (no longer dormant), `Retry-After: 10`, `no-store`; JSON under `/api/` (CORS-readable on the dataset). Fails **open** (no binding, no address, a throwing limiter); logs `{event: "rate_limited", kind}` without the address. `_headers` still apply to `env.ASSETS.fetch()` responses (measured). **Trade-offs accepted:** every routed request is a billed invocation (Workers Paid includes 10 M/month; refusals are billed too, so the limit makes floods cheap, not free); our code now processes every visitor's IP for seconds → Privacy `#rate-limit` and `LEGAL_VERSION` 2026-10-26. **Why not the zone rule alone:** on the Free zone it can only serve Cloudflare's default 429 page and cannot live in the repository; it is kept as an optional edge layer at 150 per 10 s (docs/16 §9.1). Tested end to end under `wrangler dev` by the new e2e project `worker` (docs/11 §5). **Measured on the PR preview:** over one keep-alive connection the limit holds almost exactly (61 × 200, then 429s), but a flood opening a new connection per request got no 429 at all (1 500 requests at ~20/s) — the binding counts per machine — and the production `VERIFY_LIMITER` likewise never refused 40 fresh-connection POSTs in 33 s. So the zone rule (docs/16 §9.1, H13) is the recommended first layer for floods, and the Worker's limit the polite one for browsers and keep-alive scrapers | ✅ (user, 2026-10-26) |
|
||||
| 2026-10-26 | **Suite v3.0** (site v1.3) — a MAJOR bump by §6's rule, because D32 amends hard rule 1 | ✅ |
|
||||
| 2026-11-09 | **D33 — Accessibility statement and target** (§2 item 17; owner request, 2026-11-09, after GitHub's community profile listed "Accessibility" as missing). **Target WCAG 2.2 AA**, stated as a goal and never as conformance (no audit). `ACCESSIBILITY.md` at the root (contributor-facing, GitHub's community file) and its visitor-facing twin `/legal/accessibility` + `/vi/legal/accessibility` — a seventh legal page, informational, gate-exempt, footer + Contact row; the two must say the same thing (docs/14 §3g). New contact **`accessibility@poli0981.dev`** (alias created by the owner the same day; `contacts.ts`). New localStorage key **`sh:keys`** — the display menu's switch for the "/" shortcut, because a bare printable-key shortcut must be possible to turn off (WCAG 2.1.4, level A); Privacy lists it, so **`LEGAL_VERSION` → 2026-11-09** and the gate asks everyone once more (owner's choice over dropping the switch). Fixes found by an audit despite the owner's clean keyboard + Narrator pass: an invisible focus ring on the checked display choice (2.4.7), the header pushing the display button off a 320 px screen (1.4.10 — it now wraps, and `scroll-padding-top` follows its measured height, 2.4.11), forced-colour states, 24 px category links (2.5.8), a status region that exists before its message (4.1.3), table captions/scopes/scrollable regions, the new-tab warning. axe now fails on moderate findings too and also runs on the open gate, filter sheet and display menu; `e2e/a11y.spec.ts` adds keyboard, 320 px reflow and forced-colour checks. `.github/PULL_REQUEST_TEMPLATE.md` (accessibility checklist) and `ISSUE_TEMPLATE/accessibility.yml` (label `accessibility`) | ✅ (user, 2026-11-09) |
|
||||
| 2026-11-09 | **D34 — Catalogue batch 3: the `accessibility` category, 9 entries, a triage of every `unverified` entry** (§2 item 17; owner request). Exempt from docs/03 §1's one-app-per-PR rule like D24/D31. Category **`accessibility`** (Accessibility / Trợ năng, lucide `accessibility`, order 15): NVDA, Optikey, Balabolka, Thorium Reader, Colour Contrast Analyser (homepage on vispero.com — tpgi.com now redirects there), Accessibility Insights for Windows, Bookworm, eSpeak NG. **#65 Orkas** accepted as `free` under C3 (MIT; fully usable with the user's own model keys or a local OpenAI-compatible endpoint, no time limit; the packaged app needs an Orkas sign-in and its monthly plans only add hosted-model credits and sync) in `productivity` + `ai-local`. **#11 Codex Quota Overlay declined**: free itself, but its only function is tracking a paid Codex/ChatGPT plan's limits — the no-subscription rule in spirit — and a narrow one-platform companion tool (closed as not planned). **Not added:** Talon Voice (the official site states no price; beta via Patreon), Speech Note (Flathub-only distribution, no precedent), LiveCaptions (last release 2024-06), Orca (gitlab.gnome.org answers the link checker 406), Narrator (part of Windows). VirusTotal preview: all 9 new entries 0 detections → **all 9 `clean`** (owner). Re-scan of all 29 `unverified` entries: 17 at 0 detections, of which the 8 with `[vt]` issues go `clean` (#34, #37, #40, #41, #55, #57, #58, #61 closed); the 8 D31 holds and synfig-studio (unverified since the seed) stay. The 12 still flagged by one or two URL-reputation engines — Chong Lua Dao (7-Zip, DBeaver, itch, Process Lasso, REAPER, Session), Webroot (Proton VPN, Tor Browser, Windscribe), Xcitium Verdict Cloud (KeePassXC, Session), Gridinsoft (DevToys, suspicious), Criminal IP (PeaZip) — are ruled **false positives by the owner and go `clean`** with the reason on each issue (#33, #35, #36, #38, #39, #51–#54, #56, #59, #60 closed); the linked scan still shows the engine, and the next re-check (≥ 90 days) re-opens an issue if it persists. **#47:** Wire's homepage `wire.com/` answers lychee 404 → `/en/` and download `/en/app-download` (both 200; the free personal plan still exists); Linphone's repo → its official GitHub mirror. Result: **373 apps, 15 categories, 364 `clean`, 9 `unverified`** | ✅ (user, 2026-11-09) |
|
||||
| 2026-11-09 | **v1.4.0 tagged and released** — the accessibility release (D33, D34). **Suite v3.1** (site v1.4) — a MINOR bump by §6's rule: no hard rule changes | ✅ |
|
||||
| 2026-11-15 | **D35 — Qodana as a third analyser** beside CodeQL and SonarQube Cloud (owner request, 2026-11-15; Qodana Cloud project `softharbor`, **Ultimate** licence, active until 2026-12-31). `.github/workflows/qodana.yml` runs `qodana-js` 2026.2 (WebStorm's engine) in **native mode** on the runner's Node 26 and `pnpm install`, profile `qodana.recommended`, the scope of `sonar-project.properties`, over `.ts`/`.js`/`.mjs`, JSON, YAML, Markdown and CSS — **no plugins**: JetBrains' Astro and Svelte plugins were tried and dropped because their type checks were not deterministic under Qodana (on unchanged code, `Intl` methods in `ShFilterSheet.svelte` unresolved in one run of three; `Base.astro`'s `locale = 'en'` read as `string` — 15 errors in one run, none in the one before; plus 75 unused-import false positives for components used in `.astro` templates), and a gate that flips on its own is worse than none — `astro check` type-checks `.astro` with the real compiler; `failureConditions.severityThresholds.any: 0`; the report as an artifact and the SARIF in GitHub code scanning (tool `QDJS`). **Not a required check**, for D29's reason. **First run: 14 findings, all resolved** — 10 `throw`s caught by their own `try` (`worker/verify.ts` now refuses through one return path, `scripts/vt-recheck.mjs` records failures directly; responses, logs and reasons unchanged), 2 redundant `\}` regex escapes, 1 trivial `if` (`src/lib/filter.ts`), and the twin dark palette in `global.css` (DuplicatedCode — required by design, switched off for that file with the reason). Not in Ultimate: Qodana's vulnerability checker and licence audit (Ultimate Plus) — OSV, `pnpm audit` and Dependabot own the dependencies (docs/12 §2) | ✅ owner |
|
||||
| 2026-11-15 | **D36 — Maintenance mode** (owner decision, 2026-11-15). The project is maintained, not extended. **In scope:** catalogue work (add, correct, remove; VirusTotal re-checks; quarantine); bugs, UI/UX and accessibility fixes; dependency upkeep on Dependabot's weekly schedule, and out of schedule for a High or Critical advisory or a serious Node.js security release; major language and platform moves (TypeScript 6 → 7, Astro, Cloudflare Workers / Wrangler); incidents — the site down, degraded or attacked. **Out of scope:** new features — §2's feature items are frozen, and issues or PRs that propose one are closed as *not planned* (`wontfix`). Releases: a patch tag when a fix is worth announcing, a minor one for a platform major; data never tags (docs/13 §1). Announced in Discussions (https://github.com/poli0981/softharbor/discussions/75); recorded in CLAUDE.md, CONTRIBUTING.md, the README (status badge and section), SECURITY.md, the PR template and a new **Listing change** issue form (label `listing-change`) | ✅ owner |
|
||||
| 2026-11-15 | **v1.4.1 tagged and released** — maintenance mode (D36) and Qodana (D35). **Suite v3.2** (site v1.4.1) — a MINOR bump by §6's rule: no hard rule changes | ✅ |
|
||||
| 2026-11-20 | **D37 — CiselSoft's two apps: watermarked free tier** (#80, #81; suggested by the publisher, CiselSoft, by email on 2026-11-14 — credited on both issues and PRs). **Cisel Media → `onetime`:** its free tier keeps every editing tool, but exports are watermarked, capped at 1080p / 30 FPS and limited to five text and ten visual items — a crippled demo in CONTRIBUTING's sense, so the listing rests on the 49.99 USD Perpetual Pro (an annual plan is also sold; the one-time option is what qualifies it). **CloneSift → `free-onetime`:** scans and results are unlimited and only in-app removal is capped (10 files a day), so the free tier serves the core purpose; Lifetime Pro 14.99 USD. Both are closed source and delivered only through the Microsoft Store from their product pages on ciselsoft.com (C4 per D31), and both are new (first Store releases 2026-10-28 and 2026-11-12, no ratings yet). VirusTotal preview: 0 detections each. **Held `unverified`** (owner) until they have a release history; revisit at the 90-day re-check. Precedent: a free tier whose every export is watermarked counts as a crippled demo — `onetime` when a perpetual licence is sold, excluded otherwise | ✅ owner |
|
||||
| 2026-11-24 | **D38 — The forge moves to Gitea** (the GitHub account was suspended in November 2026; procedure: the owner's runbook `docs/GITEA-MIGRATION.md` in `poli0981/.github` and its softharbor guide, decided 2026-11-23). Repository on `git.poli0981.dev` (canonical, `origin`; the `github` remote is kept and never pushed); outside issues and merge requests on the GitLab push mirror `gitlab.com/poli0981/softharbor` (no CI there); patches by e-mail to `code@`. **CI** = Gitea Actions on the owner's PC runner, every cron inside 13:00–16:00 UTC on a registered slot (quarantine 13:17 daily, vt-recheck 13:59 daily, link-check Monday 14:43, security Tuesday 15:37). **Deploy:** `ci.yml` job `deploy` — `wrangler deploy` on pushes to `main` with user-level Cloudflare secrets, then waits until production serves the build; Workers Builds is gone and is not reconnected to the mirror; **no PR previews** (Gitea gives same-repo PRs the secrets). **Bots:** `scripts/gitea.mjs` opens PRs and issues, dispatches CI and writes commit statuses with the job token; a dispatched run writes no commit status on Gitea 28.4, so `ci.yml`'s `record` job does. **Replaced:** Dependabot → Renovate (`local>poli0981/renovate-config`, 3-day release age, OSV PRs); CodeQL → the ops `security.yml` (gitleaks, Opengrep, osv-scanner); `qodana-action` + SARIF → the ops `reusable-qodana.yml`; the `Run` ruleset → Gitea branch protection (`CI / build (*)`, `CI / gates (*)`; signed commits no longer *required* — the bots cannot sign). **Dropped:** SonarQube Cloud (owner, runbook D1 — supersedes D29), GitHub code scanning, Discussions (D36's announcement, #75, went with them). **Site:** source, releases and LICENSE-DATA link Gitea; "Report a bug" opens a prefilled GitLab issue (`BUDGET` 5000 re-measured on gitlab.com); `security.txt` is e-mail only; the `/api/apps.json` attribution names Gitea (shape unchanged, `schemaVersion` 1); Privacy and Third-party name GitLab instead of GitHub → `LEGAL_VERSION` 2026-11-24, the gate asks everyone again. Ops reusables pinned to `poli0981/.github` v2026.11.2 (`8e6582a`), bumped by hand | ✅ owner |
|
||||
| 2026-11-24 | **D39 — Catalogue batch 4: Windows essentials and Local AI, 15 entries** (owner request, 2026-11-24). Exempt from the one-app-per-PR rule like D24/D31/D34: one researched batch, one owner review. **Windows essentials (10):** qBittorrent, ScreenToGif, QuickLook, Flow Launcher, CopyQ, PDF24 Creator, NAPS2, Equalizer APO, scrcpy, Rainmeter — what a fresh Windows install usually needs next and the catalogue lacked. **Local AI (5):** AnythingLLM, Comfy Desktop, Stability Matrix, KoboldCpp, Buzz — `ai-local` grows from 5 to 10 entries. Optional paid clouds (AnythingLLM Cloud, Comfy Cloud, Stability Matrix's Patreon extras) do not touch local use, so all 15 are `free` (C3, as LM Studio). **Not added:** Snipaste — 2.x is free for personal, non-commercial use only (D31's Docker Desktop / Parsec ruling); XnView MP, IrfanView, FastStone and f.lux were ruled out on the same grounds before drafting. Every entry enters `unverified` with a VirusTotal preview scan of its download page (vt-recheck dispatched on the branch: 14 of 15 with 0 malicious and 0 suspicious on 2026-11-24; Flow Launcher's first scan failed to fetch and its re-scan came back clean the same day). **Owner rulings (2026-11-24):** every entry whose scan came back clean goes to `clean`; qBittorrent is included — the catalogue's first BitTorrent client, legal open-source software that ships no search sources (search is opt-in third-party plugins), so C6 does not apply; the Vietnamese summaries are approved as written | ✅ owner |
|
||||
| 2026-11-28 | **D40 — PC Tweaker: optional subscription beside Free and Lifetime** (#7, #9; suggested by its developer, Aurelio Avila, by email on 2026-11-28 to collab@, who asked whether the subscription affects eligibility — credited in README Acknowledgements and on the request). **`free-onetime`:** the Terms make 48 controls free forever with no account, and Pro is sold either as a monthly or annual subscription or as a one-time Lifetime purchase that does not expire; the free tier is neither watermarked nor capped, so the subscription is one option among others, as with CloneSift (D37). Closed source, one developer, code-signed installer, on winget and the Microsoft Store, release history from 0.4 to 1.20. VirusTotal preview: 0 detections. **Held `unverified`** (owner) like D37's entries; revisit at the 90-day re-check. The Vietnamese summary and `system` + `gaming` approved as written | ✅ owner |
|
||||
| 2026-11-24 | **v1.5.0 tagged and released** — the move to Gitea (D38), with catalogue batch 4 (D39) and the dependency upkeep; the first release tagged, published and announced from Gitea. **Suite v4.0** (site v1.5.0) — a MAJOR bump by §6's rule: D38 supersedes a locked decision (D29) and rewords hard rule 1 (Gitea Actions) | ✅ |
|
||||
|
||||
## 5. Open questions for Kokone
|
||||
|
||||
Everything below is blocked on a decision or a setting, not on code. Ordered
|
||||
by what gates the v1.0.0 tag.
|
||||
Everything below is blocked on a decision or a setting, not on code.
|
||||
Status as of 2026-10-21: v1.0.0 shipped on 2026-07-30 and v1.1.0 on
|
||||
2026-10-21, so nothing here gates a tag any more; ordered by risk.
|
||||
|
||||
**Gating the launch**
|
||||
**Open — decisions**
|
||||
|
||||
1. **Seed and vet the remaining ~27 entries** (docs/13 §4, H7). This is the
|
||||
only real blocker: 5 of ~32 are in, and all 5 are `unverified` because
|
||||
`clean` requires the docs/09 §6 checklist per entry (reputation sweep +
|
||||
VirusTotal + `evidence` URL). Tagging v1.0.0 before that would rest hard
|
||||
rule 4's honesty claim on unchecked data. Also confirm any
|
||||
additions/removals — the current list leans Windows.
|
||||
2. **D16 naming convention for community projects** — "VSCodium contributors"
|
||||
vs "VSCodium Team". Answer once, or 32 entries will answer it 32 ways.
|
||||
3. **Launch announcement scope** — full notify.py fan-out, or soft-launch to
|
||||
Discord for a week of feedback first?
|
||||
1. **D16 naming convention for community projects** — "VSCodium contributors"
|
||||
vs "VSCodium Team". Answer once, or the catalogue answers it many ways.
|
||||
(Nothing in the repository records an answer — ⚠ verify.)
|
||||
2. **Sign-off on the 2026-10-21 legal rewrite** — Privacy, Terms, contacts,
|
||||
AI Disclosure. H6 approved the 2026-07-28 drafts; the rewrite is live with
|
||||
`LEGAL_VERSION` 2026-10-21 (docs/14 Part 4). ⚠ verify.
|
||||
3. **softharbor.net's Email Routing records** — no published address uses
|
||||
the domain since D27. Keep them (receive-only, harmless) or retire Email
|
||||
Routing and publish the non-sending set, `v=spf1 -all` + DMARC
|
||||
`p=reject` (docs/16 §6, H5).
|
||||
4. ~~**Suite numbering**~~ — resolved 2026-10-21: amending hard rules 1
|
||||
and 7 (D25, D26) is a *major* change by §6's own rule, so the suite is
|
||||
**2.0**, in CLAUDE.md and here alike.
|
||||
|
||||
**Repo settings (each is a silent failure until set)**
|
||||
**Open — settings (each is a silent failure until set)**
|
||||
|
||||
4. **Branch protection**: require **`ci / build` AND `ci / gates`** as required
|
||||
checks. Naming only the workflow leaves the gates job unenforced.
|
||||
5. **H10** — Settings → Actions → General → *Allow GitHub Actions to create and
|
||||
approve pull requests*, or the nightly quarantine sweep cannot open its PR
|
||||
(docs/12 §4).
|
||||
6. **Delete `CLOUDFLARE_API_TOKEN` / `CLOUDFLARE_ACCOUNT_ID`** — unused since
|
||||
deployment moved to Workers Builds (docs/12 §3).
|
||||
7. **GSC Domain property + Bing import + Crawler Hints** (docs/16 §8).
|
||||
5. **Speed Brain off** (H12) — production still sent `Speculation-Rules:
|
||||
"/cdn-cgi/speculation"` on 2026-10-21, and Cloudflare answers prefetch
|
||||
on Worker requests with a 503 (docs/16 §9).
|
||||
6. ~~**Delete `CLOUDFLARE_API_TOKEN` / `CLOUDFLARE_ACCOUNT_ID`**~~ — done:
|
||||
neither secret exists on 2026-10-23 (docs/12 §1).
|
||||
7. **GSC Domain property + sitemap + Bing import + Crawler Hints** (docs/16
|
||||
§8, H8) — the `google-site-verification` TXT is published (observed
|
||||
2026-10-21); the rest ⚠ verify.
|
||||
8. **H4** — GitHub private vulnerability reporting: `SECURITY.md`,
|
||||
`security.txt` and the issue-form config all route reports there.
|
||||
⚠ verify the setting.
|
||||
|
||||
**Live but off-spec — decide whether to reconcile**
|
||||
|
||||
8. **HSTS is already at phase P3 (`preload`)**, skipping the staged P1→P2
|
||||
burn-in docs/16 §5 designed. It works; `preload` is semi-irreversible, so
|
||||
this is now a "keep and update the doc" call rather than a go/no-go.
|
||||
9. **DMARC is `p=none`** (Cloudflare's auto record), not the `p=quarantine`
|
||||
docs/16 §6 specifies.
|
||||
10. Raster PWA icons (192/512/maskable) remain an optional upgrade — the
|
||||
manifest ships `favicon.svg` with `sizes: "any"`, per your call.
|
||||
9. **HSTS is already at phase P3 (`preload`)** — observed again on
|
||||
2026-10-21 — skipping the staged P1→P2 burn-in docs/16 §5 designed. It
|
||||
works; `preload` is semi-irreversible, so this is now a "keep and update
|
||||
the doc" call rather than a go/no-go. Whether the domain was submitted
|
||||
to hstspreload.org: ⚠ verify.
|
||||
10. **DMARC is `p=quarantine`** (observed 2026-10-21); docs/16 §6's planned
|
||||
tightening to `p=reject` has not happened.
|
||||
|
||||
**Closed**
|
||||
|
||||
11. ~~Accent hue~~ — harbor blue `oklch(0.52 0.11 235)` shipped in M1 tokens.
|
||||
11. ~~Accent hue~~ — harbor blue `oklch(0.52 0.11 235)` shipped in M1 tokens;
|
||||
the v1.1 refresh re-tuned it to `oklch(0.5 0.13 245)` (light) and
|
||||
`oklch(0.77 0.11 230)` (dark) under the contrast test (docs/06 §2).
|
||||
12. ~~**D18 / S1 blocking risk** — View Transitions under a strict CSP.~~
|
||||
**Closed 2026-07-27 by S1:** ClientRouter compiles to an external script,
|
||||
so View Transitions are safe. The real constraint was island hydration,
|
||||
handled by D20.
|
||||
handled by D20. (ClientRouter itself was removed on 2026-10-21 for
|
||||
native cross-document transitions — docs/02 §6.)
|
||||
13. ~~**S3 and S5 blocked on H1/H2/H3.**~~ Closed 2026-07-28 — both ran against
|
||||
the live origin.
|
||||
14. ~~**Seed and vet the remaining entries**~~ — closed 2026-07-30: 326 apps,
|
||||
320 `clean`, 6 `unverified`, every scan linked; v1.0.0 tagged.
|
||||
15. ~~**Launch announcement scope**~~ — moot: v1.0.0 launched on 2026-07-30.
|
||||
Tagged releases reach Discord through `notify.yml`; per-app posts are
|
||||
notify.py's, outside this repository.
|
||||
16. ~~**Branch protection**~~ — the ruleset "Run" requires `build`, `gates`
|
||||
and `codeql / Analyze (javascript-typescript)`, signed commits and linear
|
||||
history (docs/12 §8).
|
||||
17. ~~**H10**~~ — enabled; the quarantine sweep relies on it (docs/12 §4).
|
||||
18. ~~**DMARC is `p=none`**~~ — it reads `p=quarantine` now (item 10 tracks
|
||||
`p=reject`).
|
||||
19. ~~Raster PWA icons~~ — shipped in v1.1 (docs/08 Part D).
|
||||
20. ~~**`TURNSTILE_SECRET`**~~ — set; verified 2026-10-21 (`/api/verify`
|
||||
answers a junk token with `403 rejected`, not `503 not_configured`).
|
||||
|
||||
## 6. Suite maintenance
|
||||
|
||||
This suite (v1.2, 2026-07-27 — v1.1 was 2026-07-20 post-domain; v1.0 was
|
||||
2026-07-15, pre-domain) is the contract. Any implementation that
|
||||
diverges updates the relevant doc **in the same PR** (docs/10 §7-8). Version
|
||||
bumps: minor for clarifications, major when a hard rule or locked decision
|
||||
changes.
|
||||
This suite (**v4.0, 2026-11-24, describing site v1.5.0** — v3.2 was
|
||||
2026-11-15, site v1.4.1; v3.1 was 2026-11-09, site v1.4; v3.0 was 2026-10-26, site v1.3; v2.0 was 2026-10-21, site v1.1; v1.2 was
|
||||
2026-07-27; v1.1 was 2026-07-20 post-domain; v1.0 was 2026-07-15,
|
||||
pre-domain) is the contract. Mind the two numbering schemes: *suite* v1.1
|
||||
is the July domain revision, *site* v1.1 is the October release. Any
|
||||
implementation that diverges updates the relevant doc **in the same PR**
|
||||
(docs/10 §7-8). Version bumps: minor for clarifications, major when a hard
|
||||
rule or locked decision changes — v2.0 was major because it amended hard
|
||||
rules 1 and 7, v3.0 because D32 amends hard rule 1 again; v3.1 is minor
|
||||
(D33/D34 add a statement, a category and an identifier, `sh:keys`, and
|
||||
change no hard rule), and so is v3.2 (D35 adds an analyser, D36 freezes
|
||||
the feature backlog; no hard rule changes). v4.0 is major again: D38 moves
|
||||
the forge, supersedes D29 (SonarQube Cloud) and rewords hard rule 1's
|
||||
"move it to a GitHub Actions workflow" as Gitea Actions.
|
||||
|
||||
**v2.0 caught the docs up with site v1.1** — the code had moved for three
|
||||
months while the suite stood still. D25–D27 and the 2026-10-21 rows of §4
|
||||
record what changed; superseded rows are marked in their Status cell only
|
||||
(the log stays append-only); every page of the suite was re-read against
|
||||
the repository, and against live DNS and response headers where a claim
|
||||
was about the platform (D19). What neither could settle is marked
|
||||
"⚠ verify" rather than guessed.
|
||||
|
||||
**v1.2 was a correctness pass, not a feature pass** — no hard rule and no
|
||||
pre-existing locked decision changed; six blockers, ten high-severity
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
> everything zone-level: DNS, redirects, TLS/HSTS, email, robots/sitemap,
|
||||
> structured data, Search Console, and the features we deliberately keep
|
||||
> off. Platform facts below (plan gating, config keys) were re-verified
|
||||
> against Cloudflare docs on 2026-07-20.
|
||||
> against Cloudflare docs on 2026-07-20. **DNS records and response headers
|
||||
> were re-observed on 2026-10-21** (`nslookup`, `curl -I`) for suite v2.0 —
|
||||
> anything that could only be seen in the dashboard is marked ⚠ verify.
|
||||
>
|
||||
> Timing note: the domain arrived **before launch** — nothing is indexed on
|
||||
> `workers.dev`, so there is no migration, no legacy 301s, no Search Console
|
||||
@@ -16,11 +18,11 @@
|
||||
|---|---|---|
|
||||
| N1 | Canonical origin | **`https://softharbor.net`** — apex, no `www` |
|
||||
| N2 | `www.softharbor.net` | 301 → apex, path + query preserved (zone Redirect Rule) |
|
||||
| N3 | `workers.dev` main route | **Disabled** (`workers_dev: false`); PR previews stay on versioned preview URLs (`preview_urls: true` — must be explicit, since it defaults to follow `workers_dev`) |
|
||||
| N4 | Zone plan | **Free** (Workers Paid is account-level and unrelated). Consequence: Cloudflare **Custom Errors stays unavailable** (paid-zone feature) → our `/errors/*` templates remain dormant |
|
||||
| N3 | `workers.dev` main route | **Disabled** (`workers_dev: false`); versioned preview URLs stay possible (`preview_urls: true` — must be explicit, since it defaults to follow `workers_dev`), though nothing makes them since D38 |
|
||||
| N4 | Zone plan | **Free** (Workers Paid is account-level and unrelated). Consequence: Cloudflare **Custom Errors stays unavailable** (paid-zone feature) → `/errors/403` and `/errors/500` remain dormant; `/errors/429` is served by the Worker since D32, not by the zone |
|
||||
| N5 | HSTS | Zone-level, phased rollout (§5) — **not** in `_headers` |
|
||||
| N6 | Rate limiting & Bot Fight Mode | **OFF** at launch, with a ready-made activation recipe (§9) |
|
||||
| N7 | Contact email | `contact@softharbor.net` via Cloudflare Email Routing (§6) — resolves H5 |
|
||||
| N6 | Rate limiting & Bot Fight Mode | Bot Fight Mode **OFF** (§9). Rate limiting: the Worker's site-wide limit since D32 (docs/08 Part F), plus the zone rule as an optional edge layer — recipe §9.1 |
|
||||
| N7 | Contact email | ~~`contact@softharbor.net` via Cloudflare Email Routing (§6) — resolves H5~~ — ⛔ **superseded 2026-10-21 by D27**: one address per purpose at `@poli0981.dev`, mail hosted by Google (§6) |
|
||||
| N8 | Search plumbing | GSC **Domain property** + sitemap; Bing via GSC import; Crawler Hints (IndexNow) ON |
|
||||
|
||||
## 2. Zone, registrar & DNS
|
||||
@@ -42,11 +44,11 @@
|
||||
|
||||
| Type | Name | Content | Proxy | Purpose |
|
||||
|---|---|---|---|---|
|
||||
| *(auto)* | `softharbor.net` | Worker custom domain | ☁️ | created by `wrangler deploy` (§3) — do not hand-edit |
|
||||
| *(auto)* | `www` | Worker custom domain | ☁️ | **Declared in `wrangler.jsonc` routes, not added by hand.** A hand-made `AAAA www → 100::` placeholder works until the next `wrangler deploy` reconciles the Worker's triggers and removes it — the redirect then dies silently (observed 2026-07-28). Letting wrangler own the record makes it survive deploys and reproduce from a fresh clone. **Prerequisite: rule R1 (§4) must exist, or www would serve a duplicate of the site instead of redirecting.** |
|
||||
| MX ×3 + TXT (SPF) | `@` | added by Email Routing wizard | — | §6 |
|
||||
| TXT | `_dmarc` | §6 policy | — | anti-spoofing |
|
||||
| TXT | `@` | `google-site-verification=…` | — | GSC Domain property (§8) |
|
||||
| *(auto)* | `softharbor.net` | Worker custom domain | ☁️ | created when the custom domain was attached to the Worker (§3) — do not hand-edit |
|
||||
| *(auto)* | `www` | Worker custom domain | ☁️ | **Attached as a Worker Custom Domain in the dashboard** (Workers & Pages → softharbor → Domains), like the apex. History: a hand-made `AAAA www → 100::` placeholder was removed by the next `wrangler deploy`, which reconciles the Worker's triggers — the redirect then died silently (observed 2026-07-28). The fix that day was to declare both domains in `wrangler.jsonc` `routes`; later the same day (commit 66c6255) the routes were removed again and the domains attached in the dashboard instead — with **no** `routes` key, a deploy leaves the triggers untouched. A fresh clone therefore needs both re-attached by hand. **Prerequisite: rule R1 (§4) must exist, or www would serve a duplicate of the site instead of redirecting.** |
|
||||
| MX ×3 + TXT (SPF) | `@` | Cloudflare Email Routing: `route1/2/3.mx.cloudflare.net`; `v=spf1 include:_spf.mx.cloudflare.net ~all` | — | Still published (observed 2026-10-21) although no published address uses softharbor.net since D27 — keep or retire, §6 |
|
||||
| TXT | `_dmarc` | `v=DMARC1; p=quarantine; rua=…` (Cloudflare DMARC Management + the maintainer's inbox) | — | anti-spoofing — `p=quarantine` observed 2026-10-21 (§6) |
|
||||
| TXT | `@` | `google-site-verification=…` | — | GSC Domain property (§8) — present (observed 2026-10-21) |
|
||||
|
||||
No other records. CAA is optional hardening — if added, it must include
|
||||
every CA Cloudflare Universal SSL may use (check their current CA list at
|
||||
@@ -60,36 +62,45 @@ Universal SSL: automatic (nothing to do). Edge Certificates: **Minimum TLS
|
||||
terminates at the edge; there is no origin), relevant only if other records
|
||||
ever appear.
|
||||
|
||||
## 3. Attaching the Worker (IaC-first)
|
||||
## 3. Attaching the Worker (dashboard custom domains)
|
||||
|
||||
`wrangler.jsonc` delta (full file reference: docs/02 §7):
|
||||
*Originally IaC-first: the domains were declared as `routes` with
|
||||
`custom_domain: true` so a fresh clone would reproduce production. Reversed
|
||||
on 2026-07-28 (commit 66c6255) after a deploy's trigger reconciliation cost
|
||||
the `www` record (§2.2).* Today `wrangler.jsonc` (full reference: docs/02
|
||||
§7) declares **no `routes`**:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"name": "softharbor",
|
||||
"compatibility_date": "2026-07-15",
|
||||
"assets": { "directory": "./dist", "not_found_handling": "404-page" },
|
||||
"routes": [
|
||||
{ "pattern": "softharbor.net", "custom_domain": true },
|
||||
// www is declared so wrangler owns its DNS record and a deploy cannot
|
||||
// delete it (§2.2). Redirect Rule R1 (§4) keeps it from serving the site.
|
||||
{ "pattern": "www.softharbor.net", "custom_domain": true }
|
||||
],
|
||||
"main": "./worker/index.ts", // D25 + D32 — rate limit, /api/verify
|
||||
"compatibility_date": "2026-10-01",
|
||||
"assets": { "directory": "./dist", "binding": "ASSETS",
|
||||
"not_found_handling": "404-page",
|
||||
"html_handling": "drop-trailing-slash",
|
||||
"run_worker_first": ["/*", "!/_astro/*", …] }, // D32, docs/02 §7
|
||||
// No "routes": softharbor.net and www.softharbor.net are Custom Domains
|
||||
// attached in the dashboard; with no routes key a deploy leaves them be.
|
||||
"workers_dev": false, // kills softharbor.<account>.workers.dev
|
||||
"preview_urls": true // explicit — defaults to workers_dev's value
|
||||
}
|
||||
```
|
||||
|
||||
`wrangler deploy` then creates the apex DNS record and provisions the
|
||||
certificate; the custom domain appears under the Worker's *Domains &
|
||||
Routes*. Keep the route in config (not clicked in the dashboard) so a fresh
|
||||
clone reproduces production exactly.
|
||||
Both hostnames are attached under the Worker's *Domains & Routes*
|
||||
(Workers & Pages → softharbor → Domains); attaching a custom domain
|
||||
creates its DNS record and certificate. The price of the reversal: a Worker
|
||||
re-created from a fresh clone does **not** get its domains back from the
|
||||
config — re-attach `softharbor.net` and `www.softharbor.net` by hand
|
||||
(R1 must exist first), then set the runtime secret (docs/08 Part E).
|
||||
|
||||
Preview URLs after this change: PR previews keep working at
|
||||
`<version-prefix>-softharbor.<account>.workers.dev`. They are unlinked,
|
||||
short-lived, and carry no sitemap — indexing risk accepted (a static
|
||||
`_headers` file cannot vary `X-Robots-Tag` by host). Never link a preview
|
||||
URL anywhere public except the PR comment.
|
||||
Preview URLs: since D38 (2026-11-24) no pipeline makes them — Workers
|
||||
Builds made one per PR until then. A hand-made `wrangler versions upload`
|
||||
still lands at `<version-prefix>-softharbor.<account>.workers.dev`. They are unlinked,
|
||||
short-lived, carry no sitemap, and since v1.1 send **`X-Robots-Tag:
|
||||
noindex`**: `_headers` supports absolute-URL patterns with placeholders,
|
||||
and the rule `https://:version.:subdomain.workers.dev/*` matches preview
|
||||
hosts and never the production domain (docs/09 §4). Their canonicals point
|
||||
at softharbor.net anyway. Never link a preview URL anywhere public.
|
||||
|
||||
## 4. Redirects
|
||||
|
||||
@@ -97,7 +108,7 @@ URL anywhere public except the PR comment.
|
||||
|---|---|---|
|
||||
| Zone **Redirect Rules** (run before the Worker, all plans) | R1 below | host-level: `www` → apex |
|
||||
| **Always Use HTTPS** | zone setting | `http://` → `https://` |
|
||||
| `public/_redirects` (static assets) | app | path-level only: future slug renames (docs/04 §2) — cannot match hosts |
|
||||
| `public/_redirects` (static assets) | app | path-level only: future slug renames (docs/04 §2) — cannot match hosts. Not present yet: no slug has ever been renamed |
|
||||
|
||||
**R1 — www to apex** (Rules → Redirect Rules → template *"Redirect from
|
||||
WWW to Root"* or manual):
|
||||
@@ -121,30 +132,62 @@ deliberately carries no HSTS (single source of truth, docs/09 §4).
|
||||
| P2 | +2 weeks, no TLS issues | `max-age=31536000` (1 year) |
|
||||
| P3 | +1 month, optional | add `preload` ✓ and submit at hstspreload.org — **semi-irreversible** (removal from browser preload lists takes months); Kokone's explicit call (docs/15 §5) |
|
||||
|
||||
**Observed 2026-10-21:** `Strict-Transport-Security: max-age=31536000;
|
||||
includeSubDomains; preload` on the apex — the zone is at **P3** already,
|
||||
skipping the staged burn-in (docs/15 §5 item 8). Whether the domain was
|
||||
also *submitted* to hstspreload.org: ⚠ verify.
|
||||
|
||||
## 6. Email on the domain (+ anti-spoofing)
|
||||
|
||||
**Current state (2026-10-21, D27).** The site no longer publishes any
|
||||
address on this domain. Every contact is **one address per purpose at
|
||||
`@poli0981.dev`** — `security@`, `privacy@`, `legal@`, `dmca@`,
|
||||
`takedown@`, `copyright@`, `code@`, `press@`, `collab@` (table: docs/14
|
||||
Part 2; source: `src/lib/contacts.ts`) — and `security.txt` names
|
||||
`security@poli0981.dev`. Mail for `poli0981.dev` is **hosted by Google**:
|
||||
its MX records point at `aspmx.l.google.com` (+ `alt1`–`alt4`), observed
|
||||
2026-10-21. That is a different domain, whose DNS is managed outside this
|
||||
repository and outside this zone (its own DMARC read `p=none` on
|
||||
2026-10-21 — out of scope here). The Privacy Policy says mail is
|
||||
Google-hosted (`#email`). **This changes the original Email Routing plan
|
||||
below**: `contact@softharbor.net` is retired everywhere.
|
||||
|
||||
**What softharbor.net still publishes** (observed 2026-10-21): the Email
|
||||
Routing records — MX `route1/2/3.mx.cloudflare.net` and SPF
|
||||
`v=spf1 include:_spf.mx.cloudflare.net ~all` — and `_dmarc` at
|
||||
`p=quarantine`, reporting to Cloudflare's DMARC Management and the
|
||||
maintainer's inbox. Whether the old `contact@` route still forwards
|
||||
anywhere: ⚠ verify in the dashboard. Two coherent options, a decision
|
||||
rather than a cleanup (H5): **keep** the records (harmless, receive-only;
|
||||
DMARC still protects the name), or **retire** Email Routing and publish the
|
||||
non-sending-domain set — `v=spf1 -all` and DMARC `p=reject` — with no MX.
|
||||
Either way the domain sends nothing.
|
||||
|
||||
*Original plan (2026-07-20) — superseded by D27, kept for the record:*
|
||||
|
||||
**Receiving** — Cloudflare **Email Routing** (free): Email → Email Routing
|
||||
→ enable → verify the personal destination inbox → create address
|
||||
`contact@softharbor.net` → forward. The wizard writes the MX records and an
|
||||
SPF TXT (`v=spf1 include:_spf.mx.cloudflare.net ~all`). This resolves
|
||||
action item **H5**: update `<contact-email>` → `contact@softharbor.net` in
|
||||
docs/14 drafts and `security.txt` before launch.
|
||||
SPF TXT (`v=spf1 include:_spf.mx.cloudflare.net ~all`). This resolved
|
||||
action item **H5** at the time.
|
||||
|
||||
**Anti-spoofing** — add `_dmarc` TXT:
|
||||
`v=DMARC1; p=quarantine; rua=mailto:contact@softharbor.net; fo=1`
|
||||
→ after ~1 month of clean reports, tighten to `p=reject`.
|
||||
**Anti-spoofing** — add `_dmarc` TXT with `p=quarantine` and an `rua`
|
||||
reporting address → after ~1 month of clean reports, tighten to
|
||||
`p=reject`. (Live record: `p=quarantine`, above — the `p=reject` step has
|
||||
not been taken.)
|
||||
|
||||
**Sending** — the domain sends nothing in v1 (Email Routing is
|
||||
receive-only; replies go out from the personal mailbox). If a send-as setup
|
||||
(e.g. Gmail SMTP for `contact@`) is ever added, revisit SPF/DKIM/DMARC in
|
||||
the same PR — the current policy would junk such mail by design.
|
||||
**Sending** — the domain sends nothing (Email Routing is receive-only;
|
||||
replies go out from the personal mailbox). If a send-as setup is ever added
|
||||
for softharbor.net, revisit SPF/DKIM/DMARC in the same PR — the current
|
||||
policy would junk such mail by design.
|
||||
|
||||
## 7. On-page SEO
|
||||
|
||||
- **`site`**: `https://softharbor.net` in `astro.config.ts` — canonicals,
|
||||
hreflang (docs/07 §6), sitemap, RSS links, and OG URLs all derive from
|
||||
it. Grep the repo for `workers.dev` before launch; only §3's preview note
|
||||
should remain.
|
||||
it. Grep the repo for `workers.dev`: only deliberate mentions should
|
||||
remain — §3's preview note, the `_headers` preview `noindex` rule, the
|
||||
`wrangler.jsonc` comments, `CLAUDE.md` (docs/13 §2).
|
||||
- **`public/robots.txt`** (final):
|
||||
|
||||
```
|
||||
@@ -154,9 +197,11 @@ the same PR — the current policy would junk such mail by design.
|
||||
Sitemap: https://softharbor.net/sitemap-index.xml
|
||||
```
|
||||
|
||||
- **noindex surface:** `/offline` and `/errors/*` get
|
||||
- **noindex surface:** `/offline`, `/errors/*` **and `/404`** get
|
||||
`<meta name="robots" content="noindex">` (reachable but meaningless in
|
||||
SERPs). The 404 page needs nothing — its status code excludes it. Legal
|
||||
SERPs). The 404 used to rely on its status code, but `/404` requested
|
||||
directly is served with 200, so since v1.1 it carries the tag too. These
|
||||
single bilingual pages emit no hreflang alternates. Legal and contact
|
||||
pages stay indexable.
|
||||
**They must also be excluded from the sitemap**, via the `sitemap({ filter })`
|
||||
option in `astro.config.ts` (docs/02 §4). `noindex` alone is not enough:
|
||||
@@ -164,23 +209,37 @@ the same PR — the current policy would junk such mail by design.
|
||||
noindex"* on every crawl, which buries the hreflang errors we actually
|
||||
want to see (§8 monitoring cadence).
|
||||
- **Structured data (JSON-LD):**
|
||||
- `/apps/[slug]`: `SoftwareApplication` — `name`, `description`
|
||||
(locale summary), `operatingSystem` (joined platforms),
|
||||
- `/apps/[slug]` (`ShJsonLd.astro`): `SoftwareApplication` — `name`,
|
||||
`description` (locale summary), `operatingSystem` (joined platforms),
|
||||
`applicationCategory` (primary category label EN), `url` (the
|
||||
SoftHarbor page), `sameAs: [homepage, repo]`, and `offers { "@type":
|
||||
"Offer", "price": "0", "priceCurrency": "USD" }` **only when
|
||||
SoftHarbor page in that locale), `author` (an `Organization` named by
|
||||
the `developer` field), `sameAs: [homepage, repo]`, and `offers {
|
||||
"@type": "Offer", "price": "0", "priceCurrency": "USD" }` **only when
|
||||
`pricing === "free"`** — we never state amounts for `onetime`
|
||||
(truthfulness > rich-result greed). Plus `BreadcrumbList`
|
||||
(Home → category → app).
|
||||
- Site-wide: one `WebSite` node on `/`. No `SearchAction` in v1 (search
|
||||
is client-side; a `?q=` deep-link is a cheap post-v1 addition — docs/15
|
||||
§2).
|
||||
(Home → Apps → app).
|
||||
- Site-wide: one `WebSite` node on `/` and `/vi` (`inLanguage` per
|
||||
locale). No `SearchAction` yet — but since v1.1 `/apps?q=<terms>` **is**
|
||||
a working deep link (`src/lib/urlstate.ts`, docs/05 §A3), so the node is
|
||||
now possible; it is a backlog item (docs/15 §2), not a blocker.
|
||||
- JSON-LD `<script type="application/ld+json">` blocks are data blocks,
|
||||
not executable scripts, so the strict CSP (docs/09 §4) does not need
|
||||
hashes for them — verify once in the S1 spike build and note it there.
|
||||
hashes for them (confirmed in the S1 build; `check:csp` skips them
|
||||
explicitly). `<` is escaped as `<`, so a `</script>` inside a name
|
||||
or summary cannot end the block early.
|
||||
- **OG/meta:** `og:site_name`, `og:title`, `og:description` (locale
|
||||
summary), `og:url` (canonical), `og:locale` + `og:locale:alternate`,
|
||||
`twitter:card=summary`. Per-app OG images stay post-v1 (docs/15 §2).
|
||||
- **Every indexable page needs its OWN description.** App pages get the
|
||||
locale summary for free, but `/apps`, `/categories`, the 24 category pages
|
||||
and the legal pages all fell through to `site.tagline` — 47 pages sharing
|
||||
one string, which Google treats as a quality signal and usually rewrites.
|
||||
They now build from `meta.apps`, `meta.categories`, `meta.category` and
|
||||
`meta.legal` — and since v1.1 `meta.contact` — so 694 of 699 pages were
|
||||
unique when measured (2026-07-30; 701 pages at v1.1); the remainder are
|
||||
the home page (where the tagline *is* the description) and the noindex
|
||||
error pages. Legal pages also carry the `— SoftHarbor` title suffix: an
|
||||
unbranded `<title>` in a SERP reads as somebody else's document.
|
||||
|
||||
## 8. Search-engine plumbing
|
||||
|
||||
@@ -189,7 +248,9 @@ schemes):
|
||||
|
||||
1. GSC → Add property → **Domain** → `softharbor.net`.
|
||||
2. Copy the `google-site-verification=…` TXT → Cloudflare DNS (name `@`)
|
||||
→ Verify (propagation is usually minutes).
|
||||
→ Verify (propagation is usually minutes). *The TXT record is published
|
||||
(observed 2026-10-21); whether the property, the sitemap submission,
|
||||
the Bing import and Crawler Hints are done: ⚠ verify (docs/15 §5).*
|
||||
3. Post-launch: submit `https://softharbor.net/sitemap-index.xml`; URL
|
||||
Inspection on `/` and one app page; confirm hreflang pairs report clean
|
||||
after the first crawl.
|
||||
@@ -210,13 +271,76 @@ hreflang errors) — added to docs/13 §6.
|
||||
|
||||
| Feature | Status & reason | Recipe if ever needed |
|
||||
|---|---|---|
|
||||
| **Rate limiting** | OFF. Static assets are unbilled and edge-served — there is nothing costly to protect; and on the Free zone the Block action serves **Cloudflare's default 429 page** (custom responses are Business+), undermining our error-page polish. | Free zone includes **1 rule**: Security → WAF → Rate limiting rules → e.g. `(http.host eq "softharbor.net")`, 100 req / 10 s per IP, Block 1 min. Accept the default 429 page, or upgrade zone for custom response. |
|
||||
| **Bot Fight Mode** | OFF. It challenges automated clients — which would break exactly what we publish for automation: `/api/apps.json` consumers and the `notify.py` RSS cron. | Only with a scoped WAF exception for `/api/*` and `/rss.xml` — and only in response to actual abuse. |
|
||||
| **Rate limiting** (zone) | **Recommended edge layer since D32 — owner step, ⚠ verify once deployed.** The site's rate limit lives in the Worker (docs/08 Part F: 60 page requests per 10 s, our own 429 page), but measured, it holds only a client that reuses its connection; a flood opening a new connection per request slips past it. The zone rule in front of it, layer 1, counts per IP at the edge and blocks before the Worker runs (so before it is billed) — on the Free zone only with **Cloudflare's default 429 page** (custom responses need Pro), which is why it must stay looser than the Worker's limit. | §9.1 — one rule, URI Path starts with `/` and not a verified bot, **150 per 10 s per IP**, Block 10 s. (The pre-D32 recipe here named `http.host` and a 1-minute block, neither of which the Free plan offers.) |
|
||||
| **Bot Fight Mode** | OFF. It challenges automated clients — which would break exactly what we publish for automation: `/api/apps.json` consumers and the `notify.py` RSS cron. The legal gate's Turnstile check (D25) is no substitute and no conflict: it runs in visitors' browsers, after consent, and fails open. | Only with a scoped WAF exception for `/api/*` and `/rss.xml` — and only in response to actual abuse. |
|
||||
| **Speed Brain** (speculative prefetch) | **Should be OFF.** Cloudflare refuses speculative requests on Worker requests — a `Sec-Purpose: prefetch` GET gets a bare **503** with `Cf-Speculation-Refused: prefetch refused: disabled for worker requests` — which is why `astro.config.ts` sets `prefetch: false` (docs/02 §4). **Observed 2026-10-21: production still sends `Speculation-Rules: "/cdn-cgi/speculation"`**, i.e. the zone feature appears to be on (H12, ⚠ verify and turn off). | Turn the zone's Speed Brain toggle off (Speed settings in the dashboard). Revisit only if Cloudflare ever allows speculation on Worker routes. |
|
||||
| **Cloudflare Custom Errors** | Unavailable on Free zone (paid-plans feature; also never applies to 500/501/503/505). `/errors/{403,429,500}` templates stay **dormant** as designed. | Upgrade zone to Pro → Rules → Custom Error Rules → point 403/429 at the templates. Decision logged if taken. |
|
||||
| **Cache tuning / Page Rules / Snippets** | Defaults. Workers Static Assets already serves from the edge; `_headers` (docs/09 §4) owns per-path `Cache-Control`. | — |
|
||||
| **Cache tuning / Page Rules / Snippets** | Defaults. Workers Static Assets already serves from the edge; `_headers` (docs/09 §4) owns per-path `Cache-Control` — `/*` sets none and each specific rule detaches with `! Cache-Control`, because Cloudflare comma-joins a header set by several matching rules. | — |
|
||||
|
||||
### 9.1 Layer 1 at the edge — the zone rate-limiting rule (owner step)
|
||||
|
||||
Since D32 there are two layers. **Layer 1**, this zone rule, throws a
|
||||
flood out at the edge before the Worker runs — not billed, but answered
|
||||
with Cloudflare's default 429 page. **Layer 2**, the Worker's limit
|
||||
(docs/08 Part F), answers over-use from a browser or a keep-alive client
|
||||
with our own page. Layer 1 must be the looser of the two, or nobody would
|
||||
ever see our page — and it is the only one that stops a flood that opens
|
||||
a new connection per request, which the Worker's per-machine counters
|
||||
mostly miss (measured, docs/08 Part F). Recommended, not optional.
|
||||
|
||||
Free-zone constraints (Cloudflare's docs, read 2026-10-26): **one** rule;
|
||||
counted **per IP** only; the expression may use only **URI Path** and
|
||||
**Verified Bot** (no Host); period **10 s**; block duration **10 s**; the
|
||||
Block response is Cloudflare's default 429 (a custom response needs Pro).
|
||||
Use Block, not a challenge: a challenge would break `/api/apps.json` and
|
||||
RSS consumers, which cannot solve one.
|
||||
|
||||
Dashboard → the `softharbor.net` zone → **Security** → **Security rules** →
|
||||
**Create rule** → **Rate limiting rules** (older dashboards: Security → WAF
|
||||
→ Rate limiting rules):
|
||||
|
||||
1. **Rule name:** `Edge flood guard (layer 1, D32)`.
|
||||
2. **If incoming requests match:** Field **URI Path**, Operator **starts
|
||||
with**, Value `/` (every request) — **And** Field **Verified Bot**,
|
||||
Value **Off**, so search engines' verified crawlers are left to the
|
||||
Worker's limit and their own crawl-rate control. The expression preview
|
||||
should read `(starts_with(http.request.uri.path, "/") and not
|
||||
cf.client.bot)`.
|
||||
3. **Cache status:** if **Also apply rate limiting to cached assets** is
|
||||
offered, leave it **on** — every request counts.
|
||||
4. **With the same characteristics:** **IP** (the only choice on Free).
|
||||
5. **When rate exceeds:** **150** requests per **10 seconds**.
|
||||
6. **Then take action:** **Block**; **Duration:** **10 seconds**.
|
||||
7. **Deploy.**
|
||||
|
||||
**Why 150.** The rule counts everything — each page's CSS, JS and fonts
|
||||
(about fifteen requests for a first page load, cached afterwards) and the
|
||||
Worker's own 429s — while the Worker allows 60 page requests per 10 s. 150
|
||||
is out of reach for any person, above the Worker's limit so over-use meets
|
||||
our page first, and far below a flood. Never set it under ~100.
|
||||
|
||||
**Verify** once it is deployed, from one machine — hammer a file the
|
||||
Worker never sees (an asset-first path), so only layer 1 can answer:
|
||||
|
||||
```bash
|
||||
seq 1 200 | xargs -P 20 -I{} curl -s -o /dev/null -w "%{http_code}\n" https://softharbor.net/favicon.svg | sort | uniq -c
|
||||
```
|
||||
|
||||
Expect roughly 150 × `200` and the rest `429` (Cloudflare's page, not
|
||||
ours); ten seconds later the file answers `200` again. **Roll back** by
|
||||
turning the rule off on the same page — nothing in the repository depends
|
||||
on it.
|
||||
|
||||
## 10. Rollout sequence & verification
|
||||
|
||||
> **Status 2026-10-21.** The rollout below is complete and historical: www
|
||||
> redirects (R1), HSTS is at P3, DMARC is `p=quarantine`, the noindex header
|
||||
> is long gone and the GSC verification record is published (§2.2, §5, §6).
|
||||
> What recurs is the **verification after every merge** — and before it,
|
||||
> waiting for the merge commit's CI run — its `deploy` job — to go green:
|
||||
> the runner is the maintainer's PC, so an unchanged site right after a
|
||||
> merge usually means "not deployed yet", not "broken" (docs/13 §3, D38). The edge-propagation note below applies on top.
|
||||
>
|
||||
> **Status 2026-07-27 — apex is LIVE.** `wrangler deploy` created the apex DNS
|
||||
> record and provisioned the certificate; `https://softharbor.net` serves the
|
||||
> M1 skeleton. Verified: http → https 301, apex 200, `/nope` → branded 404,
|
||||
@@ -250,9 +374,10 @@ Order (fits between M5 and M6 of docs/15 — roughly one focused day):
|
||||
|
||||
1. Zone added → NS live (external registrar) → DNSSEC on.
|
||||
2. Email Routing + DMARC → `contact@softharbor.net` receiving → update
|
||||
docs/14 + `security.txt` (H5 ✅).
|
||||
docs/14 + `security.txt` (H5 ✅ at the time; superseded 2026-10-21 by
|
||||
D27 — §6).
|
||||
3. `wrangler.jsonc` routes/workers_dev/preview_urls change → deploy →
|
||||
apex live.
|
||||
apex live. (The routes later moved to dashboard custom domains — §3.)
|
||||
4. `www` placeholder record + Redirect Rule R1 → Always Use HTTPS on.
|
||||
5. HSTS phase P1 on.
|
||||
6. `site` config + robots.txt + JSON-LD + noindex metas land in the repo.
|
||||
@@ -277,11 +402,22 @@ dig TXT _dmarc.softharbor.net +short # DMARC policy present
|
||||
curl -sI https://softharbor.net/apps/7-zip
|
||||
curl -sI https://softharbor.net/apps/7-zip/
|
||||
|
||||
# CSP must show script-src 'self' with NO sha256- token (docs/09 §4, D18).
|
||||
# Header CSP is ONLY frame-ancestors (D20, docs/09 §4) — script-src/style-src
|
||||
# live in the per-page meta tag, which must list the two Cloudflare origins.
|
||||
curl -sI https://softharbor.net/ | grep -i content-security-policy
|
||||
curl -s https://softharbor.net/ | grep -o '<meta http-equiv="content-security-policy"[^>]*>'
|
||||
|
||||
# Hashed assets must win the immutable cache rule over the /* default.
|
||||
# Hashed assets: exactly ONE Cache-Control, the immutable one — never a
|
||||
# comma-joined "max-age=0 …, max-age=31536000" (docs/09 §4).
|
||||
curl -sI https://softharbor.net/_astro/<any-hashed-file> | grep -i cache-control
|
||||
|
||||
# The Worker answers /api/verify (D25): a junk token → 403 {"error":"rejected"};
|
||||
# 503 "not_configured" = runtime secret missing; a bare 405 = Worker not live.
|
||||
curl -s -X POST -H 'Origin: https://softharbor.net' -H 'Content-Type: application/json' \
|
||||
-d '{"token":"x"}' https://softharbor.net/api/verify
|
||||
|
||||
# Speed Brain off: no Speculation-Rules header (§9).
|
||||
curl -sI https://softharbor.net/ | grep -i speculation-rules
|
||||
```
|
||||
|
||||
Plus: hstspreload.org checker (informational until P3), a DMARC report
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// Accessibility beyond the page-by-page axe sweep in smoke.spec.ts
|
||||
// (ACCESSIBILITY.md, docs/11 §4): axe on the OPEN dialogs, the keyboard paths
|
||||
// (skip link, focus return, the "/" switch), reflow at 320 CSS px, and forced
|
||||
// colours. The owner's manual keyboard + Narrator pass (2026-11-09) is the
|
||||
// human half of the same checklist.
|
||||
|
||||
import {
|
||||
acceptGate,
|
||||
axeViolations,
|
||||
expect,
|
||||
settled,
|
||||
stubTurnstile,
|
||||
test,
|
||||
waitForIsland,
|
||||
} from './fixtures';
|
||||
|
||||
test.describe('open dialogs pass axe', () => {
|
||||
test('the legal gate', async ({ page }) => {
|
||||
await stubTurnstile(page);
|
||||
await page.goto('/apps');
|
||||
const gate = page.getByTestId('sh-legal-gate');
|
||||
await expect(gate).toBeVisible();
|
||||
await settled(page);
|
||||
expect(await axeViolations(page)).toEqual([]);
|
||||
});
|
||||
|
||||
test('the filter sheet', async ({ page }) => {
|
||||
await acceptGate(page);
|
||||
await page.goto('/apps');
|
||||
await waitForIsland(page, 'ShFilterSheet');
|
||||
await page.getByRole('button', { name: /^Filters/ }).click();
|
||||
await expect(page.getByRole('dialog', { name: 'Filters' })).toBeVisible();
|
||||
await settled(page);
|
||||
expect(await axeViolations(page)).toEqual([]);
|
||||
});
|
||||
|
||||
test('the display menu', async ({ page }) => {
|
||||
await acceptGate(page);
|
||||
await page.goto('/');
|
||||
await waitForIsland(page, 'ShPrefs');
|
||||
await page.getByRole('button', { name: 'Display settings' }).click();
|
||||
await expect(page.getByTestId('sh-prefs')).toBeVisible();
|
||||
await settled(page);
|
||||
expect(await axeViolations(page)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('keyboard', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await acceptGate(page);
|
||||
});
|
||||
|
||||
test('the first Tab reaches the skip link, which jumps past the header', async ({ page }) => {
|
||||
await page.goto('/apps/7-zip');
|
||||
await page.keyboard.press('Tab');
|
||||
const skip = page.getByRole('link', { name: 'Skip to content' });
|
||||
await expect(skip).toBeFocused();
|
||||
await expect(skip).toBeInViewport();
|
||||
await page.keyboard.press('Enter');
|
||||
await page.keyboard.press('Tab');
|
||||
// The next stop is inside <main>, not the header's first link.
|
||||
expect(await page.evaluate(() => document.activeElement?.closest('main') !== null)).toBe(true);
|
||||
});
|
||||
|
||||
test('closing the filter sheet with Esc returns focus to its button', async ({ page }) => {
|
||||
await page.goto('/apps');
|
||||
await waitForIsland(page, 'ShFilterSheet');
|
||||
const button = page.getByRole('button', { name: /^Filters/ });
|
||||
await button.focus();
|
||||
await page.keyboard.press('Enter');
|
||||
await expect(page.getByRole('dialog', { name: 'Filters' })).toBeVisible();
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByRole('dialog', { name: 'Filters' })).toBeHidden();
|
||||
await expect(button).toBeFocused();
|
||||
});
|
||||
|
||||
test('closing the display menu with Esc returns focus to its button', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await waitForIsland(page, 'ShPrefs');
|
||||
const button = page.getByRole('button', { name: 'Display settings' });
|
||||
await button.focus();
|
||||
await page.keyboard.press('Enter');
|
||||
const panel = page.getByTestId('sh-prefs');
|
||||
await expect(panel).toBeVisible();
|
||||
await page.keyboard.press('Tab');
|
||||
await expect(panel.getByRole('radio', { name: 'System' }).first()).toBeFocused();
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(panel).toBeHidden();
|
||||
await expect(button).toBeFocused();
|
||||
});
|
||||
|
||||
test('the focused choice in the display menu shows a ring of its own (2.4.7)', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
await waitForIsland(page, 'ShPrefs');
|
||||
await page.getByRole('button', { name: 'Display settings' }).click();
|
||||
await page.keyboard.press('Tab'); // the checked "System" theme radio
|
||||
const ring = await page
|
||||
.getByTestId('sh-prefs')
|
||||
.locator('input:focus-visible + span')
|
||||
.evaluate((el) => {
|
||||
const s = getComputedStyle(el);
|
||||
return { outline: s.outlineStyle, color: s.outlineColor, fill: s.backgroundColor };
|
||||
});
|
||||
expect(ring.outline).toBe('solid');
|
||||
expect(ring.color).not.toBe(ring.fill);
|
||||
});
|
||||
|
||||
test('"/" can be turned off, and then does nothing (2.1.4)', async ({ page }) => {
|
||||
await page.goto('/categories');
|
||||
await waitForIsland(page, 'ShPrefs');
|
||||
await page.getByRole('button', { name: 'Display settings' }).click();
|
||||
await page.getByTestId('sh-prefs').getByRole('radio', { name: 'Off' }).check();
|
||||
await expect(page.locator('html')).toHaveAttribute('data-keys', 'off');
|
||||
await page.keyboard.press('Escape');
|
||||
|
||||
await page.keyboard.press('/');
|
||||
await expect(page).toHaveURL(/\/categories$/);
|
||||
|
||||
// Restored before paint on the next page: no hint, no shortcut.
|
||||
await page.goto('/apps');
|
||||
await waitForIsland(page, 'ShSearch');
|
||||
await expect(page.locator('html')).toHaveAttribute('data-keys', 'off');
|
||||
await expect(page.locator('#sh-search')).toHaveAttribute('placeholder', 'Search apps…');
|
||||
await page.keyboard.press('/');
|
||||
await expect(page.locator('#sh-search')).not.toBeFocused();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('reflow at 320 CSS px (1.4.10)', () => {
|
||||
// The phone project already runs at 412 px; this is the WCAG width.
|
||||
test.skip(({ isMobile }) => isMobile, 'desktop project only');
|
||||
test.use({ viewport: { width: 320, height: 640 } });
|
||||
|
||||
for (const path of [
|
||||
'/',
|
||||
'/apps',
|
||||
'/apps/7-zip',
|
||||
'/categories',
|
||||
'/contact',
|
||||
'/legal/privacy',
|
||||
'/legal/third-party',
|
||||
'/legal/accessibility',
|
||||
'/vi',
|
||||
'/vi/apps',
|
||||
'/vi/apps/7-zip',
|
||||
'/vi/legal/accessibility',
|
||||
'/offline',
|
||||
]) {
|
||||
test(`${path} does not scroll sideways`, async ({ page }) => {
|
||||
await acceptGate(page);
|
||||
await page.goto(path);
|
||||
await settled(page);
|
||||
const overflow = await page.evaluate(
|
||||
() => document.documentElement.scrollWidth - document.documentElement.clientWidth,
|
||||
);
|
||||
expect(overflow, 'horizontal overflow in px').toBeLessThanOrEqual(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test.describe('forced colours (Windows contrast themes)', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await acceptGate(page);
|
||||
await page.emulateMedia({ forcedColors: 'active' });
|
||||
});
|
||||
|
||||
test('the current section is still marked without its accent rule', async ({ page }) => {
|
||||
await page.goto('/apps');
|
||||
const current = page.locator('header nav a[aria-current="page"]');
|
||||
await expect(current).toHaveCSS('text-decoration-line', 'underline');
|
||||
});
|
||||
|
||||
test('the chosen display options and language keep a visible fill', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await waitForIsland(page, 'ShPrefs');
|
||||
await page.getByRole('button', { name: 'Display settings' }).click();
|
||||
const fills = await page.evaluate(() => {
|
||||
const bg = (el: Element | null) => (el ? getComputedStyle(el).backgroundColor : null);
|
||||
return {
|
||||
checked: bg(document.querySelector('#sh-prefs input:checked + span')),
|
||||
unchecked: bg(document.querySelector('#sh-prefs input:not(:checked) + span')),
|
||||
lang: bg(document.querySelector('[data-testid="sh-lang-switch"] [aria-current="true"]')),
|
||||
other: bg(document.querySelector('[data-testid="sh-lang-switch"] a')),
|
||||
};
|
||||
});
|
||||
expect(fills.checked).not.toBe(fills.unchecked);
|
||||
expect(fills.lang).not.toBe(fills.other);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,174 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// Shared e2e fixture: every test fails if its page logged a console error, an
|
||||
// uncaught exception or a Content-Security-Policy violation.
|
||||
//
|
||||
// CSP violations are collected from the `securitypolicyviolation` event — the
|
||||
// policy is a <meta> tag, which cannot carry report-uri/report-to, so the
|
||||
// event is the only signal (errors.js records the same thing for bug reports).
|
||||
//
|
||||
// Messages from inside Cloudflare's Turnstile iframe are ignored: that frame
|
||||
// enforces its own CSP and logs violations for probes it makes itself
|
||||
// (hagen./brunhild.challenges.cloudflare.com), which no page can change.
|
||||
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { expect, test as base, type Page } from '@playwright/test';
|
||||
import { PASS_TTL_MS } from '../src/lib/human';
|
||||
import { LEGAL_VERSION } from '../src/lib/legal';
|
||||
|
||||
/** Cloudflare's challenge hosts (the Turnstile frame and its probes). */
|
||||
function fromTurnstileFrame(url: string): boolean {
|
||||
try {
|
||||
const host = new URL(url).hostname;
|
||||
return host === 'challenges.cloudflare.com' || host.endsWith('.challenges.cloudflare.com');
|
||||
} catch {
|
||||
return false; // no location at all — not the frame's
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__shCsp?: string[];
|
||||
}
|
||||
}
|
||||
|
||||
export const test = base.extend<{ issues: string[]; allowConsole: RegExp[] }>({
|
||||
/**
|
||||
* Console errors a test EXPECTS, e.g. Chrome's "status of 404" line for a
|
||||
* 404 document. Set with `test.use({ allowConsole: [/…/] })`.
|
||||
*/
|
||||
allowConsole: [[], { option: true }],
|
||||
issues: [
|
||||
async ({ page, allowConsole }, use) => {
|
||||
const issues: string[] = [];
|
||||
await page.addInitScript(() => {
|
||||
window.__shCsp = [];
|
||||
document.addEventListener('securitypolicyviolation', (e) => {
|
||||
window.__shCsp?.push(`${e.effectiveDirective} blocked ${e.blockedURI || 'inline'}`);
|
||||
});
|
||||
});
|
||||
page.on('console', (msg) => {
|
||||
if (msg.type() !== 'error') return;
|
||||
if (fromTurnstileFrame(msg.location().url)) return;
|
||||
if (allowConsole.some((re) => re.test(msg.text()))) return;
|
||||
issues.push(`console: ${msg.text()}`);
|
||||
});
|
||||
page.on('pageerror', (err) => issues.push(`pageerror: ${err.message}`));
|
||||
|
||||
await use(issues);
|
||||
|
||||
const csp = await page.evaluate(() => window.__shCsp ?? []).catch(() => []);
|
||||
expect(
|
||||
[...issues, ...csp.map((c) => `csp: ${c}`)],
|
||||
'console errors / CSP violations',
|
||||
).toEqual([]);
|
||||
},
|
||||
{ auto: true },
|
||||
],
|
||||
});
|
||||
|
||||
export { expect };
|
||||
|
||||
/**
|
||||
* Waits until an island has hydrated (Astro removes `ssr` from its
|
||||
* <astro-island>). `client:idle` islands hydrate after load, so acting on
|
||||
* them straight after `goto` races the hydration.
|
||||
*/
|
||||
export async function waitForIsland(page: Page, name: string): Promise<void> {
|
||||
await page.waitForFunction((n) => {
|
||||
const island = document.querySelector(`astro-island[component-url*="${n}"]`);
|
||||
return island !== null && !island.hasAttribute('ssr');
|
||||
}, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves once every finite animation on the page has finished. The pages
|
||||
* rise into place on load (global.css `sh-rise`); axe measures colour
|
||||
* contrast with the element's CURRENT opacity, so scanning mid-fade reports
|
||||
* contrast failures that no settled page has.
|
||||
*/
|
||||
export async function settled(page: Page): Promise<void> {
|
||||
await page.evaluate(() =>
|
||||
Promise.all(
|
||||
document
|
||||
.getAnimations()
|
||||
.filter((a) => a.effect?.getComputedTiming().iterations !== Infinity)
|
||||
.map((a) => a.finished.catch(() => undefined)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/** The WCAG A/AA rule sets the site targets (ACCESSIBILITY.md, WCAG 2.2 AA). */
|
||||
const WCAG_TAGS = ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa'];
|
||||
|
||||
/**
|
||||
* axe findings that fail a test: critical, serious AND moderate (v1.4; minor
|
||||
* ones are left to review). One line per rule, so a failure names the rule
|
||||
* and the first offending node. `include` narrows the scan to one component.
|
||||
*/
|
||||
export async function axeViolations(
|
||||
page: Page,
|
||||
{ include }: { include?: string } = {},
|
||||
): Promise<string[]> {
|
||||
let builder = new AxeBuilder({ page }).withTags(WCAG_TAGS);
|
||||
if (include) builder = builder.include(include);
|
||||
const results = await builder.analyze();
|
||||
return results.violations
|
||||
.filter((v) => v.impact === 'critical' || v.impact === 'serious' || v.impact === 'moderate')
|
||||
.map(
|
||||
(v) => `${v.id} (${v.impact}): ${v.nodes.length} node(s) — ${v.nodes[0]?.target.join(' ')}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-accept the legal gate (the current version) AND its human check, before
|
||||
* the page loads — for tests about something other than the gate.
|
||||
*/
|
||||
export async function acceptGate(page: Page): Promise<void> {
|
||||
await page.addInitScript(
|
||||
([version, ttl]) => {
|
||||
try {
|
||||
localStorage.setItem('sh:legal', version);
|
||||
localStorage.setItem('sh:human', String(Date.now() + ttl));
|
||||
} catch {
|
||||
/* storage blocked: the gate will show, and the test will say so */
|
||||
}
|
||||
},
|
||||
[LEGAL_VERSION, PASS_TTL_MS - 60_000] as const,
|
||||
);
|
||||
}
|
||||
|
||||
/** A stand-in for Cloudflare's api.js: a widget that hands over a token at once. */
|
||||
const FAKE_TURNSTILE = `window.turnstile = {
|
||||
render(el, options) { setTimeout(() => options.callback('e2e-token'), 50); return 'w1'; },
|
||||
reset() {},
|
||||
remove() {},
|
||||
};`;
|
||||
|
||||
/**
|
||||
* Stands in for Cloudflare in the gate's step 2: api.js becomes FAKE_TURNSTILE
|
||||
* (served from its real URL, so the page's CSP is still exercised), and
|
||||
* /api/verify — which `astro preview` does not run — answers `status`.
|
||||
* `'blocked'` makes api.js fail to load instead. Returns the tokens posted.
|
||||
*/
|
||||
export async function stubTurnstile(
|
||||
page: Page,
|
||||
status: number | 'blocked' = 200,
|
||||
): Promise<string[]> {
|
||||
const tokens: string[] = [];
|
||||
await page.route('https://challenges.cloudflare.com/turnstile/v0/api.js*', (route) =>
|
||||
status === 'blocked'
|
||||
? route.abort('blockedbyclient')
|
||||
: route.fulfill({ contentType: 'text/javascript', body: FAKE_TURNSTILE }),
|
||||
);
|
||||
await page.route('**/api/verify', async (route) => {
|
||||
tokens.push(String((route.request().postDataJSON() as { token?: unknown }).token));
|
||||
await route.fulfill({
|
||||
status: status === 'blocked' ? 503 : status,
|
||||
contentType: 'application/json',
|
||||
body: status === 200 ? '{"ok":true}' : '{"error":"unavailable"}',
|
||||
});
|
||||
});
|
||||
return tokens;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// The legal gate in a real browser: top layer, the platform's Esc handling
|
||||
// (closedby="none" + re-open), persistence, page-declared exemptions — and
|
||||
// step 2, the Turnstile check, with Cloudflare stood in for (fixtures.ts
|
||||
// stubTurnstile): only after acceptance, remembered when it passes, and never
|
||||
// a dead end when it cannot run.
|
||||
|
||||
import type { Page } from '@playwright/test';
|
||||
import { LEGAL_VERSION } from '../src/lib/legal';
|
||||
import { expect, stubTurnstile, test } from './fixtures';
|
||||
|
||||
const HOUR = 3_600_000;
|
||||
|
||||
/** Milliseconds until the stored check lapses, read from the page. */
|
||||
const humanFor = (page: Page) =>
|
||||
page.evaluate(() => Number(localStorage.getItem('sh:human')) - Date.now());
|
||||
|
||||
test('blocks a first-time visitor until accepted and checked, and remembers both', async ({
|
||||
page,
|
||||
}) => {
|
||||
const tokens = await stubTurnstile(page);
|
||||
const scripts: string[] = [];
|
||||
page.on('request', (r) => {
|
||||
if (new URL(r.url()).hostname === 'challenges.cloudflare.com') scripts.push(r.url());
|
||||
});
|
||||
|
||||
await page.goto('/apps');
|
||||
const gate = page.getByRole('dialog', { name: 'Before you continue' });
|
||||
await expect(gate).toBeVisible();
|
||||
|
||||
// Esc twice — Chromium's close watcher only honours preventDefault() on
|
||||
// `cancel` after user activation; the gate must survive either way.
|
||||
await page.keyboard.press('Escape');
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(gate).toBeVisible();
|
||||
// Nothing of Cloudflare's is fetched before the documents are accepted.
|
||||
expect(scripts).toEqual([]);
|
||||
|
||||
await page.getByTestId('sh-legal-accept').click();
|
||||
await expect(page.getByTestId('sh-legal-gate')).toBeHidden();
|
||||
expect(tokens).toEqual(['e2e-token']);
|
||||
expect(scripts).toHaveLength(1);
|
||||
expect(await humanFor(page)).toBeGreaterThan(47 * HOUR);
|
||||
|
||||
await page.reload();
|
||||
await expect(page.getByTestId('sh-legal-gate')).toHaveCount(1); // still rendered…
|
||||
await expect(page.getByTestId('sh-legal-gate')).toBeHidden(); // …but not shown again
|
||||
});
|
||||
|
||||
test.describe('when the check cannot run', () => {
|
||||
// The browser reports the blocked script itself; that line is the scenario.
|
||||
test.use({ allowConsole: [/ERR_BLOCKED_BY_CLIENT/] });
|
||||
|
||||
test('lets the person through, says so, and asks again within the hour', async ({ page }) => {
|
||||
await stubTurnstile(page, 'blocked');
|
||||
await page.goto('/vi/apps');
|
||||
await page.getByTestId('sh-legal-accept').click();
|
||||
await expect(page.getByTestId('sh-gate-status')).toHaveText(
|
||||
'Không chạy được bước kiểm tra nên đã bỏ qua. Mời bạn vào trang.',
|
||||
);
|
||||
await expect(page.getByTestId('sh-legal-gate')).toBeHidden();
|
||||
const left = await humanFor(page);
|
||||
expect(left).toBeGreaterThan(0);
|
||||
expect(left).toBeLessThanOrEqual(HOUR);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('when /api/verify is down', () => {
|
||||
test.use({ allowConsole: [/status of 503/] });
|
||||
|
||||
test('fails open the same way', async ({ page }) => {
|
||||
await stubTurnstile(page, 503);
|
||||
await page.goto('/apps');
|
||||
await page.getByTestId('sh-legal-accept').click();
|
||||
await expect(page.getByTestId('sh-legal-gate')).toBeHidden();
|
||||
expect(await humanFor(page)).toBeLessThanOrEqual(HOUR);
|
||||
});
|
||||
});
|
||||
|
||||
test('a lapsed check re-runs step 2 only', async ({ page }) => {
|
||||
const tokens = await stubTurnstile(page);
|
||||
await page.addInitScript((version) => localStorage.setItem('sh:legal', version), LEGAL_VERSION);
|
||||
await page.goto('/categories');
|
||||
const gate = page.getByTestId('sh-legal-gate');
|
||||
await expect(gate).toHaveAttribute('data-step', 'verify');
|
||||
await expect(page.getByTestId('sh-legal-accept')).toHaveCount(0);
|
||||
await expect(gate).toBeHidden();
|
||||
expect(tokens).toEqual(['e2e-token']);
|
||||
});
|
||||
|
||||
test('links the documents it asks you to accept, which are exempt', async ({ page }) => {
|
||||
await page.goto('/vi/apps');
|
||||
const gate = page.getByRole('dialog');
|
||||
await expect(gate).toBeVisible();
|
||||
await gate.getByRole('link', { name: 'Chính sách quyền riêng tư' }).click();
|
||||
await expect(page).toHaveURL(/\/vi\/legal\/privacy$/);
|
||||
// Legal pages never render the gate island at all.
|
||||
await expect(page.getByTestId('sh-legal-gate')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test.describe('exempt pages', () => {
|
||||
test.use({ allowConsole: [/status of 404/] });
|
||||
|
||||
test('error and offline pages are exempt', async ({ page }) => {
|
||||
await page.goto('/offline');
|
||||
await expect(page.getByTestId('sh-legal-gate')).toHaveCount(0);
|
||||
await page.goto('/no-such-page');
|
||||
await expect(page.getByTestId('sh-legal-gate')).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// Display preferences and search, end to end.
|
||||
|
||||
import { acceptGate, expect, test, waitForIsland } from './fixtures';
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await acceptGate(page);
|
||||
});
|
||||
|
||||
test('display choices apply at once and are restored before paint', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
await waitForIsland(page, 'ShPrefs');
|
||||
await page.getByRole('button', { name: 'Display settings' }).click();
|
||||
const panel = page.getByTestId('sh-prefs');
|
||||
await expect(panel).toBeVisible();
|
||||
|
||||
await panel.getByRole('radio', { name: 'Dark' }).check();
|
||||
await panel.getByRole('radio', { name: 'Hidden' }).check();
|
||||
await panel.getByRole('radio', { name: 'Reduce' }).check();
|
||||
|
||||
const html = page.locator('html');
|
||||
await expect(html).toHaveAttribute('data-theme', 'dark');
|
||||
await expect(html).toHaveAttribute('data-scrollbar', 'hidden');
|
||||
await expect(html).toHaveAttribute('data-motion', 'reduce');
|
||||
|
||||
// A fresh document: theme.js must re-apply all three before any island.
|
||||
await page.goto('/apps');
|
||||
await expect(html).toHaveAttribute('data-theme', 'dark');
|
||||
await expect(html).toHaveAttribute('data-scrollbar', 'hidden');
|
||||
await expect(html).toHaveAttribute('data-motion', 'reduce');
|
||||
});
|
||||
|
||||
test('"/" from any page goes to search', async ({ page }) => {
|
||||
await page.goto('/categories');
|
||||
await waitForIsland(page, 'ShPrefs');
|
||||
await page.keyboard.press('/');
|
||||
await expect(page).toHaveURL(/\/apps#search$/);
|
||||
await expect(page.locator('#sh-search')).toBeFocused();
|
||||
});
|
||||
|
||||
test('Vietnamese search ignores diacritics and lands in the URL', async ({ page }) => {
|
||||
await page.goto('/vi/apps');
|
||||
await waitForIsland(page, 'ShSearch');
|
||||
const box = page.locator('#sh-search');
|
||||
await box.fill('trinh duyet');
|
||||
await expect(page.locator('[data-slug="firefox"]')).toBeVisible();
|
||||
await expect(page.locator('[data-slug="7-zip"]')).toBeHidden();
|
||||
await expect(page).toHaveURL(/\?q=trinh\+duyet/);
|
||||
await expect(page.locator('#sh-sort')).toHaveValue('relevance');
|
||||
});
|
||||
|
||||
test('a shared URL restores the view, and "Clear all" really clears it', async ({ page }) => {
|
||||
await page.goto('/apps?q=gimp&platform=linux');
|
||||
await waitForIsland(page, 'ShSearch');
|
||||
await waitForIsland(page, 'ShFilterSheet');
|
||||
await expect(page.locator('#sh-search')).toHaveValue('gimp');
|
||||
await expect(page.locator('[data-slug="gimp"]')).toBeVisible();
|
||||
await expect(page.locator('[data-slug="7-zip"]')).toBeHidden();
|
||||
|
||||
await page.getByRole('button', { name: /^Filters/ }).click();
|
||||
await page.getByRole('button', { name: 'Clear all' }).click();
|
||||
await page.keyboard.press('Escape');
|
||||
|
||||
await expect(page.locator('#sh-search')).toHaveValue('');
|
||||
await expect(page.locator('[data-slug="7-zip"]')).toBeVisible();
|
||||
// Every card is back (no hard-coded total: the catalogue grows).
|
||||
await expect(page.locator('#sh-grid [data-slug][hidden]')).toHaveCount(0);
|
||||
});
|
||||
@@ -0,0 +1,95 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// Every page type, both locales, both colour schemes: renders, no console
|
||||
// errors, no CSP violations (fixture), and no critical, serious or moderate
|
||||
// axe findings against the WCAG A/AA rules (ACCESSIBILITY.md). Open dialogs,
|
||||
// keyboard paths, reflow and forced colours: e2e/a11y.spec.ts.
|
||||
|
||||
import { acceptGate, axeViolations, expect, settled, test } from './fixtures';
|
||||
|
||||
const PAGES = [
|
||||
'/',
|
||||
'/apps',
|
||||
'/apps/7-zip',
|
||||
'/categories',
|
||||
'/categories/browser',
|
||||
'/legal/privacy',
|
||||
'/legal/terms',
|
||||
'/legal/third-party',
|
||||
'/legal/accessibility',
|
||||
'/vi',
|
||||
'/vi/apps',
|
||||
'/vi/apps/7-zip',
|
||||
'/vi/categories/security-privacy',
|
||||
'/vi/legal/disclaimer',
|
||||
'/vi/legal/accessibility',
|
||||
'/offline',
|
||||
'/contact',
|
||||
'/vi/contact',
|
||||
];
|
||||
|
||||
for (const path of PAGES) {
|
||||
test(`${path} renders cleanly`, async ({ page }) => {
|
||||
await acceptGate(page);
|
||||
const res = await page.goto(path);
|
||||
expect(res?.status()).toBeLessThan(400);
|
||||
await expect(page.locator('h1').first()).toBeVisible();
|
||||
// The pre-paint script ran: a theme is always resolved.
|
||||
await expect(page.locator('html')).toHaveAttribute('data-theme', /^(light|dark)$/);
|
||||
// Nothing pokes past the right edge. On a phone that is not a scrollbar
|
||||
// but a zoomed-out page (the layout viewport widens to fit), and it
|
||||
// happened twice in v1.1 — a grid sized by min-content, then decoration.
|
||||
const overflow = await page.evaluate(
|
||||
() => document.documentElement.scrollWidth - document.documentElement.clientWidth,
|
||||
);
|
||||
expect(overflow, 'horizontal overflow in px').toBeLessThanOrEqual(0);
|
||||
});
|
||||
}
|
||||
|
||||
test.describe('404', () => {
|
||||
// Chrome logs every 404 document as a console error; that one is expected.
|
||||
test.use({ allowConsole: [/status of 404/] });
|
||||
|
||||
test('an unknown URL gets the 404 page, without the gate', async ({ page }) => {
|
||||
const res = await page.goto('/this-page-does-not-exist');
|
||||
expect(res?.status()).toBe(404);
|
||||
await expect(page.locator('h1')).toContainText("That page isn't here");
|
||||
await expect(page.getByTestId('sh-legal-gate')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('the 404 page has no accessibility violations', async ({ page }) => {
|
||||
await page.goto('/this-page-does-not-exist');
|
||||
await settled(page);
|
||||
expect(await axeViolations(page)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
/** Every page TYPE in both locales, plus the pages with tables and contact rows. */
|
||||
const AXE_PAGES = [
|
||||
'/',
|
||||
'/apps',
|
||||
'/apps/7-zip',
|
||||
'/categories',
|
||||
'/categories/browser',
|
||||
'/contact',
|
||||
'/legal/privacy',
|
||||
'/legal/third-party',
|
||||
'/legal/accessibility',
|
||||
'/offline',
|
||||
'/vi',
|
||||
'/vi/apps',
|
||||
'/vi/apps/7-zip',
|
||||
];
|
||||
|
||||
for (const scheme of ['light', 'dark'] as const) {
|
||||
for (const path of AXE_PAGES) {
|
||||
test(`${path} has no accessibility violations (${scheme})`, async ({ page }) => {
|
||||
await page.emulateMedia({ colorScheme: scheme });
|
||||
await acceptGate(page);
|
||||
await page.goto(path);
|
||||
await settled(page);
|
||||
expect(await axeViolations(page)).toEqual([]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// The Worker end to end (D32): `wrangler dev` serves dist/ with the real
|
||||
// wrangler.jsonc — run_worker_first and its negative patterns, both rate
|
||||
// limiters (simulated by Miniflare), public/_headers — so a flood can be
|
||||
// thrown at it and the 429s inspected.
|
||||
//
|
||||
// Miniflare counts in fixed windows aligned to the wall clock, and a refused
|
||||
// request does not count. So each test that needs a clean slate or a
|
||||
// refusal first waits for the next window, which also makes a retried or
|
||||
// re-used server start from zero.
|
||||
|
||||
import type { APIRequestContext } from '@playwright/test';
|
||||
import { unstable_readConfig } from 'wrangler';
|
||||
import { expect, test } from './fixtures';
|
||||
|
||||
test.describe.configure({ mode: 'serial' });
|
||||
|
||||
/** What this spec reads of wrangler.jsonc (wrangler's own Config type does not resolve here). */
|
||||
interface WranglerConfig {
|
||||
ratelimits: { name: string; simple: { limit: number; period: number } }[];
|
||||
}
|
||||
|
||||
const site = (
|
||||
unstable_readConfig({ config: 'wrangler.jsonc' }, { hideWarnings: true }) as WranglerConfig
|
||||
).ratelimits.find((r) => r.name === 'SITE_LIMITER');
|
||||
const LIMIT = site?.simple.limit ?? 0;
|
||||
const PERIOD_MS = (site?.simple.period ?? 10) * 1000;
|
||||
|
||||
/** Resolves just after the next window starts: every count is back to zero. */
|
||||
async function nextWindow(): Promise<void> {
|
||||
const wait = PERIOD_MS - (Date.now() % PERIOD_MS) + 150;
|
||||
await new Promise((resolve) => setTimeout(resolve, wait));
|
||||
}
|
||||
|
||||
/** Spends this window's whole budget on `/`; returns every status, in order. */
|
||||
async function flood(request: APIRequestContext, extra = 20): Promise<number[]> {
|
||||
const statuses: number[] = [];
|
||||
for (let i = 0; i < LIMIT + extra; i++) statuses.push((await request.get('/')).status());
|
||||
return statuses;
|
||||
}
|
||||
|
||||
test('pages pass through the Worker with the asset server’s own handling and headers', async ({
|
||||
request,
|
||||
}) => {
|
||||
expect(LIMIT).toBeGreaterThan(0);
|
||||
await nextWindow();
|
||||
const res = await request.get('/apps');
|
||||
expect(res.status()).toBe(200);
|
||||
// public/_headers still applies to what ASSETS.fetch() returns.
|
||||
expect(res.headers()['content-security-policy']).toBe("frame-ancestors 'none'");
|
||||
expect(res.headers()['x-frame-options']).toBe('DENY');
|
||||
// not_found_handling and html_handling, unchanged.
|
||||
expect((await request.get('/apps/no-such-app')).status()).toBe(404);
|
||||
const slashed = await request.get('/apps/', { maxRedirects: 0 });
|
||||
expect(slashed.status()).toBe(307);
|
||||
expect(slashed.headers()['location']).toMatch(/\/apps$/);
|
||||
});
|
||||
|
||||
test('a flood gets exactly the configured budget, then the site’s own 429 page', async ({
|
||||
request,
|
||||
}) => {
|
||||
await nextWindow();
|
||||
const statuses = await flood(request);
|
||||
expect(statuses.filter((s) => s === 200)).toHaveLength(LIMIT);
|
||||
// Once refused, refused for the rest of the window.
|
||||
expect(statuses.slice(LIMIT).every((s) => s === 429)).toBe(true);
|
||||
|
||||
const refused = await request.get('/apps/7-zip');
|
||||
expect(refused.status()).toBe(429);
|
||||
const h = refused.headers();
|
||||
expect(h['retry-after']).toBe(String(PERIOD_MS / 1000));
|
||||
expect(h['cache-control']).toBe('no-store');
|
||||
expect(h['content-type']).toContain('text/html');
|
||||
expect(h['x-frame-options']).toBe('DENY');
|
||||
expect(await refused.text()).toContain('<title>Too many requests — SoftHarbor</title>');
|
||||
});
|
||||
|
||||
test('while refused: /api/* answers JSON, and a page’s own files still load', async ({
|
||||
request,
|
||||
}) => {
|
||||
await nextWindow();
|
||||
const home = await (await request.get('/')).text();
|
||||
await flood(request);
|
||||
|
||||
const data = await request.get('/api/apps.json');
|
||||
expect(data.status()).toBe(429);
|
||||
expect(await data.json()).toEqual({ error: 'rate_limited' });
|
||||
expect(data.headers()['access-control-allow-origin']).toBe('*');
|
||||
|
||||
const verify = await request.post('/api/verify', { data: { token: 'x' } });
|
||||
expect(verify.status()).toBe(429);
|
||||
expect(await verify.json()).toEqual({ error: 'rate_limited' });
|
||||
|
||||
// Never limited: everything a page loads after it passed.
|
||||
const css = /\/_astro\/[\w.-]+\.css/.exec(home)?.[0] ?? '/_astro/ (no stylesheet linked)';
|
||||
for (const path of [css, '/sw.js', '/registerSW.js', '/favicon.svg', '/manifest.webmanifest']) {
|
||||
expect((await request.get(path)).status(), path).toBe(200);
|
||||
}
|
||||
});
|
||||
|
||||
test.describe('the 429 page in a browser', () => {
|
||||
// Chrome logs the document's own status; that line is expected here.
|
||||
test.use({ allowConsole: [/status of 429/] });
|
||||
|
||||
test('renders whole — styled, no CSP violation, no gate', async ({ page, request }) => {
|
||||
await nextWindow();
|
||||
await flood(request);
|
||||
const res = await page.goto('/apps');
|
||||
expect(res?.status()).toBe(429);
|
||||
await expect(page.locator('h1')).toHaveText('Too many requests');
|
||||
await expect(page.locator('[lang="vi"] h2')).toHaveText('Quá nhiều yêu cầu');
|
||||
const styled = await page.evaluate(() =>
|
||||
[...document.styleSheets].every((s) => {
|
||||
try {
|
||||
return s.cssRules.length > 0;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}),
|
||||
);
|
||||
expect(styled).toBe(true);
|
||||
await expect(page.getByRole('dialog')).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
||||
test('lets everyone back in when the window passes', async ({ request }) => {
|
||||
await nextWindow();
|
||||
await flood(request);
|
||||
expect((await request.get('/apps')).status()).toBe(429);
|
||||
await nextWindow();
|
||||
expect((await request.get('/apps')).status()).toBe(200);
|
||||
});
|
||||
@@ -2,6 +2,7 @@
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
// docs/10 §3. ESLint covers correctness only — Prettier owns style.
|
||||
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import js from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import astro from 'eslint-plugin-astro';
|
||||
@@ -9,14 +10,30 @@ import svelte from 'eslint-plugin-svelte';
|
||||
import svelteParser from 'svelte-eslint-parser';
|
||||
import globals from 'globals';
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ['dist/', '.astro/', 'node_modules/'] },
|
||||
// ESLint core's defineConfig, not `tseslint.config()` — typescript-eslint
|
||||
// deprecated its own helper in favour of this one (TS hint 6387, 2026-11).
|
||||
export default defineConfig(
|
||||
// `.claude/` holds agent worktrees — full copies of the repo that `eslint .`
|
||||
// would otherwise lint a second (or third) time.
|
||||
{
|
||||
// Unbundled scripts shipped verbatim from public/. They must stay plain
|
||||
// browser JS — no imports, no TypeScript — because they load before the
|
||||
// bundle and at a stable path (docs/05 §A8, §A5). Previously theme.js was
|
||||
// simply ignored; linting them is better than exempting them.
|
||||
files: ['public/*.js'],
|
||||
ignores: [
|
||||
'dist/',
|
||||
'.astro/',
|
||||
// wrangler dev / deploy --dry-run scratch bundles.
|
||||
'.wrangler/',
|
||||
'node_modules/',
|
||||
'.claude/',
|
||||
'coverage/',
|
||||
'lychee/',
|
||||
'playwright-report/',
|
||||
'test-results/',
|
||||
],
|
||||
},
|
||||
{
|
||||
// Pre-paint scripts Base.astro loads via `?url&no-inline`: Vite copies them
|
||||
// verbatim (no transform), so they must stay plain classic browser JS — no
|
||||
// imports, no TypeScript (docs/05 §A8, §A5).
|
||||
files: ['src/scripts/*.js'],
|
||||
languageOptions: {
|
||||
globals: globals.browser,
|
||||
sourceType: 'script',
|
||||
@@ -42,6 +59,10 @@ export default tseslint.config(
|
||||
files: ['**/*.astro'],
|
||||
rules: {
|
||||
'astro/no-set-html-directive': 'error',
|
||||
// CSP: Astro hashes only the scripts it bundles, so a hand-written
|
||||
// inline <script> body ships unhashed and the browser refuses it with
|
||||
// nothing in CI noticing. JSON-LD data blocks are allowed by default.
|
||||
'astro/no-unsafe-inline-scripts': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -55,14 +76,19 @@ export default tseslint.config(
|
||||
// the monochrome theming docs/04 §2 and docs/14 §3d require.
|
||||
files: [
|
||||
'src/components/ShAppCard.astro',
|
||||
// The single UI-icon component (src/lib/icon.ts behind it).
|
||||
'src/components/ShIcon.astro',
|
||||
'src/components/pages/AppDetailPage.astro',
|
||||
'src/components/pages/CategoriesPage.astro',
|
||||
// ShJsonLd emits JSON.stringify() of an object it builds itself into a
|
||||
// <script type="application/ld+json">. That is a DATA block, not
|
||||
// executable script (docs/09 §4), and Astro's normal escaping would
|
||||
// corrupt the JSON — " is not valid inside it. Values come from the
|
||||
// schema-validated collection, never from a request.
|
||||
'src/components/ShJsonLd.astro',
|
||||
// Base.astro writes ONE compile-time constant (src/lib/inlineCss.ts)
|
||||
// into an inline <style> — set:html keeps the bytes exactly the ones
|
||||
// astro.config.ts hashes into the CSP. No runtime or data input at all.
|
||||
'src/layouts/Base.astro',
|
||||
],
|
||||
rules: {
|
||||
'astro/no-set-html-directive': 'off',
|
||||
@@ -78,6 +104,13 @@ export default tseslint.config(
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
// The reason projectService is on at all: promise misuse is invisible
|
||||
// to non-type-aware linting, and every island here awaits a fetch or a
|
||||
// dynamic import.
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
'@typescript-eslint/no-misused-promises': 'error',
|
||||
'@typescript-eslint/await-thenable': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/knip@6/schema.json",
|
||||
"ignoreExportsUsedInFile": true,
|
||||
"entry": ["src/pages/**/*.{astro,ts}", "scripts/*.mjs"],
|
||||
"project": ["src/**/*.{ts,astro,svelte}", "scripts/**/*.mjs"],
|
||||
"ignoreDependencies": [
|
||||
"tailwindcss",
|
||||
"@fontsource-variable/bricolage-grotesque",
|
||||
"@fontsource/be-vietnam-pro",
|
||||
"@fontsource/ibm-plex-mono",
|
||||
"lefthook"
|
||||
"ignoreDependencies": ["@vite-pwa/workbox-swkit", "@vite-pwa/workbox-window"],
|
||||
"entry": ["src/pages/**/*.{astro,ts}", "scripts/*.mjs", "src/scripts/*.js"],
|
||||
"project": [
|
||||
"src/**/*.{ts,astro,svelte,css}",
|
||||
"scripts/**/*.{mjs,ts}",
|
||||
"e2e/**/*.ts",
|
||||
"worker/**/*.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
# OSV-Scanner exceptions for CI's `gates` job (docs/09 §7). The scanner reads
|
||||
# this file because it sits next to the scanned `pnpm-lock.yaml`.
|
||||
#
|
||||
# An entry here is for an advisory that NO release fixes yet — anything with a
|
||||
# patched version gets a floor in `pnpm-workspace.yaml` `overrides` instead.
|
||||
# Every entry carries an expiry, so the gate fails again and makes someone look:
|
||||
#
|
||||
# [[IgnoredVulns]]
|
||||
# id = "GHSA-xxxx-xxxx-xxxx"
|
||||
# effectiveUntil = 2027-01-31 # osv-scanner 2.x; `ignoreUntil` is deprecated
|
||||
# reason = "No fixed release; how it reaches us and why that is acceptable"
|
||||
#
|
||||
# `pnpm-workspace.yaml` `auditConfig.ignoreGhsas` then lists the same id for
|
||||
# `pnpm audit --prod`. Remove both once a fixed release exists.
|
||||
#
|
||||
# No exceptions today. The last one — deepmerge <= 4.3.1, GHSA-gcqx-w48m-w2h4,
|
||||
# skipped from 2026-10-30 — was WITHDRAWN by its publisher on 2026-11-16, and
|
||||
# osv-scanner reported the entry unused (2026-11-24).
|
||||
@@ -1,70 +1,87 @@
|
||||
{
|
||||
"name": "softharbor",
|
||||
"version": "0.1.0",
|
||||
"version": "1.5.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Bilingual (EN/VI) directory of free and buy-once desktop software",
|
||||
"license": "GPL-3.0-only",
|
||||
"author": "poli0981 / SkullMute",
|
||||
"packageManager": "pnpm@11.15.1",
|
||||
"packageManager": "pnpm@11.29.0",
|
||||
"engines": {
|
||||
"node": ">=24 <25"
|
||||
"node": ">=26 <27"
|
||||
},
|
||||
"//": "Dependency build-script policy lives in pnpm-workspace.yaml (allowBuilds) — pnpm 11 ignores a \"pnpm\" field here.",
|
||||
"scripts": {
|
||||
"build": "astro build",
|
||||
"check": "astro check",
|
||||
"check:styles": "node scripts/check-no-inline-styles.mjs",
|
||||
"build": "pnpm run validate:data && pnpm run i18n:check && astro build && pnpm run postbuild:html && pnpm run check:csp && pnpm run check:assets && pnpm run check:sw && pnpm run check:feed",
|
||||
"build:site": "astro build",
|
||||
"check": "astro check && tsc --noEmit",
|
||||
"check:assets": "node scripts/check-assets.mjs",
|
||||
"check:csp": "node scripts/check-csp.mjs",
|
||||
"check:feed": "node scripts/check-feed.mjs",
|
||||
"check:sw": "node scripts/check-service-worker.mjs",
|
||||
"coverage": "vitest run --coverage",
|
||||
"deploy": "wrangler deploy",
|
||||
"deploy": "pnpm run build && wrangler deploy",
|
||||
"dev": "astro dev",
|
||||
"e2e": "playwright test",
|
||||
"format": "prettier --write .",
|
||||
"i18n:check": "node scripts/check-i18n-parity.mjs",
|
||||
"icons": "node scripts/gen-icons.mjs",
|
||||
"knip": "knip",
|
||||
"lint": "eslint . && prettier --check .",
|
||||
"postbuild:html": "node scripts/postbuild.mjs",
|
||||
"preview": "astro preview",
|
||||
"quarantine": "node scripts/quarantine.mjs",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"validate:data": "node scripts/validate-data.mjs"
|
||||
"validate:data": "node scripts/validate-data.mjs",
|
||||
"vt:recheck": "node scripts/vt-recheck.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/rss": "^4.0.19",
|
||||
"@astrojs/sitemap": "^3.7.3",
|
||||
"@astrojs/svelte": "^9.0.1",
|
||||
"@astrojs/rss": "^4.0.20",
|
||||
"@astrojs/sitemap": "^3.7.7",
|
||||
"@astrojs/svelte": "^9.1.6",
|
||||
"@fontsource-variable/bricolage-grotesque": "^5.3.0",
|
||||
"@fontsource/be-vietnam-pro": "^5.3.0",
|
||||
"@fontsource/ibm-plex-mono": "^5.3.0",
|
||||
"@iconify-json/lucide": "^1.2.120",
|
||||
"@iconify-json/simple-icons": "^1.2.92",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"@vite-pwa/astro": "^1.2.0",
|
||||
"astro": "^7.1.3",
|
||||
"@iconify-json/lucide": "^1.2.163",
|
||||
"@iconify-json/simple-icons": "^1.2.105",
|
||||
"@tailwindcss/vite": "^4.3.5",
|
||||
"@vite-pwa/astro": "2.0.5",
|
||||
"astro": "^7.4.14",
|
||||
"minisearch": "^7.2.0",
|
||||
"nanostores": "^1.4.1",
|
||||
"svelte": "^5.56.8",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"unplugin-icons": "^23.0.1"
|
||||
"nanostores": "^1.5.5",
|
||||
"svelte": "^5.60.1",
|
||||
"tailwindcss": "^4.3.5",
|
||||
"unplugin-icons": "^24.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/check": "^0.9.9",
|
||||
"@astrojs/check": "^0.9.12",
|
||||
"@axe-core/playwright": "^4.14.1",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@types/node": "^26.1.1",
|
||||
"eslint": "^10.8.0",
|
||||
"eslint-plugin-astro": "^3.0.1",
|
||||
"eslint-plugin-svelte": "^3.22.0",
|
||||
"globals": "^17.7.0",
|
||||
"happy-dom": "^20.11.1",
|
||||
"knip": "^6.29.0",
|
||||
"lefthook": "^2.1.10",
|
||||
"prettier": "^3.9.6",
|
||||
"prettier-plugin-astro": "^0.14.1",
|
||||
"prettier-plugin-svelte": "^4.1.1",
|
||||
"@playwright/test": "^1.65.2",
|
||||
"@types/node": "^26.6.11",
|
||||
"@typescript/native": "npm:typescript@^7.0.2",
|
||||
"@vite-pwa/workbox-swkit": "^8.0.15",
|
||||
"@vite-pwa/workbox-window": "^8.0.15",
|
||||
"@vitest/coverage-v8": "5.1.2",
|
||||
"eslint": "^10.16.0",
|
||||
"eslint-plugin-astro": "^3.2.3",
|
||||
"eslint-plugin-svelte": "^3.24.1",
|
||||
"globals": "^17.15.0",
|
||||
"happy-dom": "^21.0.4",
|
||||
"knip": "^6.51.0",
|
||||
"lefthook": "^2.2.4",
|
||||
"magicast": "^0.5.5",
|
||||
"prettier": "^3.10.2",
|
||||
"prettier-plugin-astro": "^1.1.2",
|
||||
"prettier-plugin-svelte": "^4.2.0",
|
||||
"prettier-plugin-tailwindcss": "^0.8.1",
|
||||
"svelte-eslint-parser": "^1.8.0",
|
||||
"typescript": "^6.0.3",
|
||||
"typescript-eslint": "^8.65.0",
|
||||
"vitest": "^4.1.10",
|
||||
"wrangler": "^4.114.0"
|
||||
"rolldown": "1.3.4",
|
||||
"sharp": "^0.35.6",
|
||||
"svelte-eslint-parser": "^1.13.0",
|
||||
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
||||
"typescript-eslint": "^8.74.0",
|
||||
"vitest": "^5.1.2",
|
||||
"wrangler": "^4.171.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// docs/11 — end-to-end smoke suite against the BUILT site (`astro preview`
|
||||
// serves dist/ exactly as built, including the per-page meta CSP).
|
||||
//
|
||||
// What it exists to catch is the class of bug this project kept shipping with
|
||||
// every unit test green: a script or style the CSP silently refused, a dialog
|
||||
// the platform could dismiss, an island that threw on hydration. The shared
|
||||
// fixture (e2e/fixtures.ts) fails any test whose page logged a console error
|
||||
// or a CSP violation.
|
||||
//
|
||||
// `astro preview` applies neither _headers nor the Worker, so a second server
|
||||
// does: `wrangler dev` on the same dist/ with the real wrangler.jsonc, for the
|
||||
// `worker` project alone (e2e/worker.spec.ts — routing, the rate limits, the
|
||||
// 429 page). Cloudflare's own edge is verified on production after each
|
||||
// deploy (ci.yml `deploy`, docs/13 §3) — there are no preview versions since
|
||||
// the move to Gitea (D38).
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* CPUs this process may actually use when a cgroup v2 quota caps it — the
|
||||
* CI job container runs with `docker --cpus=4` (runner `anon-docker`, since
|
||||
* 2026-12-04), yet `os.cpus()`, which Playwright sizes its pool by, still
|
||||
* reports every core of the host (28). Fourteen workers on four CPUs made
|
||||
* axe on /apps take over 30 s instead of ~9 s and time out. `undefined`
|
||||
* (Playwright's own default) wherever no quota applies, laptops included.
|
||||
*/
|
||||
function cgroupCpuQuota(): number | undefined {
|
||||
try {
|
||||
const [quota, period] = readFileSync('/sys/fs/cgroup/cpu.max', 'utf8').trim().split(/\s+/);
|
||||
if (quota === undefined || quota === 'max' || period === undefined) return undefined;
|
||||
const cpus = Math.floor(Number(quota) / Number(period));
|
||||
return Number.isFinite(cpus) ? Math.max(1, cpus) : undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const CPU_QUOTA = cgroupCpuQuota();
|
||||
const PORT = 4321;
|
||||
// Not wrangler's default 8787/8788: another project's `wrangler dev` may hold
|
||||
// those, and reuseExistingServer would then test the wrong site.
|
||||
const WORKER_PORT = 8799;
|
||||
const WORKER_SPEC = /worker\.spec\.ts$/;
|
||||
|
||||
export default defineConfig({
|
||||
testDir: 'e2e',
|
||||
fullyParallel: true,
|
||||
...(CPU_QUOTA === undefined ? {} : { workers: CPU_QUOTA }),
|
||||
forbidOnly: Boolean(process.env['CI']),
|
||||
retries: process.env['CI'] ? 1 : 0,
|
||||
// `list` in CI too: Gitea shows no annotations, so the github reporter's
|
||||
// terse `::error` lines would only hide the readable output.
|
||||
reporter: process.env['CI'] ? [['list'], ['html', { open: 'never' }]] : 'list',
|
||||
use: {
|
||||
baseURL: `http://127.0.0.1:${PORT}`,
|
||||
trace: 'retain-on-failure',
|
||||
},
|
||||
projects: [
|
||||
{ name: 'desktop', use: { ...devices['Desktop Chrome'] }, testIgnore: WORKER_SPEC },
|
||||
// Bottom sheets, the wrapped header and touch targets live here.
|
||||
{ name: 'mobile', use: { ...devices['Pixel 7'] }, testIgnore: WORKER_SPEC },
|
||||
{
|
||||
name: 'worker',
|
||||
testMatch: WORKER_SPEC,
|
||||
use: { ...devices['Desktop Chrome'], baseURL: `http://127.0.0.1:${WORKER_PORT}` },
|
||||
},
|
||||
],
|
||||
webServer: [
|
||||
{
|
||||
command: `pnpm exec astro preview --port ${PORT} --host 127.0.0.1`,
|
||||
url: `http://127.0.0.1:${PORT}`,
|
||||
reuseExistingServer: !process.env['CI'],
|
||||
timeout: 60_000,
|
||||
// Astro ≥ 7.2 backgrounds `astro preview` when it detects an AI agent or
|
||||
// CI; Playwright needs it in the foreground to own its lifetime.
|
||||
env: { ASTRO_PREVIEW_BACKGROUND: '0' },
|
||||
},
|
||||
{
|
||||
command: `pnpm exec wrangler dev --port ${WORKER_PORT} --ip 127.0.0.1 --show-interactive-dev-session=false`,
|
||||
// An asset-first path (a negative pattern), so the readiness probes
|
||||
// spend nothing from the rate limit the tests measure.
|
||||
url: `http://127.0.0.1:${WORKER_PORT}/favicon.svg`,
|
||||
reuseExistingServer: !process.env['CI'],
|
||||
timeout: 90_000,
|
||||
env: { WRANGLER_SEND_METRICS: 'false' },
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -12,17 +12,43 @@ allowBuilds:
|
||||
esbuild: true
|
||||
# Downloads the lefthook binary that installs our git hooks (docs/10 §4).
|
||||
lefthook: true
|
||||
# Cloudflare's local Worker runtime, pulled in by wrangler. SoftHarbor ships
|
||||
# pure static assets and never runs a Worker locally (docs/01 §1), so this
|
||||
# binary is dead weight. False is a decision, not an oversight.
|
||||
# Cloudflare's local Worker runtime, pulled in by wrangler. Its postinstall
|
||||
# (install.js) only verifies or re-fetches the binary, which already arrives
|
||||
# as the platform optionalDependency (@cloudflare/workerd-<os>-<arch>), so
|
||||
# `wrangler dev` runs the /api/verify Worker (D25) without it — checked
|
||||
# 2026-10-21. The Worker's tests run under Node (vitest). False is a
|
||||
# decision, not an oversight.
|
||||
workerd: false
|
||||
|
||||
# Security override — GHSA-mh99-v99m-4gvg (CVSS 7.5) affects brace-expansion
|
||||
# <5.0.8, and no patched 2.x exists. It reaches us only through
|
||||
# @vite-pwa/astro -> vite-plugin-pwa -> workbox-build -> ... -> minimatch@5,
|
||||
# i.e. BUILD tooling; nothing here ships to a visitor. Forcing 5.x across a
|
||||
# three-major gap is only acceptable because the package's surface is a single
|
||||
# `expand()` function — and because the build and full test suite are run
|
||||
# against it below. Remove once upstream moves.
|
||||
# Security overrides. Every package here reaches us only through BUILD or DEV
|
||||
# tooling — nothing here ships to a visitor. Each floor is the first release
|
||||
# that fixes every advisory listed. Remove a line once upstream's own range
|
||||
# moves past it (`pnpm why <pkg>` shows who still pins the old version).
|
||||
#
|
||||
# fast-uri — GHSA-7p8r-x3mc-p8w7, GHSA-5jgf-p345-68v8, GHSA-f65p-4m7j-42xc,
|
||||
# GHSA-fph4-wmhf-6fwf, GHSA-jqff-g426-hqxp, GHSA-qw65-cvwx-89v3 (<3.1.7) and
|
||||
# GHSA-hrr3-gc8f-f4qj (<3.1.8). Same major as ajv@8's `^3.0.1` range (still
|
||||
# so in ajv 8.20); pnpm kept the locked 3.1.4 even under
|
||||
# `update --depth Infinity`, hence the override.
|
||||
#
|
||||
# (Retired 2026-11-24: `'@typescript-eslint/typescript-estree>minimatch':
|
||||
# '^11.0.1'` — typescript-eslint 8.73 asks for minimatch ^11.0.1 itself.
|
||||
# Retired 2026-11-09 with @vite-pwa/astro 2: `glob` ^14.0.2 and
|
||||
# `serialize-javascript` ^7.1.3. Retired 2026-11-04: `miniflare>undici`.)
|
||||
overrides:
|
||||
brace-expansion: '^5.0.8'
|
||||
fast-uri: '^3.1.9'
|
||||
|
||||
# No `auditConfig.ignoreGhsas` and no `packageExtensions` since 2026-11-24:
|
||||
# - the one advisory `pnpm audit --prod` skipped, deepmerge's
|
||||
# GHSA-gcqx-w48m-w2h4, was WITHDRAWN on 2026-11-16 (osv-scanner.toml);
|
||||
# - `@astrojs/astro2tsx` 0.1.4 declares the `@emnapi/runtime` 1.11.3 that
|
||||
# matches its `@emnapi/core` itself — 0.1.3 left it to a peer range that
|
||||
# pnpm resolved to a 2.x beta, and `astro check` then reported the failed
|
||||
# import as "@astrojs/check is not installed" (2026-11-09).
|
||||
#
|
||||
# `pnpm install` warns "unmet peer @typescript/native" since typescript-eslint
|
||||
# 8.73: it declares an OPTIONAL peer of that name for TypeScript's native
|
||||
# preview (>= 7.1.0-dev), and our `@typescript/native` is the alias of
|
||||
# typescript@7.0.2 that `tsc --noEmit` uses (D28). Lint is unchanged either
|
||||
# way (same files, same rules, 2026-11-24); leave the warning until either side
|
||||
# moves.
|
||||
@@ -1,6 +1,5 @@
|
||||
Contact: mailto:contact@softharbor.net
|
||||
Contact: https://github.com/poli0981/softharbor/security/advisories/new
|
||||
Contact: mailto:security@poli0981.dev
|
||||
Preferred-Languages: en, vi
|
||||
Expires: 2027-07-28T00:00:00.000Z
|
||||
Canonical: https://softharbor.net/.well-known/security.txt
|
||||
Policy: https://github.com/poli0981/softharbor/blob/main/SECURITY.md
|
||||
Policy: https://git.poli0981.dev/poli0981/softharbor/src/branch/main/SECURITY.md
|
||||
@@ -11,6 +11,21 @@
|
||||
# script-src or style-src — the intersection would drop Astro's hashes and
|
||||
# break every island.
|
||||
#
|
||||
# HOW RULES COMBINE (Cloudflare docs, verified live 2026-10-21): every rule
|
||||
# whose path matches a request contributes its headers, and a header set by
|
||||
# more than one matching rule is JOINED WITH A COMMA — it is not overridden.
|
||||
# `/*` used to set `Cache-Control: public, max-age=0, must-revalidate` and
|
||||
# `/_astro/*` set `public, max-age=31536000, immutable`, so hashed assets were
|
||||
# served with BOTH. Browsers honour the first max-age (RFC 9111 §4.2.1 even
|
||||
# says to treat conflicting directives as stale), so every "immutable" asset
|
||||
# was revalidated on every load and the JSON feeds were never cached at all.
|
||||
# Fixed two ways at once:
|
||||
# * `/*` no longer sets Cache-Control. Cloudflare's default for static
|
||||
# assets is exactly `public, max-age=0, must-revalidate`, which is still
|
||||
# what HTML, sw.js and the manifest get.
|
||||
# * Each specific rule detaches any inherited value with `! Cache-Control`
|
||||
# before setting its own, so a future `/*` line cannot reintroduce this.
|
||||
#
|
||||
# The pre-launch `X-Robots-Tag: noindex` was REMOVED on 2026-07-28. It existed
|
||||
# only while the dataset was empty, where an indexed blank site can linger as
|
||||
# "Crawled — currently not indexed". With real entries, legal pages and a
|
||||
@@ -25,17 +40,32 @@
|
||||
Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), usb=()
|
||||
Cross-Origin-Opener-Policy: same-origin
|
||||
Cross-Origin-Resource-Policy: same-origin
|
||||
Cache-Control: public, max-age=0, must-revalidate
|
||||
|
||||
# Content-hashed by Vite — this covers JS, CSS *and* the self-hosted fonts,
|
||||
# which Astro emits into /_astro/ rather than a /fonts/ directory. An earlier
|
||||
# spec had a separate /fonts/* rule; it matched nothing (found in M1).
|
||||
/_astro/*
|
||||
! Cache-Control
|
||||
Cache-Control: public, max-age=31536000, immutable
|
||||
|
||||
/api/apps.json
|
||||
! Cache-Control
|
||||
Access-Control-Allow-Origin: *
|
||||
Cache-Control: public, max-age=300
|
||||
|
||||
/search-index.json
|
||||
! Cache-Control
|
||||
Cache-Control: public, max-age=300
|
||||
|
||||
# RFC 9116 §3: security.txt MUST be served as text/plain with charset=utf-8;
|
||||
# the platform's inferred type omits the charset.
|
||||
/.well-known/security.txt
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
# PR preview versions (`wrangler versions upload`) are public on workers.dev
|
||||
# because `preview_urls: true`. Their canonicals already point at
|
||||
# softharbor.net, but a preview should never be indexed in its own right.
|
||||
# Absolute-URL patterns with placeholders are supported by _headers; the
|
||||
# production custom domain never matches this host pattern.
|
||||
https://:version.:subdomain.workers.dev/*
|
||||
X-Robots-Tag: noindex
|
||||
|
After Width: | Height: | Size: 5.2 KiB |
@@ -1,36 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only
|
||||
Copyright (C) 2026 poli0981 (SkullMute)
|
||||
|
||||
Console ring buffer — docs/05 §A5.
|
||||
|
||||
This runs from a deferred external script, NOT from inside ShBugReport,
|
||||
because that island is client:visible in the footer (docs/02 §5): if the
|
||||
listeners attached on hydration they would miss every error that happened
|
||||
before the user scrolled down — which is most of them, and precisely the
|
||||
ones a bug report needs.
|
||||
|
||||
The buffer lives on window so the island reads the same instance a module
|
||||
import could not share with a plain script. External file, so it satisfies
|
||||
script-src without a hash (docs/09 §4, D20).
|
||||
|
||||
Privacy (docs/09 §8): exception text from our own origin only. It never
|
||||
wraps console.*, never reads input values, and never leaves the page until
|
||||
the user explicitly opens a bug report. */
|
||||
(() => {
|
||||
var CAP = 20;
|
||||
var MAX_LINE = 500;
|
||||
var buf = (window.__shErrors = window.__shErrors || []);
|
||||
|
||||
function push(line) {
|
||||
buf.push(('[' + new Date().toISOString() + '] ' + line).slice(0, MAX_LINE));
|
||||
if (buf.length > CAP) buf.shift();
|
||||
}
|
||||
|
||||
window.addEventListener('error', function (e) {
|
||||
push('error: ' + e.message + ' @ ' + e.filename + ':' + e.lineno);
|
||||
});
|
||||
|
||||
window.addEventListener('unhandledrejection', function (e) {
|
||||
push('unhandledrejection: ' + String(e.reason).slice(0, 400));
|
||||
});
|
||||
})();
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
@@ -1,14 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-label="SoftHarbor">
|
||||
<!-- Placeholder mark: an anchor, matching the "safe berth after a reinstall"
|
||||
idea behind the name (docs/00 §5 D1). The real wordmark and the PNG PWA
|
||||
icons (192/512/maskable) are a design deliverable, not something to
|
||||
fabricate — tracked in docs/13 §2. Uses currentColor so it inherits the
|
||||
theme like every other icon on the site. -->
|
||||
<g fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
<circle cx="16" cy="6" r="3" />
|
||||
<path d="M16 9v18" />
|
||||
<path d="M9 14h14" />
|
||||
<path d="M5 19a11 11 0 0 0 22 0" />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||
<defs>
|
||||
<linearGradient id="sh-tile" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0" stop-color="#1C93B8" />
|
||||
<stop offset="1" stop-color="#0B4F7A" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="32" height="32" rx="7" fill="url(#sh-tile)" />
|
||||
<g fill="none" stroke="#ffffff" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"
|
||||
transform="translate(0 0) scale(1)">
|
||||
<circle cx="16" cy="8.5" r="2.6" />
|
||||
<path d="M16 11.1v13.4" />
|
||||
<path d="M10.5 15h11" />
|
||||
<path d="M7.5 18.5a8.5 8.5 0 0 0 17 0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 718 B After Width: | Height: | Size: 614 B |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 16 KiB |
@@ -1,13 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only
|
||||
Copyright (C) 2026 poli0981 (SkullMute)
|
||||
|
||||
No-flash theme resolution — docs/05 §A8.
|
||||
Loaded as a BLOCKING <script src> in <head> (no defer, no async) so it runs
|
||||
before first paint. It lives in public/ and is deliberately NOT bundled:
|
||||
the strict CSP is `script-src 'self'` with no hashes (docs/09 §4, D18), so
|
||||
nothing inline may ship, and the path must stay stable. */
|
||||
(() => {
|
||||
const s = localStorage.getItem('sh:theme'); // 'light' | 'dark' | null
|
||||
const dark = s ? s === 'dark' : matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
document.documentElement.dataset.theme = dark ? 'dark' : 'light';
|
||||
})();
|
||||
@@ -0,0 +1,60 @@
|
||||
# Qodana (JetBrains) — the code analyser beside the ops repo's Opengrep SAST
|
||||
# (D35, D38, docs/12 §2). Read by .gitea/workflows/qodana.yml (the ops
|
||||
# reusable-qodana.yml runs the Qodana CLI); results go to Qodana Cloud (the
|
||||
# QODANA_TOKEN project token carries the Ultimate licence) and to the run's
|
||||
# `qodana-report` artifact. SonarQube Cloud and CodeQL left with GitHub (D38).
|
||||
version: '1.0'
|
||||
|
||||
# Qodana for JS is WebStorm's engine and runs only under an Ultimate (or
|
||||
# Ultimate Plus) licence. Native mode, no container: the analysis then sees the
|
||||
# runner's Node 26 and the node_modules that pnpm installed in the step before
|
||||
# it, instead of whatever Node the image ships. On its own it reads
|
||||
# .ts/.js/.mjs, JSON, YAML, Markdown and CSS — .astro and .svelte are outside
|
||||
# its language list (why no plugin adds them: the end of this file).
|
||||
linter: qodana-js
|
||||
withinDocker: 'false'
|
||||
|
||||
profile:
|
||||
name: qodana.recommended
|
||||
|
||||
# The scope SonarQube Cloud had (until D38): the dataset is CC BY-SA content
|
||||
# validated by Zod and validate:data, not code; everything else here is
|
||||
# generated output or local tool state (git-ignored, so absent in CI anyway).
|
||||
exclude:
|
||||
- name: All
|
||||
paths:
|
||||
- src/data
|
||||
- data
|
||||
- dist
|
||||
- coverage
|
||||
- playwright-report
|
||||
- test-results
|
||||
- blob-report
|
||||
- .astro
|
||||
- .wrangler
|
||||
- .claude
|
||||
# The dark palette has to exist twice — once for the system choice
|
||||
# (`@media (prefers-color-scheme: dark)`), once for the explicit one
|
||||
# (`[data-theme='dark']`): CSS cannot share one block between a media query
|
||||
# and a selector. `light-dark()` could, but needs Chrome 123 / Safari 17.5,
|
||||
# newer than Tailwind 4's own floor (Chrome 111, Safari 16.4).
|
||||
- name: DuplicatedCode
|
||||
paths:
|
||||
- src/styles/global.css
|
||||
|
||||
# No `plugins:`. JetBrains' Astro (org.jetbrains.plugins.astro) and Svelte
|
||||
# (dev.blachut.svelte.lang) plugins were tried on 2026-11-15 and dropped:
|
||||
# under Qodana their type checks were not deterministic. On unchanged code
|
||||
# the Svelte plugin reported Intl.PluralRules#select and
|
||||
# Intl.NumberFormat#format in ShFilterSheet.svelte as unresolved (one run in
|
||||
# three), and the Astro plugin read Base.astro's `locale = 'en'` default as
|
||||
# `string` instead of `Locale` — 15 errors in one run, 0 in the run before it
|
||||
# on the same commit. A gate that flips on its own teaches everyone to
|
||||
# ignore it. `astro check` (the TypeScript compiler itself) type-checks the
|
||||
# .astro files; ESLint, the Vitest island suites and e2e cover the islands.
|
||||
|
||||
# Any finding fails the job: red on the PR, but not a required check (D35) —
|
||||
# an outside service's outage must never block a merge.
|
||||
failureConditions:
|
||||
severityThresholds:
|
||||
any: 0
|
||||
@@ -1,25 +1,30 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:best-practices",
|
||||
":pinAllExceptPeerDependencies",
|
||||
"helpers:pinGitHubActionDigests"
|
||||
],
|
||||
"schedule": ["before 6am on monday"],
|
||||
"extends": ["local>poli0981/renovate-config"],
|
||||
"packageRules": [
|
||||
{ "groupName": "minor+patch", "matchUpdateTypes": ["minor", "patch"] },
|
||||
{ "matchUpdateTypes": ["major"], "dependencyDashboardApproval": true },
|
||||
{
|
||||
"description": "TypeScript 7's native compiler does not expose the API astro check needs, so pnpm check fails on it. Hold at 6.x until Astro supports it (docs/01 §2, D21).",
|
||||
"matchPackageNames": ["typescript"],
|
||||
"allowedVersions": "<7"
|
||||
"description": "D21 (amended 2026-10-23): TypeScript runs side by side. `typescript` is the @typescript/typescript6 wrapper (the TS 6 API astro check, typescript-eslint and svelte2tsx load); `@typescript/native` is TypeScript 7's `tsc`. A major of either is a decision (docs/01 §5), not a routine bump.",
|
||||
"matchPackageNames": ["typescript", "@typescript/native", "@typescript/typescript6"],
|
||||
"matchUpdateTypes": ["major"],
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"description": "Astro/Vite/Tailwind majors must re-run spike S1 before merge (docs/01 §5.5).",
|
||||
"matchPackageNames": ["astro", "vite", "tailwindcss", "@tailwindcss/vite"],
|
||||
"description": "Node is a platform move (CLAUDE.md, maintenance mode item 4): .nvmrc, engines.node and @types/node move together, deliberately, at the next LTS — never as a routine bump.",
|
||||
"matchPackageNames": ["node", "@types/node"],
|
||||
"matchUpdateTypes": ["major"],
|
||||
"dependencyDashboardApproval": true,
|
||||
"addLabels": ["needs-spike-s1"]
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"description": "pnpm stays on 11.x by decision (docs/01 §5): pnpm 12 is a platform move, not a routine bump. packageManager minors and patches still come through.",
|
||||
"matchPackageNames": ["pnpm"],
|
||||
"matchUpdateTypes": ["major"],
|
||||
"enabled": false
|
||||
},
|
||||
{
|
||||
"description": "The fast-uri override in pnpm-workspace.yaml is a security FLOOR inside the major that ajv@8 asks for (^3.0.1, still so in ajv 8.20). Forcing 4.x on ajv would swap a major under it, so the floor only moves within 3.x; remove the override (not raise it) once ajv's own range moves on.",
|
||||
"matchPackageNames": ["fast-uri"],
|
||||
"matchUpdateTypes": ["major"],
|
||||
"enabled": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
/**
|
||||
* Build guard: every same-origin asset a page references must exist in dist/,
|
||||
* and no script may ship as a data: URL.
|
||||
*
|
||||
* WHY THIS EXISTS. Two failure modes that a green `astro build` hides:
|
||||
*
|
||||
* - Vite inlines any `?url` import under `build.assetsInlineLimit` (4 KiB) as
|
||||
* a `data:` URL. Base.astro's pre-paint scripts are smaller than that; as
|
||||
* `<script src="data:…">` they would be refused by `script-src 'self'` on
|
||||
* every page. The `&no-inline` suffix prevents it — this proves it did.
|
||||
* - Astro moves assets emitted from the prerender build into dist/ after the
|
||||
* fact; if that step ever drops a file, the page references a URL that
|
||||
* 404s, and only a visitor notices.
|
||||
*
|
||||
* Checks the asset-bearing attributes only (script src, link href for
|
||||
* stylesheets/icons/manifest, img src) — page-to-page links are lychee's job.
|
||||
*/
|
||||
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
||||
import { join, relative } from 'node:path';
|
||||
|
||||
const DIST = join(process.cwd(), 'dist');
|
||||
const SCRIPT_SRC = /<script\b[^>]*\ssrc="([^"]+)"/gi;
|
||||
const LINK_TAG = /<link\b[^>]*>/gi;
|
||||
const IMG_SRC = /<img\b[^>]*\ssrc="([^"]+)"/gi;
|
||||
const ASSET_RELS = new Set(['stylesheet', 'icon', 'manifest', 'apple-touch-icon', 'modulepreload']);
|
||||
|
||||
function walk(dir) {
|
||||
const out = [];
|
||||
for (const entry of readdirSync(dir)) {
|
||||
const p = join(dir, entry);
|
||||
if (statSync(p).isDirectory()) out.push(...walk(p));
|
||||
else if (p.endsWith('.html')) out.push(p);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const problems = [];
|
||||
const checked = new Set();
|
||||
|
||||
function checkUrl(rel, url, kind) {
|
||||
if (url.startsWith('data:')) {
|
||||
problems.push(`${rel}: ${kind} is a data: URL (${url.slice(0, 40)}…) — CSP refuses it`);
|
||||
return;
|
||||
}
|
||||
// Same-origin, root-relative only; absolute third-party URLs are the CSP's
|
||||
// concern, and protocol-relative `//host` is not ours either.
|
||||
if (!url.startsWith('/') || url.startsWith('//')) return;
|
||||
const path = decodeURIComponent(url.split(/[?#]/)[0]);
|
||||
if (checked.has(path)) return;
|
||||
checked.add(path);
|
||||
if (!existsSync(join(DIST, path)))
|
||||
problems.push(`${rel}: ${kind} ${path} does not exist in dist/`);
|
||||
}
|
||||
|
||||
let pages = 0;
|
||||
for (const file of walk(DIST)) {
|
||||
pages++;
|
||||
const html = readFileSync(file, 'utf8');
|
||||
const rel = relative(process.cwd(), file);
|
||||
for (const m of html.matchAll(SCRIPT_SRC)) checkUrl(rel, m[1], 'script');
|
||||
for (const m of html.matchAll(IMG_SRC)) checkUrl(rel, m[1], 'image');
|
||||
for (const [tag] of html.matchAll(LINK_TAG)) {
|
||||
const relAttr = /\srel="([^"]+)"/i.exec(tag)?.[1] ?? '';
|
||||
const href = /\shref="([^"]+)"/i.exec(tag)?.[1];
|
||||
if (href && relAttr.split(/\s+/).some((r) => ASSET_RELS.has(r)))
|
||||
checkUrl(rel, href, `link[${relAttr}]`);
|
||||
}
|
||||
}
|
||||
|
||||
if (pages === 0) problems.push('found no HTML pages under dist/ — run `astro build` first');
|
||||
|
||||
if (problems.length > 0) {
|
||||
console.error(`check-assets — ${problems.length} problem(s):`);
|
||||
for (const p of problems.slice(0, 20)) console.error(` ✗ ${p}`);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(
|
||||
`check-assets — OK (${pages} pages, ${checked.size} distinct same-origin assets exist)`,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
/**
|
||||
* Build guard: every page's markup must be allowed by that page's own CSP
|
||||
* (docs/09 §4). Formerly check-no-inline-styles.mjs.
|
||||
*
|
||||
* WHY THIS EXISTS. The CSP is a per-page <meta> that Astro generates with
|
||||
* hashes for the inline code it knows about. Anything it does NOT know about
|
||||
* is refused by the browser SILENTLY — the build passes, the source looks
|
||||
* right, and the page renders without it:
|
||||
*
|
||||
* - an inline `style="…"` attribute (hashes never apply to attributes, and
|
||||
* the policy has neither 'unsafe-inline' nor 'unsafe-hashes'): that is how
|
||||
* the sticky header shipped transparent (2026-07-28);
|
||||
* - a <style> element Astro did not hash: `transition:name` once shipped
|
||||
* 1.5 MB of CSS refused on every page with all gates green;
|
||||
* - an inline <script> body Astro did not hash (Astro only hashes scripts it
|
||||
* bundles itself, so a hand-written `is:inline` body would be refused).
|
||||
*
|
||||
* It also fails when a page has NO CSP meta (formerly a silent skip that still
|
||||
* printed OK), and when anything executable precedes the meta tag — a meta
|
||||
* policy only governs what comes after it (see scripts/postbuild.mjs).
|
||||
*
|
||||
* Fix for a style failure: use a Tailwind utility. Every design token is
|
||||
* exposed as one (`text-sh-muted`, `bg-sh-surface`, …) in
|
||||
* src/styles/global.css.
|
||||
*/
|
||||
import { createHash } from 'node:crypto';
|
||||
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
||||
import { join, relative } from 'node:path';
|
||||
|
||||
const DIST = join(process.cwd(), 'dist');
|
||||
|
||||
const CSP_META = /<meta http-equiv="content-security-policy" content="([^"]+)"/i;
|
||||
/**
|
||||
* <style> and <script> elements; external scripts (with `src`) are skipped in
|
||||
* the code below. The end tags accept what the HTML tokenizer accepts —
|
||||
* `</script >`, `</script foo>` — so an oddly written end tag cannot hide an
|
||||
* element's content from the hash check (CodeQL js/bad-tag-filter). This
|
||||
* reads our own build output, but a checker must not have blind spots.
|
||||
*/
|
||||
const STYLE_EL = /<style\b[^>]*>([\s\S]*?)<\/style\b[^>]*>/gi;
|
||||
const SCRIPT_EL = /<script\b([^>]*)>([\s\S]*?)<\/script\b[^>]*>/gi;
|
||||
const HAS_SRC = /\ssrc\s*=/i;
|
||||
const DATA_BLOCK = /\stype="application\/(?:ld\+)?json"/i;
|
||||
/** Every start tag. `[^>]*` is a single linear run — no nested quantifiers. */
|
||||
const START_TAG = /<[a-z][^>]*>/gi;
|
||||
/**
|
||||
* A `style` attribute in any of HTML's three value syntaxes — double-quoted,
|
||||
* single-quoted or unquoted — and any letter case. Applied to one bounded tag
|
||||
* string at a time, which keeps it linear (SonarCloud S8786).
|
||||
*/
|
||||
const STYLE_ATTR = /\sstyle\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/i;
|
||||
const sha256 = (s) => `sha256-${createHash('sha256').update(s, 'utf8').digest('base64')}`;
|
||||
|
||||
function walk(dir) {
|
||||
const out = [];
|
||||
for (const entry of readdirSync(dir)) {
|
||||
const p = join(dir, entry);
|
||||
if (statSync(p).isDirectory()) out.push(...walk(p));
|
||||
else if (p.endsWith('.html')) out.push(p);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const problems = {
|
||||
styleAttr: [],
|
||||
unhashedStyle: [],
|
||||
unhashedScript: [],
|
||||
missingCsp: [],
|
||||
lateCsp: [],
|
||||
};
|
||||
let pages = 0;
|
||||
const styleHashes = new Set();
|
||||
|
||||
for (const file of walk(DIST)) {
|
||||
pages++;
|
||||
const html = readFileSync(file, 'utf8');
|
||||
const rel = relative(process.cwd(), file);
|
||||
|
||||
for (const [tag] of html.matchAll(START_TAG)) {
|
||||
const m = STYLE_ATTR.exec(tag);
|
||||
if (!m) continue;
|
||||
const decl = m[1] ?? m[2] ?? m[3] ?? '';
|
||||
// An empty style="" is harmless noise from a framework; a declaration is not.
|
||||
if (decl.trim() !== '')
|
||||
problems.styleAttr.push({ rel, detail: `style="${decl.slice(0, 70)}"` });
|
||||
}
|
||||
|
||||
const cspMatch = CSP_META.exec(html);
|
||||
if (!cspMatch) {
|
||||
problems.missingCsp.push({ rel, detail: 'no <meta http-equiv="content-security-policy">' });
|
||||
continue;
|
||||
}
|
||||
const csp = cspMatch[1];
|
||||
const firstScript = html.search(/<script[\s>]/i);
|
||||
if (firstScript !== -1 && firstScript < cspMatch.index) {
|
||||
problems.lateCsp.push({ rel, detail: 'a <script> precedes the CSP meta tag' });
|
||||
}
|
||||
|
||||
for (const m of html.matchAll(STYLE_EL)) {
|
||||
const hash = sha256(m[1]);
|
||||
styleHashes.add(hash);
|
||||
if (!csp.includes(`'${hash}'`)) {
|
||||
problems.unhashedStyle.push({ rel, detail: `${hash} ${JSON.stringify(m[1].slice(0, 60))}` });
|
||||
}
|
||||
}
|
||||
|
||||
for (const m of html.matchAll(SCRIPT_EL)) {
|
||||
if (HAS_SRC.test(m[1])) continue; // external: covered by script-src, not a hash
|
||||
if (DATA_BLOCK.test(m[1])) continue; // JSON-LD is data, not script
|
||||
const hash = sha256(m[2]);
|
||||
if (!csp.includes(`'${hash}'`)) {
|
||||
problems.unhashedScript.push({ rel, detail: `${hash} ${JSON.stringify(m[2].slice(0, 60))}` });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const advice = {
|
||||
styleAttr:
|
||||
'CSP style-src drops these silently. Use a Tailwind utility — the design tokens are\n exposed as one in src/styles/global.css.',
|
||||
unhashedStyle:
|
||||
'Astro hashes the styles it knows about; anything it misses must be removed or added\n via security.csp.styleDirective.hashes (docs/09 §4).',
|
||||
unhashedScript:
|
||||
'Astro only hashes scripts it bundles. Move the code into a file and reference it with\n `?url&no-inline` (see Base.astro), or add its hash to security.csp.scriptDirective.',
|
||||
missingCsp:
|
||||
"Astro's security.csp emits the policy per page; a page without it is unprotected and\n invisible to every other check here.",
|
||||
lateCsp:
|
||||
'A meta CSP only governs what follows it. scripts/postbuild.mjs moves it to the top of\n <head> — did it run?',
|
||||
};
|
||||
|
||||
let failed = false;
|
||||
for (const [kind, list] of Object.entries(problems)) {
|
||||
if (list.length === 0) continue;
|
||||
failed = true;
|
||||
console.error(`check-csp — ${list.length} problem(s): ${kind}`);
|
||||
const seen = new Set();
|
||||
for (const { rel, detail } of list) {
|
||||
if (seen.has(detail)) continue;
|
||||
seen.add(detail);
|
||||
if (seen.size > 10) break;
|
||||
console.error(` ✗ ${rel}\n ${detail}`);
|
||||
}
|
||||
console.error(` ${advice[kind]}\n`);
|
||||
}
|
||||
|
||||
if (pages === 0) {
|
||||
console.error('check-csp — found no HTML pages under dist/. Run `astro build` first.');
|
||||
failed = true;
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(
|
||||
`check-csp — OK (${pages} pages: policy first in <head>, no style attributes, ` +
|
||||
`${styleHashes.size} <style> hash(es) and every inline script allowed by its own page)`,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// check-csp.mjs and postbuild.mjs together: postbuild puts the policy first,
|
||||
// check-csp proves every page's markup is allowed by its own policy. Plus
|
||||
// check-assets.mjs, the other guard over dist/ HTML.
|
||||
|
||||
import { createHash } from 'node:crypto';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { project, run } from './fixture';
|
||||
|
||||
const sha = (s: string): string => `'sha256-${createHash('sha256').update(s).digest('base64')}'`;
|
||||
const CHARSET = '<meta charset="utf-8">';
|
||||
const meta = (policy: string): string =>
|
||||
`<meta http-equiv="content-security-policy" content="${policy}">`;
|
||||
const page = (policy: string, head = '', body = ''): string =>
|
||||
`<!doctype html><html><head>${CHARSET}${meta(policy)}${head}</head><body>${body}</body></html>`;
|
||||
|
||||
describe('check-csp', () => {
|
||||
it('passes a page whose inline style and script are hashed', () => {
|
||||
const css = 'a{color:red}';
|
||||
const js = 'console.log(1)';
|
||||
const root = project({
|
||||
'dist/index.html': page(
|
||||
`script-src 'self' ${sha(js)}; style-src 'self' ${sha(css)}`,
|
||||
`<style>${css}</style><script src="/a.js"></script>`,
|
||||
`<script>${js}</script><script type="application/ld+json">{"@type":"Thing"}</script>`,
|
||||
),
|
||||
});
|
||||
const r = run('check-csp.mjs', root);
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('OK (1 pages');
|
||||
});
|
||||
|
||||
it('refuses an unhashed <style> or inline <script>', () => {
|
||||
const root = project({
|
||||
'dist/index.html': page("script-src 'self'", '<style>a{}</style>', '<script>x()</script>'),
|
||||
});
|
||||
const r = run('check-csp.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('unhashedStyle');
|
||||
expect(r.out).toContain('unhashedScript');
|
||||
});
|
||||
|
||||
it('still sees inline code behind an unusual end tag', () => {
|
||||
const root = project({
|
||||
'dist/index.html': page(
|
||||
"script-src 'self'",
|
||||
'<STYLE media="all">a{}</style >',
|
||||
'<script>x()</script foo>',
|
||||
),
|
||||
});
|
||||
const r = run('check-csp.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('unhashedStyle');
|
||||
expect(r.out).toContain('unhashedScript');
|
||||
});
|
||||
|
||||
it.each(['style="color:red"', "STYLE='color:red'", 'style=color:red'])(
|
||||
'refuses the style attribute %s',
|
||||
(attr) => {
|
||||
const root = project({ 'dist/a.html': page("default-src 'self'", '', `<p ${attr}>x</p>`) });
|
||||
const r = run('check-csp.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('styleAttr');
|
||||
},
|
||||
);
|
||||
|
||||
it('lets an empty style attribute through', () => {
|
||||
const root = project({ 'dist/a.html': page("default-src 'self'", '', '<p style="">x</p>') });
|
||||
expect(run('check-csp.mjs', root).code).toBe(0);
|
||||
});
|
||||
|
||||
it('fails a page without a policy, and a dist/ without pages', () => {
|
||||
const missing = project({ 'dist/a.html': `<html><head>${CHARSET}</head></html>` });
|
||||
expect(run('check-csp.mjs', missing).out).toContain('missingCsp');
|
||||
const r = run('check-csp.mjs', project({ 'dist/sw.js': '' }));
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('found no HTML pages');
|
||||
});
|
||||
|
||||
it('fails when a script precedes the policy, until postbuild moves it first', () => {
|
||||
const late =
|
||||
`<!doctype html><html><head>${CHARSET}<script src="/t.js"></script>` +
|
||||
`${meta("script-src 'self'")}</head><body></body></html>`;
|
||||
const root = project({ 'dist/index.html': late, 'dist/vi/index.html': late });
|
||||
expect(run('check-csp.mjs', root).out).toContain('lateCsp');
|
||||
|
||||
expect(run('postbuild.mjs', root).out).toContain('moved to the top of <head> on 2 of 2 pages');
|
||||
const html = readFileSync(join(root, 'dist/index.html'), 'utf8');
|
||||
expect(html.indexOf(meta("script-src 'self'"))).toBe(html.indexOf(CHARSET) + CHARSET.length);
|
||||
expect(run('check-csp.mjs', root).code).toBe(0);
|
||||
|
||||
// Idempotent: a second pass changes nothing.
|
||||
expect(run('postbuild.mjs', root).out).toContain('on 0 of 2 pages');
|
||||
});
|
||||
});
|
||||
|
||||
describe('check-assets', () => {
|
||||
const html = (head: string): string => page("default-src 'self'", head);
|
||||
|
||||
it('passes when every same-origin asset exists', () => {
|
||||
const root = project({
|
||||
'dist/index.html': html(
|
||||
'<script src="/_astro/a.js?v=1"></script><link rel="stylesheet" href="/_astro/a.css">' +
|
||||
'<link rel="canonical" href="/not-an-asset"><link rel="icon" href="https://x.test/i.png">' +
|
||||
'<img src="//cdn.test/x.png">',
|
||||
),
|
||||
'dist/_astro/a.js': '',
|
||||
'dist/_astro/a.css': '',
|
||||
});
|
||||
const r = run('check-assets.mjs', root);
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('OK (1 pages, 2 distinct same-origin assets exist)');
|
||||
});
|
||||
|
||||
it('fails on a missing asset and on a data: script', () => {
|
||||
const root = project({
|
||||
'dist/index.html': html(
|
||||
'<script src="data:text/javascript,1"></script><link rel="stylesheet" href="/gone.css">' +
|
||||
'<img src="/logo%20x.svg">',
|
||||
),
|
||||
});
|
||||
const r = run('check-assets.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('script is a data: URL');
|
||||
expect(r.out).toContain('link[stylesheet] /gone.css does not exist');
|
||||
expect(r.out).toContain('image /logo x.svg does not exist');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
/**
|
||||
* Build guard: dist/rss.xml must be the feed notify.py can trust.
|
||||
*
|
||||
* WHY THIS EXISTS. A cross-poster (notify.py) reads /rss.xml on a schedule
|
||||
* and announces every <guid> it has not seen before — to Telegram, Discord,
|
||||
* Bluesky, Mastodon, X and Facebook. So the feed's failure modes are public
|
||||
* and irreversible: a GUID that changes shape (a URL instead of the slug, a
|
||||
* slug with a different case) re-announces the whole window, and a GUID that
|
||||
* names no app announces a dead link. src/lib/feed.ts builds the items and is
|
||||
* unit-tested; this asserts what actually got EMITTED, because @astrojs/rss
|
||||
* has no guid option and the slug guid is injected through customData
|
||||
* (src/pages/rss.xml.ts) — exactly the kind of seam a dependency update
|
||||
* breaks with every test still green.
|
||||
*
|
||||
* Checks: 1–50 items; every item has exactly one <guid isPermaLink="false">
|
||||
* holding a slug of an app in src/data/apps; guids are unique; <link> is
|
||||
* that app's page; <pubDate> parses and items run newest first.
|
||||
*/
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const FEED = join(process.cwd(), 'dist/rss.xml');
|
||||
const APPS_DIR = join(process.cwd(), 'src/data/apps');
|
||||
const SITE = 'https://softharbor.net';
|
||||
const LIMIT = 50;
|
||||
const SLUG_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
||||
|
||||
const problems = [];
|
||||
let items = [];
|
||||
|
||||
if (existsSync(FEED)) {
|
||||
const xml = readFileSync(FEED, 'utf8');
|
||||
items = [...xml.matchAll(/<item>([\s\S]*?)<\/item>/g)].map((m) => m[1]);
|
||||
if (items.length === 0) problems.push('the feed has no <item>');
|
||||
if (items.length > LIMIT) problems.push(`${items.length} items — the window is ${LIMIT}`);
|
||||
|
||||
const seen = new Set();
|
||||
let previous = Infinity;
|
||||
for (const [i, item] of items.entries()) {
|
||||
const where = `item ${i + 1}`;
|
||||
const guids = [...item.matchAll(/<guid\b([^>]*)>([^<]*)<\/guid>/g)];
|
||||
if (guids.length !== 1) {
|
||||
problems.push(`${where}: ${guids.length} <guid> elements (want exactly 1)`);
|
||||
continue;
|
||||
}
|
||||
const [, attrs, slug] = guids[0];
|
||||
if (!/\bisPermaLink="false"/.test(attrs)) {
|
||||
problems.push(
|
||||
`${where}: <guid> is not isPermaLink="false" — a URL guid changes with the URL`,
|
||||
);
|
||||
}
|
||||
if (!SLUG_RE.test(slug)) {
|
||||
problems.push(`${where}: guid "${slug}" is not a slug`);
|
||||
} else if (!existsSync(join(APPS_DIR, `${slug}.json`))) {
|
||||
problems.push(`${where}: guid "${slug}" names no app in src/data/apps`);
|
||||
}
|
||||
if (seen.has(slug)) problems.push(`${where}: duplicate guid "${slug}"`);
|
||||
seen.add(slug);
|
||||
|
||||
const link = /<link>([^<]*)<\/link>/.exec(item)?.[1];
|
||||
if (link !== `${SITE}/apps/${slug}`) {
|
||||
problems.push(`${where}: <link> ${link ?? '(none)'} is not ${SITE}/apps/${slug}`);
|
||||
}
|
||||
|
||||
const when = Date.parse(/<pubDate>([^<]*)<\/pubDate>/.exec(item)?.[1] ?? '');
|
||||
if (Number.isNaN(when)) problems.push(`${where}: missing or unparseable <pubDate>`);
|
||||
else if (when > previous) problems.push(`${where}: newer than the item before it`);
|
||||
else previous = when;
|
||||
}
|
||||
} else {
|
||||
problems.push('dist/rss.xml does not exist — run `astro build` first');
|
||||
}
|
||||
|
||||
if (problems.length > 0) {
|
||||
console.error(`check-feed — ${problems.length} problem(s):`);
|
||||
for (const p of problems.slice(0, 20)) console.error(` ✗ ${p}`);
|
||||
console.error(
|
||||
'\n notify.py announces every new guid; see docs/05 §A4 before changing the feed.',
|
||||
);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(`check-feed — OK (${items.length} items, slug guids, newest first)`);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { project, run } from './fixture';
|
||||
|
||||
const item = (slug: string, date = 'Tue, 28 Jul 2026 00:00:00 GMT', guid?: string) =>
|
||||
`<item><title>${slug}</title><link>https://softharbor.net/apps/${slug}</link>` +
|
||||
`${guid ?? `<guid isPermaLink="false">${slug}</guid>`}<pubDate>${date}</pubDate></item>`;
|
||||
const feed = (...items: string[]) =>
|
||||
`<?xml version="1.0"?><rss version="2.0"><channel><title>t</title>${items.join('')}</channel></rss>`;
|
||||
const apps = (...slugs: string[]) =>
|
||||
Object.fromEntries(slugs.map((s) => [`src/data/apps/${s}.json`, '{}']));
|
||||
|
||||
describe('check-feed', () => {
|
||||
it('passes the shape notify.py relies on', () => {
|
||||
const root = project({
|
||||
...apps('gimp', 'vlc'),
|
||||
'dist/rss.xml': feed(item('vlc', 'Wed, 29 Jul 2026 00:00:00 GMT'), item('gimp')),
|
||||
});
|
||||
const r = run('check-feed.mjs', root);
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('OK (2 items');
|
||||
});
|
||||
|
||||
it.each([
|
||||
[
|
||||
'a URL guid',
|
||||
item('vlc', undefined, '<guid>https://softharbor.net/apps/vlc</guid>'),
|
||||
'isPermaLink',
|
||||
],
|
||||
['a guid naming no app', item('ghost'), 'names no app'],
|
||||
['no guid at all', item('vlc', undefined, ''), '0 <guid> elements'],
|
||||
[
|
||||
'a capitalised guid',
|
||||
item('vlc', undefined, '<guid isPermaLink="false">VLC</guid>'),
|
||||
'is not a slug',
|
||||
],
|
||||
['an unparseable date', item('vlc', 'yesterday'), 'unparseable <pubDate>'],
|
||||
])('fails on %s', (_name, bad, message) => {
|
||||
const r = run('check-feed.mjs', project({ ...apps('vlc'), 'dist/rss.xml': feed(bad) }));
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain(message);
|
||||
});
|
||||
|
||||
it('fails on duplicates, older-before-newer, a wrong link and an empty feed', () => {
|
||||
const dup = run(
|
||||
'check-feed.mjs',
|
||||
project({ ...apps('vlc'), 'dist/rss.xml': feed(item('vlc'), item('vlc')) }),
|
||||
);
|
||||
expect(dup.out).toContain('duplicate guid "vlc"');
|
||||
|
||||
const order = run(
|
||||
'check-feed.mjs',
|
||||
project({
|
||||
...apps('vlc', 'gimp'),
|
||||
'dist/rss.xml': feed(item('vlc'), item('gimp', 'Wed, 29 Jul 2026 00:00:00 GMT')),
|
||||
}),
|
||||
);
|
||||
expect(order.out).toContain('newer than the item before it');
|
||||
|
||||
const link = run(
|
||||
'check-feed.mjs',
|
||||
project({
|
||||
...apps('vlc'),
|
||||
'dist/rss.xml': feed(item('vlc').replace('/apps/vlc', '/apps/vlc-player')),
|
||||
}),
|
||||
);
|
||||
expect(link.out).toContain('is not https://softharbor.net/apps/vlc');
|
||||
|
||||
const empty = run('check-feed.mjs', project({ 'dist/rss.xml': feed() }));
|
||||
expect(empty.code).toBe(1);
|
||||
expect(empty.out).toContain('no <item>');
|
||||
});
|
||||
|
||||
it('fails when the window grows past 50', () => {
|
||||
const slugs = Array.from({ length: 51 }, (_, i) => `app-${i}`);
|
||||
const r = run(
|
||||
'check-feed.mjs',
|
||||
project({ ...apps(...slugs), 'dist/rss.xml': feed(...slugs.map((s) => item(s))) }),
|
||||
);
|
||||
expect(r.out).toContain('51 items');
|
||||
});
|
||||
});
|
||||
@@ -15,34 +15,71 @@ import { join } from 'node:path';
|
||||
|
||||
const root = join(process.cwd(), 'src/i18n');
|
||||
const BASE = 'en';
|
||||
/** Locale dictionaries only — `xx.json` or `xx-YY.json`, never helper files. */
|
||||
const LOCALE_FILE = /^([a-z]{2}(?:-[A-Z]{2})?)\.json$/;
|
||||
const PLACEHOLDER = /\{(\w+)}/g;
|
||||
|
||||
/** Dot-flatten so nested objects can never hide a missing leaf. */
|
||||
/** Plain UTF-16 order — identical to the default sort, but explicit (S2871). */
|
||||
const byCodeUnit = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
||||
|
||||
/**
|
||||
* Dot-flatten so nested objects can never hide a missing leaf. An EMPTY object
|
||||
* or array is reported as its own key, otherwise `"x": {}` flattens to nothing
|
||||
* and a locale could carry it unnoticed.
|
||||
*/
|
||||
function flatten(value, prefix = '') {
|
||||
if (value === null || typeof value !== 'object') return [prefix];
|
||||
return Object.entries(value).flatMap(([k, v]) => flatten(v, prefix ? `${prefix}.${k}` : k));
|
||||
if (value === null || typeof value !== 'object') return [[prefix, value]];
|
||||
const entries = Object.entries(value);
|
||||
if (entries.length === 0) return [[prefix, value]];
|
||||
return entries.flatMap(([k, v]) => flatten(v, prefix ? `${prefix}.${k}` : k));
|
||||
}
|
||||
|
||||
const keysFor = (lang) =>
|
||||
new Set(flatten(JSON.parse(readFileSync(join(root, `${lang}.json`), 'utf8'))));
|
||||
|
||||
const locales = readdirSync(root)
|
||||
.filter((f) => f.endsWith('.json'))
|
||||
.map((f) => f.replace(/\.json$/, ''));
|
||||
|
||||
const baseKeys = keysFor(BASE);
|
||||
const errors = [];
|
||||
|
||||
function load(lang) {
|
||||
const file = join(root, `${lang}.json`);
|
||||
// Windows editors like to prepend a UTF-8 BOM, which JSON.parse rejects
|
||||
// with a stack trace instead of a readable gate failure.
|
||||
const text = readFileSync(file, 'utf8').replace(/^\uFEFF/, '');
|
||||
try {
|
||||
return new Map(flatten(JSON.parse(text)));
|
||||
} catch (err) {
|
||||
errors.push(`${lang}.json → not valid JSON (${err.message})`);
|
||||
return new Map();
|
||||
}
|
||||
}
|
||||
|
||||
const placeholders = (s) =>
|
||||
typeof s === 'string' ? [...s.matchAll(PLACEHOLDER)].map((m) => m[1]).sort(byCodeUnit) : [];
|
||||
|
||||
const locales = readdirSync(root)
|
||||
.map((f) => LOCALE_FILE.exec(f)?.[1])
|
||||
.filter(Boolean);
|
||||
|
||||
const dicts = new Map(locales.map((lang) => [lang, load(lang)]));
|
||||
const base = dicts.get(BASE) ?? new Map();
|
||||
|
||||
for (const lang of locales.filter((l) => l !== BASE)) {
|
||||
const langKeys = keysFor(lang);
|
||||
for (const k of baseKeys) if (!langKeys.has(k)) errors.push(`${lang}.json → missing "${k}"`);
|
||||
for (const k of langKeys) if (!baseKeys.has(k)) errors.push(`${lang}.json → extra "${k}"`);
|
||||
const dict = dicts.get(lang);
|
||||
for (const [k, v] of base) {
|
||||
if (!dict.has(k)) {
|
||||
errors.push(`${lang}.json → missing "${k}"`);
|
||||
continue;
|
||||
}
|
||||
// `t()` substitutes {name} placeholders (src/i18n/index.ts); a translation
|
||||
// that drops or renames one renders the literal braces to the visitor.
|
||||
const want = placeholders(v).join(',');
|
||||
const got = placeholders(dict.get(k)).join(',');
|
||||
if (want !== got) errors.push(`${lang}.json → "${k}" placeholders {${got}} ≠ en {${want}}`);
|
||||
}
|
||||
for (const k of dict.keys()) if (!base.has(k)) errors.push(`${lang}.json → extra "${k}"`);
|
||||
}
|
||||
|
||||
// Alphabetical order is a review aid, not cosmetics: it keeps diffs of a
|
||||
// 200-key dictionary readable (docs/07 §3).
|
||||
for (const lang of locales) {
|
||||
const keys = [...keysFor(lang)];
|
||||
const sorted = [...keys].sort();
|
||||
// large dictionary readable (docs/07 §3).
|
||||
for (const [lang, dict] of dicts) {
|
||||
const keys = [...dict.keys()];
|
||||
const sorted = [...keys].sort(byCodeUnit);
|
||||
const at = keys.findIndex((k, i) => k !== sorted[i]);
|
||||
if (at !== -1) errors.push(`${lang}.json → keys not alphabetised (first: "${keys[at]}")`);
|
||||
}
|
||||
@@ -52,5 +89,5 @@ if (errors.length > 0) {
|
||||
for (const e of errors) console.error(` ✗ ${e}`);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(`i18n:check — OK (${baseKeys.size} keys × ${locales.length} locales)`);
|
||||
console.log(`i18n:check — OK (${base.size} keys × ${locales.length} locales)`);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { project, run } from './fixture';
|
||||
|
||||
const BOM = String.fromCharCode(0xfeff);
|
||||
const dicts = (en: unknown, vi: unknown): Record<string, string> => ({
|
||||
'src/i18n/en.json': JSON.stringify(en),
|
||||
'src/i18n/vi.json': JSON.stringify(vi),
|
||||
});
|
||||
|
||||
describe('check-i18n-parity', () => {
|
||||
it('passes when every locale mirrors English, nested keys included', () => {
|
||||
const root = project(dicts({ a: 'A', b: { c: 'C {n}' } }, { a: 'Á', b: { c: 'Cê {n}' } }));
|
||||
const r = run('check-i18n-parity.mjs', root);
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('OK (2 keys × 2 locales)');
|
||||
});
|
||||
|
||||
it('reports missing and extra keys', () => {
|
||||
const root = project(dicts({ a: 'A', b: 'B' }, { a: 'A', z: 'Z' }));
|
||||
const r = run('check-i18n-parity.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('vi.json → missing "b"');
|
||||
expect(r.out).toContain('vi.json → extra "z"');
|
||||
});
|
||||
|
||||
it('reports an empty object as its own key instead of flattening it away', () => {
|
||||
const root = project(dicts({ a: 'A', x: {} }, { a: 'A' }));
|
||||
expect(run('check-i18n-parity.mjs', root).out).toContain('vi.json → missing "x"');
|
||||
});
|
||||
|
||||
it('catches a translation that drops or renames a {placeholder}', () => {
|
||||
const root = project(dicts({ n: '{count} apps' }, { n: '{total} ứng dụng' }));
|
||||
const r = run('check-i18n-parity.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('"n" placeholders {total} ≠ en {count}');
|
||||
});
|
||||
|
||||
it('requires alphabetised keys', () => {
|
||||
const root = project(dicts({ b: 'B', a: 'A' }, { a: 'A', b: 'B' }));
|
||||
expect(run('check-i18n-parity.mjs', root).out).toContain(
|
||||
'en.json → keys not alphabetised (first: "b")',
|
||||
);
|
||||
});
|
||||
|
||||
it('accepts a UTF-8 BOM and reports broken JSON without a stack trace', () => {
|
||||
const root = project({
|
||||
'src/i18n/en.json': `${BOM}{"a":"A"}`,
|
||||
'src/i18n/vi.json': '{"a": ',
|
||||
});
|
||||
const r = run('check-i18n-parity.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('vi.json → not valid JSON');
|
||||
expect(r.out).not.toContain('en.json → not valid JSON');
|
||||
expect(r.out).not.toMatch(/^\s+at /m);
|
||||
});
|
||||
|
||||
it('ignores helper files that are not locale dictionaries', () => {
|
||||
const root = project({ ...dicts({ a: 'A' }, { a: 'A' }), 'src/i18n/index.json': '{}' });
|
||||
expect(run('check-i18n-parity.mjs', root).out).toContain('× 2 locales');
|
||||
});
|
||||
});
|
||||
@@ -1,140 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
/**
|
||||
* Build guard: no inline `style` attributes may reach dist/ (docs/09 §4).
|
||||
*
|
||||
* WHY THIS EXISTS. CSP `style-src` governs inline style ATTRIBUTES, not just
|
||||
* <style> blocks, and hashes do not apply to attributes — only
|
||||
* 'unsafe-hashes' or 'unsafe-inline' would permit them. Our policy has
|
||||
* neither, so any `style="…"` is silently DROPPED by the browser. Nothing
|
||||
* errors: the build passes, the markup looks right in source, and the page
|
||||
* renders with the declaration missing.
|
||||
*
|
||||
* That is exactly how the sticky header shipped transparent and let content
|
||||
* bleed through it (2026-07-28). A visual bug from an invisible cause is worth
|
||||
* a permanent check, so this runs in CI beside the other gates.
|
||||
*
|
||||
* Fix for a failure: use a Tailwind utility. Every design token is exposed as
|
||||
* one (`text-sh-muted`, `bg-sh-surface`, `border-sh-border`) in
|
||||
* src/styles/global.css.
|
||||
*/
|
||||
import { createHash } from 'node:crypto';
|
||||
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
||||
import { join, relative } from 'node:path';
|
||||
|
||||
const DIST = join(process.cwd(), 'dist');
|
||||
|
||||
const CSP_META = /<meta http-equiv="content-security-policy" content="([^"]+)"/i;
|
||||
const STYLE_EL = /<style[^>]*>([\s\S]*?)<\/style>/gi;
|
||||
const sha256 = (s) => `sha256-${createHash('sha256').update(s, 'utf8').digest('base64')}`;
|
||||
|
||||
function walk(dir) {
|
||||
const out = [];
|
||||
for (const entry of readdirSync(dir)) {
|
||||
const p = join(dir, entry);
|
||||
if (statSync(p).isDirectory()) out.push(...walk(p));
|
||||
else if (p.endsWith('.html')) out.push(p);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
const offenders = [];
|
||||
/** `<style>` elements whose hash is absent from their own page's CSP. */
|
||||
const unhashed = [];
|
||||
/** hash -> a page that emits it; and every page's allowed set, for the
|
||||
* cross-page check below. */
|
||||
const emittedBy = new Map();
|
||||
const allowedBy = new Map();
|
||||
|
||||
for (const file of walk(DIST)) {
|
||||
const html = readFileSync(file, 'utf8');
|
||||
for (const m of html.matchAll(/<[^>]*\sstyle="([^"]*)"[^>]*>/g)) {
|
||||
// An empty style="" is harmless noise from a framework; a declaration is not.
|
||||
if (m[1].trim() === '') continue;
|
||||
offenders.push({ file: relative(process.cwd(), file), decl: m[1].slice(0, 70) });
|
||||
}
|
||||
|
||||
// The attribute sweep above misses a whole second category: a `<style>`
|
||||
// ELEMENT whose content Astro forgot to hash. `transition:name` shipped
|
||||
// exactly that — 1.5 MB of CSS the browser refused on every page, with all
|
||||
// eight gates green, because nothing compared the emitted styles against the
|
||||
// policy that governs them.
|
||||
const csp = CSP_META.exec(html)?.[1];
|
||||
if (!csp) continue;
|
||||
const rel = relative(process.cwd(), file);
|
||||
allowedBy.set(rel, new Set(csp.match(/'sha256-[^']+'/g)?.map((h) => h.slice(1, -1)) ?? []));
|
||||
for (const m of html.matchAll(STYLE_EL)) {
|
||||
const hash = sha256(m[1]);
|
||||
if (!emittedBy.has(hash)) emittedBy.set(hash, { file: rel, head: m[1].slice(0, 70) });
|
||||
if (!csp.includes(hash)) unhashed.push({ file: rel, hash, head: m[1].slice(0, 70) });
|
||||
}
|
||||
}
|
||||
|
||||
// A meta CSP is applied when the document PARSES. `<ClientRouter />` swaps
|
||||
// without reparsing, so the policy in force stays the one from the page the
|
||||
// visitor started on. A style that only some pages carry is therefore refused
|
||||
// on arrival from any page that lacked it — invisible to the per-page check
|
||||
// above, because on a hard load that page allows its own style just fine.
|
||||
//
|
||||
// `/apps` hit this: it alone carried ShAppCard's scoped CSS, so soft-navigating
|
||||
// there from a detail page silently dropped the stretched-link `::after` (the
|
||||
// whole-card click target) and unhid `.sr-only` text.
|
||||
const universal = [...emittedBy.keys()].filter((h) =>
|
||||
[...allowedBy.values()].every((s) => s.has(h)),
|
||||
);
|
||||
const pageSpecific = [...emittedBy.keys()].filter((h) => !universal.includes(h));
|
||||
|
||||
if (offenders.length > 0) {
|
||||
console.error(
|
||||
`check-no-inline-styles — ${offenders.length} inline style attribute(s) in dist:\n`,
|
||||
);
|
||||
const seen = new Set();
|
||||
for (const o of offenders) {
|
||||
const key = o.decl;
|
||||
if (seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
console.error(` ✗ ${o.file}\n style="${o.decl}"`);
|
||||
}
|
||||
console.error('\n CSP style-src drops these silently. Use a Tailwind utility instead');
|
||||
console.error(' — the design tokens are exposed as one in src/styles/global.css.');
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
if (unhashed.length > 0) {
|
||||
console.error(`check-no-inline-styles — ${unhashed.length} <style> element(s) the page's own`);
|
||||
console.error('CSP does not allow. The browser refuses these; the build never notices:\n');
|
||||
const seen = new Set();
|
||||
for (const u of unhashed) {
|
||||
if (seen.has(u.hash)) continue;
|
||||
seen.add(u.hash);
|
||||
console.error(` ✗ ${u.file}\n ${u.hash}\n ${JSON.stringify(u.head)}`);
|
||||
}
|
||||
console.error(`\n ${unhashed.length} occurrence(s), ${seen.size} distinct.`);
|
||||
console.error(' Astro hashes the styles it knows about; anything it misses must either be');
|
||||
console.error(' removed or added via security.csp.styleDirective.hashes (docs/09 §4).');
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
if (pageSpecific.length > 0) {
|
||||
console.error(
|
||||
`check-no-inline-styles — ${pageSpecific.length} <style> element(s) that only SOME`,
|
||||
);
|
||||
console.error("pages allow. A ClientRouter swap keeps the origin page's policy, so arriving");
|
||||
console.error('at the page carrying these from a page without them gets them refused:\n');
|
||||
for (const hash of pageSpecific) {
|
||||
const { file, head } = emittedBy.get(hash) ?? {};
|
||||
const short = [...allowedBy].filter(([, s]) => !s.has(hash)).length;
|
||||
console.error(` ✗ ${file}\n ${hash}\n ${JSON.stringify(head)}`);
|
||||
console.error(` refused when arriving from ${short} of ${allowedBy.size} pages`);
|
||||
}
|
||||
console.error("\n Emit the CSS as an external stylesheet instead — style-src 'self' covers it");
|
||||
console.error(" on every page with no hash at all (build.inlineStylesheets: 'never').");
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
if (offenders.length === 0 && unhashed.length === 0 && pageSpecific.length === 0) {
|
||||
console.log(
|
||||
`check-no-inline-styles — OK (no style attributes; ${universal.length} <style> hash(es), ` +
|
||||
`allowed on all ${allowedBy.size} pages)`,
|
||||
);
|
||||
}
|
||||
@@ -19,6 +19,10 @@
|
||||
* `NavigationRoute(createHandlerBoundToURL('/'))`. Since '/' was never
|
||||
* precached, every SW-handled navigation threw
|
||||
* `non-precached-url :: [{"url":"/"}]` in the console (2026-07-30).
|
||||
* 5. `@vite-pwa/astro` 2.0.0 emitted a classic SW that still held ES
|
||||
* `import` statements of bare `@vite-pwa/workbox-swkit/*` specifiers
|
||||
* (unresolvable under pnpm's strict layout) and an empty precache — a
|
||||
* script the browser cannot even evaluate (tried 2026-11-04, refused).
|
||||
*
|
||||
* Number 4 was the dangerous one. Had '/' been precached, that route would
|
||||
* have served the home page for EVERY navigation — failure 2 again, but
|
||||
@@ -33,23 +37,54 @@ import { join } from 'node:path';
|
||||
const SW = join(process.cwd(), 'dist/sw.js');
|
||||
const problems = [];
|
||||
|
||||
/**
|
||||
* Whether any line of `code` is an ES `import`/`export` statement, which a
|
||||
* classic script cannot evaluate. A dynamic `import(` and `importScripts(` are
|
||||
* fine. Line by line, so the pattern never backtracks across newlines.
|
||||
*/
|
||||
function hasModuleSyntax(code) {
|
||||
return code
|
||||
.split('\n')
|
||||
.some((line) => /^(?:import|export)(?:\s+[^\s(]|[{*"'`])/.test(line.trimStart()));
|
||||
}
|
||||
|
||||
if (!existsSync(SW)) {
|
||||
problems.push('dist/sw.js does not exist — the PWA integration produced no service worker');
|
||||
} else {
|
||||
const sw = readFileSync(SW, 'utf8');
|
||||
|
||||
// (5) A classic service worker (what registerSW.js registers) cannot
|
||||
// evaluate ES `import` statements, and every script it pulls in with
|
||||
// importScripts() must exist. These checks, and the name checks below, read
|
||||
// the unminified output — `minify: false` in astro.config.ts keeps it so.
|
||||
if (hasModuleSyntax(sw)) {
|
||||
problems.push(
|
||||
'dist/sw.js still contains ES `import` statements — a classic service worker cannot\n' +
|
||||
' evaluate them (bare @vite-pwa/workbox-swkit specifiers: that package must be a\n' +
|
||||
' direct dependency so the SW bundler can resolve it).',
|
||||
);
|
||||
}
|
||||
for (const m of sw.matchAll(/importScripts\(\s*(["'`])(?:\.\/)?([^"'`]+)\1\s*\)/g)) {
|
||||
if (!existsSync(join(process.cwd(), 'dist', m[2]))) {
|
||||
problems.push(`dist/sw.js loads ${m[2]} with importScripts(), but the build did not emit it`);
|
||||
}
|
||||
}
|
||||
|
||||
// (4) No navigation fallback route. Navigations must reach the network so
|
||||
// content stays fresh; the offline page is a failure path, not a strategy.
|
||||
if (sw.includes('NavigationRoute') || sw.includes('createHandlerBoundToURL')) {
|
||||
problems.push(
|
||||
"a NavigationRoute is registered — set `workbox.navigateFallback: ''`.\n" +
|
||||
"a NavigationRoute is registered — set `generateSW.navigateFallback: ''`.\n" +
|
||||
' Omitting the key is not enough; vite-plugin-pwa defaults it to index.html.',
|
||||
);
|
||||
}
|
||||
|
||||
// (2) Navigations are NetworkOnly, falling back to /offline only on failure.
|
||||
if (!sw.includes('NetworkOnly')) {
|
||||
problems.push('no NetworkOnly navigation route — navigations would not hit the network');
|
||||
problems.push(
|
||||
'no NetworkOnly navigation route — navigations would not hit the network\n' +
|
||||
' (a minified SW drops the names this check reads: keep `minify: false`).',
|
||||
);
|
||||
}
|
||||
if (!sw.includes('/offline')) {
|
||||
problems.push('no /offline fallback — a failed navigation would show the browser error page');
|
||||
@@ -57,25 +92,83 @@ if (!existsSync(SW)) {
|
||||
|
||||
// (3) The globs actually matched. An empty or near-empty precache means the
|
||||
// offline page is not there, which is invisible until you pull the cable.
|
||||
const urls = [...sw.matchAll(/url:"([^"]+)"/g)].map((m) => m[1]);
|
||||
const urls = [...sw.matchAll(/url:\s*(["'`])([^"'`]+)\1/g)].map((m) => m[2]);
|
||||
if (!urls.some((u) => u.startsWith('offline'))) {
|
||||
problems.push(
|
||||
`offline.html is not precached (${urls.length} entries) — check workbox.globPatterns\n` +
|
||||
`offline.html is not precached (${urls.length} entries) — check generateSW.globPatterns\n` +
|
||||
' against build.format; they are coupled.',
|
||||
);
|
||||
}
|
||||
if (!urls.some((u) => u.endsWith('.woff2'))) {
|
||||
problems.push('no fonts precached — the offline shell would render unstyled');
|
||||
problems.push('no fonts precached — the offline shell would render in fallback fonts only');
|
||||
}
|
||||
|
||||
// (5) Everything the offline page itself loads must be precached, or it
|
||||
// renders broken exactly when it is shown. Checking the fonts alone missed
|
||||
// this for months: with inlineStylesheets 'never', /offline linked CSS the
|
||||
// SW never cached, so the fallback page was unstyled.
|
||||
const offlineFile = join(process.cwd(), 'dist/offline.html');
|
||||
if (existsSync(offlineFile)) {
|
||||
const offline = readFileSync(offlineFile, 'utf8');
|
||||
const needs = [
|
||||
...[...offline.matchAll(/<link\b[^>]*rel="stylesheet"[^>]*href="\/([^"]+)"/g)].map(
|
||||
(m) => m[1],
|
||||
),
|
||||
...[...offline.matchAll(/<script\b[^>]*\ssrc="\/(_astro\/[^"]+)"/g)].map((m) => m[1]),
|
||||
];
|
||||
for (const asset of needs) {
|
||||
if (!urls.includes(asset)) {
|
||||
problems.push(`/offline loads /${asset} but the SW does not precache it`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
problems.push('dist/offline.html does not exist');
|
||||
}
|
||||
|
||||
// (6) An updated SW must take over without waiting for every tab to close:
|
||||
// registerSW.js never posts SKIP_WAITING (generateSW.skipWaiting).
|
||||
if (!sw.includes('skipWaiting')) {
|
||||
problems.push('the SW does not call skipWaiting() — fixes would wait for every tab to close');
|
||||
}
|
||||
// (10) …and clears precaches an older Workbox format left behind
|
||||
// (generateSW.cleanupOutdatedCaches — a default in 1.x, opt-in in 2.x).
|
||||
if (!sw.includes('cleanupOutdatedCaches')) {
|
||||
problems.push(
|
||||
'the SW does not call cleanupOutdatedCaches() — old precaches would stay on disk',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// (1) The registration script must be referenced by a page, or the SW is dead
|
||||
// code no matter how correct it is.
|
||||
// code no matter how correct it is. (7) Same for the manifest: emitted but
|
||||
// unlinked means "not installable", silently.
|
||||
const home = join(process.cwd(), 'dist/index.html');
|
||||
if (existsSync(home) && !readFileSync(home, 'utf8').includes('registerSW.js')) {
|
||||
problems.push(
|
||||
"registerSW.js is not referenced from dist/index.html — set injectRegister: 'script'",
|
||||
);
|
||||
if (!existsSync(home)) {
|
||||
problems.push('dist/index.html does not exist — run `astro build` first');
|
||||
} else {
|
||||
const html = readFileSync(home, 'utf8');
|
||||
if (!html.includes('registerSW.js')) {
|
||||
problems.push(
|
||||
"registerSW.js is not referenced from dist/index.html — set injectRegister: 'script'",
|
||||
);
|
||||
}
|
||||
// (9) …and the page loads it as a CLASSIC script (`<script defer src>`), so
|
||||
// one ES `import` in it is a SyntaxError and the SW never registers. 2.x
|
||||
// emitted `import "@vite-pwa/workbox-window/esm-sw-detector"` until that
|
||||
// package became a direct dependency (2026-11-09).
|
||||
const register = join(process.cwd(), 'dist/registerSW.js');
|
||||
if (!existsSync(register)) {
|
||||
problems.push('dist/registerSW.js does not exist — nothing would register the SW');
|
||||
} else if (hasModuleSyntax(readFileSync(register, 'utf8'))) {
|
||||
problems.push(
|
||||
'dist/registerSW.js contains ES import/export — the page loads it as a classic script,\n' +
|
||||
' so it throws and the SW never registers (@vite-pwa/workbox-window must be a\n' +
|
||||
' direct dependency).',
|
||||
);
|
||||
}
|
||||
if (!html.includes('rel="manifest"')) {
|
||||
problems.push('dist/index.html does not link the web app manifest');
|
||||
}
|
||||
}
|
||||
|
||||
if (problems.length > 0) {
|
||||
@@ -84,5 +177,8 @@ if (problems.length > 0) {
|
||||
console.error('\n Every one of these fails silently at build time. See docs/08 Part D.');
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log('check-service-worker — OK (no navigation fallback, offline path precached)');
|
||||
console.log(
|
||||
'check-service-worker — OK (no navigation fallback; /offline and everything it loads ' +
|
||||
'precached; skipWaiting; manifest linked)',
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { project, run } from './fixture';
|
||||
|
||||
const GOOD_SW =
|
||||
'precacheAndRoute([{url:"offline.html"},{url:"_astro/f.woff2"},{url:"_astro/a.css"},' +
|
||||
'{url:"_astro/theme.js"}]);new NetworkOnly();handlerDidError("/offline");self.skipWaiting();' +
|
||||
'cleanupOutdatedCaches();';
|
||||
const OFFLINE =
|
||||
'<link rel="stylesheet" href="/_astro/a.css"><script src="/_astro/theme.js"></script>';
|
||||
const HOME = '<script defer src="/registerSW.js"></script><link rel="manifest" href="/m.json">';
|
||||
const REGISTER =
|
||||
'if ("serviceWorker" in navigator) navigator.serviceWorker.register("/sw.js", { scope: "/" });';
|
||||
|
||||
const dist = (over: Record<string, string> = {}): Record<string, string> => ({
|
||||
'dist/sw.js': GOOD_SW,
|
||||
'dist/offline.html': OFFLINE,
|
||||
'dist/index.html': HOME,
|
||||
'dist/registerSW.js': REGISTER,
|
||||
...over,
|
||||
});
|
||||
|
||||
describe('check-service-worker', () => {
|
||||
it('passes the shape docs/08 Part D describes', () => {
|
||||
const r = run('check-service-worker.mjs', project(dist()));
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('check-service-worker — OK');
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: 'a navigation fallback',
|
||||
over: { 'dist/sw.js': `${GOOD_SW}new NavigationRoute(h)` },
|
||||
message: 'NavigationRoute is registered',
|
||||
},
|
||||
{
|
||||
name: 'an unstyled offline page',
|
||||
over: { 'dist/sw.js': GOOD_SW.replace('{url:"_astro/a.css"},', '') },
|
||||
message: '/offline loads /_astro/a.css but the SW does not precache it',
|
||||
},
|
||||
{
|
||||
name: 'no precached fonts',
|
||||
over: { 'dist/sw.js': GOOD_SW.replace('{url:"_astro/f.woff2"},', '') },
|
||||
message: 'no fonts precached',
|
||||
},
|
||||
{
|
||||
name: 'no skipWaiting',
|
||||
over: { 'dist/sw.js': GOOD_SW.replace('self.skipWaiting();', '') },
|
||||
message: 'does not call skipWaiting',
|
||||
},
|
||||
{
|
||||
name: 'no cleanupOutdatedCaches',
|
||||
over: { 'dist/sw.js': GOOD_SW.replace('cleanupOutdatedCaches();', '') },
|
||||
message: 'does not call cleanupOutdatedCaches',
|
||||
},
|
||||
{
|
||||
name: 'no NetworkOnly navigation route',
|
||||
over: { 'dist/sw.js': GOOD_SW.replace('NetworkOnly', 'CacheFirst') },
|
||||
message: 'no NetworkOnly navigation route',
|
||||
},
|
||||
{
|
||||
name: 'ES imports left in a classic SW (@vite-pwa/astro 2.0.0 under pnpm)',
|
||||
over: {
|
||||
'dist/sw.js': `import { NetworkOnly } from "@vite-pwa/workbox-swkit/strategies";\n${GOOD_SW}`,
|
||||
},
|
||||
message: 'still contains ES `import` statements',
|
||||
},
|
||||
{
|
||||
name: 'an importScripts() target the build did not emit',
|
||||
over: { 'dist/sw.js': `importScripts("./workbox-0000.js");\n${GOOD_SW}` },
|
||||
message: 'loads workbox-0000.js with importScripts(), but the build did not emit it',
|
||||
},
|
||||
{
|
||||
name: 'an ES import in the classic registerSW.js',
|
||||
over: {
|
||||
'dist/registerSW.js': `import "@vite-pwa/workbox-window/esm-sw-detector";\n${REGISTER}`,
|
||||
},
|
||||
message: 'dist/registerSW.js contains ES import/export',
|
||||
},
|
||||
{
|
||||
name: 'an unlinked manifest',
|
||||
over: { 'dist/index.html': '<script src="/registerSW.js"></script>' },
|
||||
message: 'does not link the web app manifest',
|
||||
},
|
||||
{
|
||||
name: 'an unregistered service worker',
|
||||
over: { 'dist/index.html': '<link rel="manifest" href="/m.json">' },
|
||||
message: 'registerSW.js is not referenced',
|
||||
},
|
||||
])('fails on $name', ({ over, message }) => {
|
||||
const r = run('check-service-worker.mjs', project(dist(over)));
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain(message);
|
||||
});
|
||||
|
||||
it('reads the unminified @vite-pwa/astro 2 output and its emitted runtime', () => {
|
||||
const sw =
|
||||
'importScripts("./workbox-1234.js");\n' +
|
||||
'var { r: precacheAndRoute, t: NetworkOnly } = self.workbox.workbox;\n' +
|
||||
'self.skipWaiting();\n' +
|
||||
'precacheAndRoute([\n\t{\n\t\turl: "offline",\n\t\trevision: "x"\n\t},\n' +
|
||||
'\t{ url: "_astro/f.woff2", revision: null },\n\t{ url: "_astro/a.css", revision: null },\n' +
|
||||
'\t{ url: "_astro/theme.js", revision: null }\n]);\n' +
|
||||
'cleanupOutdatedCaches();\n' +
|
||||
'registerRoute(n, new NetworkOnly({ plugins: [new P({ "fallbackURL": "/offline" })] }));';
|
||||
const r = run(
|
||||
'check-service-worker.mjs',
|
||||
project(dist({ 'dist/sw.js': sw, 'dist/workbox-1234.js': '' })),
|
||||
);
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('check-service-worker — OK');
|
||||
});
|
||||
|
||||
it('fails when no registerSW.js was emitted', () => {
|
||||
const files = dist();
|
||||
delete files['dist/registerSW.js'];
|
||||
const r = run('check-service-worker.mjs', project(files));
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('dist/registerSW.js does not exist');
|
||||
});
|
||||
|
||||
it('fails when there is no service worker at all', () => {
|
||||
const r = run('check-service-worker.mjs', project({ 'dist/index.html': HOME }));
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('dist/sw.js does not exist');
|
||||
});
|
||||
});
|
||||
@@ -5,43 +5,56 @@
|
||||
* (docs/12 §5). L3 of the validation stack.
|
||||
*
|
||||
* node scripts/extract-urls.mjs → all entries (weekly sweep)
|
||||
* node scripts/extract-urls.mjs --changed → only files changed vs origin/main
|
||||
* git diff -U0 … | node scripts/extract-urls.mjs --added
|
||||
* → only URLs on lines the diff adds
|
||||
*
|
||||
* The --changed mode keeps PR feedback fast; the weekly job owns the full run.
|
||||
* The --added mode keeps PR feedback fast and about the PR: a link a pull
|
||||
* request adds or edits is checked, a link it merely sits next to is not.
|
||||
* Checking every link of every touched file (the old --changed mode) made a
|
||||
* re-check PR that rewrote 198 security blocks re-verify ~700 unrelated
|
||||
* vendor links, and any one vendor's bad minute (a 520, a 522, a timeout)
|
||||
* blocked it. The weekly job still owns the full run.
|
||||
*
|
||||
* The diff arrives on stdin rather than from a `git diff` spawned here.
|
||||
* Spawning `git` meant resolving it through PATH (SonarCloud S4036), and a
|
||||
* catch-all fallback would turn ANY git failure into a silent full sweep. The
|
||||
* workflow runs git itself under `set -euo pipefail`, so a broken diff fails
|
||||
* loudly where it happens.
|
||||
*/
|
||||
import { execSync } from 'node:child_process';
|
||||
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const APPS_DIR = join(process.cwd(), 'src/data/apps');
|
||||
const changedOnly = process.argv.includes('--changed');
|
||||
|
||||
let files = existsSync(APPS_DIR) ? readdirSync(APPS_DIR).filter((f) => f.endsWith('.json')) : [];
|
||||
/** Plain UTF-16 order — identical to the default sort, but explicit (S2871). */
|
||||
const byCodeUnit = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
||||
|
||||
if (changedOnly) {
|
||||
try {
|
||||
const diff = execSync('git diff --name-only origin/main...HEAD -- src/data/apps', {
|
||||
encoding: 'utf8',
|
||||
});
|
||||
const changed = new Set(
|
||||
diff
|
||||
.split('\n')
|
||||
.map((l) => l.trim().split('/').pop())
|
||||
.filter(Boolean),
|
||||
);
|
||||
files = files.filter((f) => changed.has(f));
|
||||
} catch {
|
||||
// No origin/main (fresh clone, detached CI checkout): fall back to the
|
||||
// full set rather than silently checking nothing.
|
||||
console.error('extract-urls: could not diff against origin/main, using all entries');
|
||||
const urls = new Set();
|
||||
|
||||
if (process.argv.includes('--added')) {
|
||||
// Unified diff: an added line starts with "+", the file header with "+++".
|
||||
for (const line of readFileSync(0, 'utf8').split('\n')) {
|
||||
if (!line.startsWith('+') || line.startsWith('+++')) continue;
|
||||
for (const [, url] of line.matchAll(/"(https:\/\/[^"\s]+)"/g)) urls.add(url);
|
||||
}
|
||||
} else {
|
||||
const files = existsSync(APPS_DIR)
|
||||
? readdirSync(APPS_DIR).filter((f) => f.endsWith('.json'))
|
||||
: [];
|
||||
for (const file of files) {
|
||||
let app;
|
||||
try {
|
||||
app = JSON.parse(readFileSync(join(APPS_DIR, file), 'utf8'));
|
||||
} catch (err) {
|
||||
// validate:data reports malformed JSON with context; here it must not
|
||||
// abort the whole sweep, but it must not pass unnoticed either.
|
||||
console.error(`extract-urls: skipping ${file} (${err.message})`);
|
||||
process.exitCode = 1;
|
||||
continue;
|
||||
}
|
||||
for (const v of Object.values(app.links ?? {})) if (v) urls.add(v);
|
||||
if (app.security?.evidence) urls.add(app.security.evidence);
|
||||
}
|
||||
}
|
||||
|
||||
const urls = new Set();
|
||||
for (const file of files) {
|
||||
const app = JSON.parse(readFileSync(join(APPS_DIR, file), 'utf8'));
|
||||
for (const v of Object.values(app.links ?? {})) if (v) urls.add(v);
|
||||
if (app.security?.evidence) urls.add(app.security.evidence);
|
||||
}
|
||||
|
||||
for (const u of [...urls].sort()) console.log(u);
|
||||
for (const u of [...urls].sort(byCodeUnit)) console.log(u);
|
||||
@@ -0,0 +1,84 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// Test kit for the build scripts. Every script resolves its inputs from
|
||||
// process.cwd() (dist/, src/i18n/, src/data/…), so a test writes a throwaway
|
||||
// project tree and runs the REAL script in it as a child process — the same
|
||||
// way `pnpm build` and CI invoke it, exit code and all.
|
||||
|
||||
import { spawn, spawnSync } from 'node:child_process';
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { onTestFinished } from 'vitest';
|
||||
|
||||
const SCRIPTS = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
/** A temporary project root holding `files` (path → contents), removed after the test. */
|
||||
export function project(files: Record<string, string>): string {
|
||||
const root = mkdtempSync(join(tmpdir(), 'sh-script-'));
|
||||
onTestFinished(() => {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
});
|
||||
write(root, files);
|
||||
return root;
|
||||
}
|
||||
|
||||
export function write(root: string, files: Record<string, string>): void {
|
||||
for (const [path, contents] of Object.entries(files)) {
|
||||
mkdirSync(dirname(join(root, path)), { recursive: true });
|
||||
writeFileSync(join(root, path), contents);
|
||||
}
|
||||
}
|
||||
|
||||
export interface Run {
|
||||
code: number | null;
|
||||
stdout: string;
|
||||
/** stdout + stderr, for assertions that do not care which stream. */
|
||||
out: string;
|
||||
}
|
||||
|
||||
export function run(
|
||||
script: string,
|
||||
root: string,
|
||||
opts: { args?: string[]; input?: string; env?: Record<string, string> } = {},
|
||||
): Run {
|
||||
// Never inherit GITHUB_OUTPUT: under Actions, quarantine.mjs would append to
|
||||
// the CI job's real output file.
|
||||
const env = { ...process.env };
|
||||
Reflect.deleteProperty(env, 'GITHUB_OUTPUT');
|
||||
const r = spawnSync(process.execPath, [join(SCRIPTS, script), ...(opts.args ?? [])], {
|
||||
cwd: root,
|
||||
input: opts.input ?? '',
|
||||
encoding: 'utf8',
|
||||
env: { ...env, ...opts.env },
|
||||
});
|
||||
return { code: r.status, stdout: r.stdout, out: r.stdout + r.stderr };
|
||||
}
|
||||
|
||||
/**
|
||||
* `run`, without blocking the event loop: for a script that talks to a server
|
||||
* the test itself runs (scripts/gitea.test.ts), which spawnSync would starve.
|
||||
*/
|
||||
export function runAsync(
|
||||
script: string,
|
||||
root: string,
|
||||
opts: { args?: string[]; env?: Record<string, string> } = {},
|
||||
): Promise<Run> {
|
||||
const env = { ...process.env };
|
||||
Reflect.deleteProperty(env, 'GITHUB_OUTPUT');
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(process.execPath, [join(SCRIPTS, script), ...(opts.args ?? [])], {
|
||||
cwd: root,
|
||||
env: { ...env, ...opts.env },
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
});
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
child.stdout.setEncoding('utf8').on('data', (d: string) => (stdout += d));
|
||||
child.stderr.setEncoding('utf8').on('data', (d: string) => (stderr += d));
|
||||
child.on('error', reject);
|
||||
child.on('close', (code) => resolve({ code, stdout, out: stdout + stderr }));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
/**
|
||||
* Generates the raster icons from one vector mark: `pnpm icons`.
|
||||
*
|
||||
* The mark is the anchor SoftHarbor has always used ("a safe berth after a
|
||||
* reinstall", docs/00 D1), now on a fixed harbour-blue tile. The previous
|
||||
* favicon drew the anchor in `currentColor`, which renders BLACK in a browser
|
||||
* tab or launcher (there is no CSS context there) — invisible on dark tab
|
||||
* strips — and it was also the only, unsafe, "maskable" PWA icon.
|
||||
*
|
||||
* Output is committed (public/), so builds never depend on this script or on
|
||||
* sharp's native binary; re-run it only when the mark changes.
|
||||
*
|
||||
* public/favicon.svg tab icon (vector, rounded tile)
|
||||
* public/favicon.ico 16/32/48 px, for clients that ask for /favicon.ico
|
||||
* public/apple-touch-icon.png 180 px, full-bleed (iOS applies its own mask)
|
||||
* public/icons/icon-192.png PWA "any"
|
||||
* public/icons/icon-512.png PWA "any"
|
||||
* public/icons/maskable-512.png PWA "maskable": full-bleed, mark inside the 80 % safe zone
|
||||
*/
|
||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import sharp from 'sharp';
|
||||
|
||||
const OUT = join(process.cwd(), 'public');
|
||||
const DEEP = '#0B4F7A';
|
||||
const LIGHT = '#1C93B8';
|
||||
|
||||
/** The anchor, drawn on a 32-unit grid centred at (16, 16). */
|
||||
const ANCHOR = `
|
||||
<circle cx="16" cy="8.5" r="2.6" />
|
||||
<path d="M16 11.1v13.4" />
|
||||
<path d="M10.5 15h11" />
|
||||
<path d="M7.5 18.5a8.5 8.5 0 0 0 17 0" />`;
|
||||
|
||||
/**
|
||||
* @param {{ rounded: boolean, scale: number }} opts
|
||||
* rounded — rounded tile on transparency (tab/"any") vs full-bleed square;
|
||||
* scale — anchor size relative to the tile (maskable keeps it in the safe zone).
|
||||
*/
|
||||
function mark({ rounded, scale }) {
|
||||
const offset = 16 - 16 * scale;
|
||||
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||
<defs>
|
||||
<linearGradient id="sh-tile" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0" stop-color="${LIGHT}" />
|
||||
<stop offset="1" stop-color="${DEEP}" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="32" height="32" ${rounded ? 'rx="7"' : ''} fill="url(#sh-tile)" />
|
||||
<g fill="none" stroke="#ffffff" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"
|
||||
transform="translate(${offset} ${offset}) scale(${scale})">${ANCHOR}
|
||||
</g>
|
||||
</svg>
|
||||
`;
|
||||
}
|
||||
|
||||
const png = (svg, size) =>
|
||||
sharp(Buffer.from(svg), { density: 72 * (size / 32) * 2 })
|
||||
.resize(size, size)
|
||||
.png({ compressionLevel: 9 })
|
||||
.toBuffer();
|
||||
|
||||
/** Minimal ICO container: a directory of PNG-encoded images (Vista+). */
|
||||
function ico(images) {
|
||||
const header = Buffer.alloc(6);
|
||||
header.writeUInt16LE(0, 0); // reserved
|
||||
header.writeUInt16LE(1, 2); // type: icon
|
||||
header.writeUInt16LE(images.length, 4);
|
||||
const entries = [];
|
||||
let offset = 6 + 16 * images.length;
|
||||
for (const { size, data } of images) {
|
||||
const e = Buffer.alloc(16);
|
||||
e.writeUInt8(size >= 256 ? 0 : size, 0);
|
||||
e.writeUInt8(size >= 256 ? 0 : size, 1);
|
||||
e.writeUInt8(0, 2); // palette
|
||||
e.writeUInt8(0, 3); // reserved
|
||||
e.writeUInt16LE(1, 4); // colour planes
|
||||
e.writeUInt16LE(32, 6); // bits per pixel
|
||||
e.writeUInt32LE(data.length, 8);
|
||||
e.writeUInt32LE(offset, 12);
|
||||
offset += data.length;
|
||||
entries.push(e);
|
||||
}
|
||||
return Buffer.concat([header, ...entries, ...images.map((i) => i.data)]);
|
||||
}
|
||||
|
||||
const tile = mark({ rounded: true, scale: 1 });
|
||||
const bleed = mark({ rounded: false, scale: 1 });
|
||||
const maskable = mark({ rounded: false, scale: 0.72 });
|
||||
|
||||
mkdirSync(join(OUT, 'icons'), { recursive: true });
|
||||
writeFileSync(join(OUT, 'favicon.svg'), tile);
|
||||
writeFileSync(join(OUT, 'icons/icon-192.png'), await png(tile, 192));
|
||||
writeFileSync(join(OUT, 'icons/icon-512.png'), await png(tile, 512));
|
||||
writeFileSync(join(OUT, 'icons/maskable-512.png'), await png(maskable, 512));
|
||||
writeFileSync(join(OUT, 'apple-touch-icon.png'), await png(bleed, 180));
|
||||
writeFileSync(
|
||||
join(OUT, 'favicon.ico'),
|
||||
ico(await Promise.all([16, 32, 48].map(async (size) => ({ size, data: await png(tile, size) })))),
|
||||
);
|
||||
|
||||
console.log(
|
||||
'icons — wrote favicon.svg, favicon.ico, apple-touch-icon.png, icons/{icon-192,icon-512,maskable-512}.png',
|
||||
);
|
||||
@@ -0,0 +1,55 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// `pnpm icons` — run for real in a throwaway tree. The PNG bytes depend on
|
||||
// sharp's version, so they are checked by their headers; the vector mark is
|
||||
// plain text and must equal the committed public/favicon.svg, which would
|
||||
// otherwise drift from the script that claims to produce it.
|
||||
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { project, run } from './fixture';
|
||||
|
||||
/** Width and height from a PNG's IHDR chunk. */
|
||||
const pngSize = (buf: Buffer) => [buf.readUInt32BE(16), buf.readUInt32BE(20)];
|
||||
|
||||
describe('gen-icons.mjs', () => {
|
||||
it('writes every icon from the one vector mark', () => {
|
||||
const root = project({});
|
||||
const r = run('gen-icons.mjs', root);
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('icons — wrote favicon.svg');
|
||||
|
||||
const svg = readFileSync(join(root, 'public/favicon.svg'), 'utf8');
|
||||
expect(svg).toBe(readFileSync(join(process.cwd(), 'public/favicon.svg'), 'utf8'));
|
||||
|
||||
const pngs: Array<[string, number]> = [
|
||||
['icons/icon-192.png', 192],
|
||||
['icons/icon-512.png', 512],
|
||||
['icons/maskable-512.png', 512],
|
||||
['apple-touch-icon.png', 180],
|
||||
];
|
||||
for (const [file, size] of pngs) {
|
||||
const buf = readFileSync(join(root, 'public', file));
|
||||
expect(buf.subarray(1, 4).toString('latin1'), file).toBe('PNG');
|
||||
expect(pngSize(buf), file).toEqual([size, size]);
|
||||
}
|
||||
});
|
||||
|
||||
it('packs 16, 32 and 48 px PNGs into favicon.ico', () => {
|
||||
const root = project({});
|
||||
expect(run('gen-icons.mjs', root).code).toBe(0);
|
||||
|
||||
const ico = readFileSync(join(root, 'public/favicon.ico'));
|
||||
expect(ico.readUInt16LE(2)).toBe(1); // type: icon
|
||||
expect(ico.readUInt16LE(4)).toBe(3); // three images
|
||||
const entries = [0, 1, 2].map((i) => 6 + 16 * i);
|
||||
expect(entries.map((e) => ico.readUInt8(e))).toEqual([16, 32, 48]);
|
||||
// Each directory entry points at a PNG inside the file.
|
||||
for (const e of entries) {
|
||||
const offset = ico.readUInt32LE(e + 12);
|
||||
expect(ico.subarray(offset + 1, offset + 4).toString('latin1')).toBe('PNG');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,326 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// docs/12 §4 — the bots' side of the forge (D38): pull requests, issues,
|
||||
// workflow dispatches and commit statuses through Gitea's REST API.
|
||||
//
|
||||
// The `gh` CLI and peter-evans/create-pull-request went with the GitHub
|
||||
// account. The workflows that talk back to the forge (quarantine, vt-recheck,
|
||||
// link-check, ci's `record` job) call this script with the job token; it needs
|
||||
// nothing but Node's fetch.
|
||||
//
|
||||
// GITEA_API ${{ github.api_url }} https://git.poli0981.dev/api/v1
|
||||
// GITEA_REPO ${{ github.repository }} poli0981/softharbor
|
||||
// GITEA_TOKEN ${{ github.token }}
|
||||
//
|
||||
// pr <head> <title> <body-file> [labels] open, or update, the PR <head> → main
|
||||
// pr-open <head> is a PR from <head> open? (open=true|false)
|
||||
// dispatch <ref> <workflow.yml>... run those workflows on <ref>
|
||||
// status <sha> <context> <result> [url] record a job's result as a commit status
|
||||
// quarantine-issues <slug>... one tracking issue per newly quarantined slug
|
||||
// vt-issues <review.json> one tracking issue per entry with detections
|
||||
// link-rot <exit-code> <report> <run-url> refresh, open or close the link-check issue
|
||||
//
|
||||
// Two Gitea facts shape it (runbook §6): an event the job token causes starts
|
||||
// no workflow — so a bot PR gets its checks from `dispatch` — and a dispatched
|
||||
// run writes no commit status — so ci.yml records its own (`status`), under the
|
||||
// names branch protection matches.
|
||||
|
||||
import { appendFileSync, readFileSync } from 'node:fs';
|
||||
|
||||
const BASE = 'main';
|
||||
const PAGE = 50; // Gitea's default MAX_RESPONSE_ITEMS
|
||||
const SLUG = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
||||
export const LINK_ROT_TITLE = 'link-check: broken official links';
|
||||
|
||||
/** A Gitea API caller for one repository: `call(method, path, body?)` → parsed JSON. */
|
||||
export function client({ api, repo, token }) {
|
||||
return async function call(method, path, body) {
|
||||
const res = await fetch(`${api}/repos/${repo}${path}`, {
|
||||
method,
|
||||
headers: {
|
||||
authorization: `token ${token}`,
|
||||
accept: 'application/json',
|
||||
...(body === undefined ? {} : { 'content-type': 'application/json' }),
|
||||
},
|
||||
body: body === undefined ? undefined : JSON.stringify(body),
|
||||
});
|
||||
const text = await res.text();
|
||||
if (!res.ok) throw new Error(`${method} ${path} → ${res.status} ${text.slice(0, 300)}`);
|
||||
return text ? JSON.parse(text) : null;
|
||||
};
|
||||
}
|
||||
|
||||
/** Every row of a paged list endpoint. */
|
||||
async function all(call, path) {
|
||||
const rows = [];
|
||||
for (let page = 1; ; page++) {
|
||||
const sep = path.includes('?') ? '&' : '?';
|
||||
const batch = await call('GET', `${path}${sep}limit=${PAGE}&page=${page}`);
|
||||
rows.push(...batch);
|
||||
if (batch.length < PAGE) return rows;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Label names → ids. Gitea attaches labels by id, and its API creates none:
|
||||
* a missing label is left off with a notice instead of failing the bot.
|
||||
*/
|
||||
async function labelIds(call, names, log) {
|
||||
if (names.length === 0) return [];
|
||||
const byName = new Map((await all(call, '/labels')).map((l) => [l.name, l.id]));
|
||||
const ids = [];
|
||||
for (const name of names) {
|
||||
if (byName.has(name)) ids.push(byName.get(name));
|
||||
else log(`::notice::label "${name}" does not exist on this repository — left off`);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
export async function findPull(call, head) {
|
||||
const pulls = await all(call, '/pulls?state=open');
|
||||
return pulls.find((p) => p.head?.ref === head && p.base?.ref === BASE) ?? null;
|
||||
}
|
||||
|
||||
export async function openPull(call, { head, title, body, labels = [], log = console.log }) {
|
||||
const existing = await findPull(call, head);
|
||||
if (existing) {
|
||||
await call('PATCH', `/pulls/${existing.number}`, { title, body });
|
||||
log(`Updated pull request #${existing.number}`);
|
||||
return { number: existing.number, operation: 'updated' };
|
||||
}
|
||||
const pull = await call('POST', '/pulls', {
|
||||
base: BASE,
|
||||
head,
|
||||
title,
|
||||
body,
|
||||
labels: await labelIds(call, labels, log),
|
||||
});
|
||||
log(`Opened pull request #${pull.number}`);
|
||||
return { number: pull.number, operation: 'created' };
|
||||
}
|
||||
|
||||
async function findIssue(call, title) {
|
||||
const issues = await all(call, '/issues?state=open&type=issues');
|
||||
return issues.find((i) => i.title === title) ?? null;
|
||||
}
|
||||
|
||||
/** Opens an issue unless one with the same title is already open. */
|
||||
export async function openIssue(call, { title, body, labels = [], log = console.log }) {
|
||||
const existing = await findIssue(call, title);
|
||||
if (existing) {
|
||||
log(`${title} is already tracked in #${existing.number}`);
|
||||
return null;
|
||||
}
|
||||
const issue = await call('POST', '/issues', {
|
||||
title,
|
||||
body,
|
||||
labels: await labelIds(call, labels, log),
|
||||
});
|
||||
log(`Opened #${issue.number}: ${title}`);
|
||||
return issue.number;
|
||||
}
|
||||
|
||||
export async function dispatch(call, ref, workflows, log = console.log) {
|
||||
for (const file of workflows) {
|
||||
await call('POST', `/actions/workflows/${encodeURIComponent(file)}/dispatches`, { ref });
|
||||
log(`Dispatched ${file} on ${ref}`);
|
||||
}
|
||||
}
|
||||
|
||||
/** A `needs.<job>.result` as a commit status. Cancelled and skipped jobs record nothing. */
|
||||
export async function recordStatus(call, { sha, context, result, url, log = console.log }) {
|
||||
if (result !== 'success' && result !== 'failure') {
|
||||
log(`${context}: ${result || 'no result'} — nothing to record`);
|
||||
return false;
|
||||
}
|
||||
await call('POST', `/statuses/${sha}`, {
|
||||
state: result,
|
||||
context,
|
||||
description:
|
||||
result === 'success'
|
||||
? 'passed in this dispatched run'
|
||||
: 'failed in this dispatched run — see the run',
|
||||
...(url ? { target_url: url } : {}),
|
||||
});
|
||||
log(`${context}: recorded ${result} on ${sha}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
export function quarantineBody(slug) {
|
||||
return `\`${slug}\` was flagged and moved to \`data/quarantine/\`.
|
||||
|
||||
Record here before closing:
|
||||
- [ ] Reason it was flagged
|
||||
- [ ] Evidence link (VirusTotal / vendor advisory)
|
||||
- [ ] Date checked
|
||||
- [ ] Whether users were plausibly exposed (docs/13 §7)
|
||||
|
||||
Restoring is a reviewed PR: status back to \`clean\`/\`unverified\`,
|
||||
a fresh \`checkedAt\`, and the file moved back (docs/03 §5).
|
||||
`;
|
||||
}
|
||||
|
||||
export function vtBody({ slug, evidence, malicious, suspicious, was, status }) {
|
||||
return `VirusTotal re-scanned \`${slug}\`'s download page: **${malicious} malicious, ${suspicious} suspicious** — [the scan](${evidence}).
|
||||
|
||||
Status in the re-check PR: \`${was}\` → \`${status}\`. Nothing was flagged or removed (docs/09 §6).
|
||||
|
||||
Decide and record here:
|
||||
- [ ] Look at which engines said what, and whether the vendor or a second scan agrees
|
||||
- [ ] False positive → set \`status\` back to \`clean\` in a PR and note why here
|
||||
- [ ] Confirmed → \`status: "flagged"\` + \`pnpm quarantine\` in one PR (docs/03 §5)
|
||||
- [ ] Whether users were plausibly exposed (docs/13 §7)
|
||||
`;
|
||||
}
|
||||
|
||||
/** Slugs come from our own scripts; anything else must not reach an issue title. */
|
||||
function validSlugs(slugs, log) {
|
||||
return slugs.filter((slug) => {
|
||||
if (SLUG.test(slug)) return true;
|
||||
log(`::warning::skipping unexpected slug '${slug}'`);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
export async function quarantineIssues(call, slugs, log = console.log) {
|
||||
for (const slug of validSlugs(slugs, log)) {
|
||||
await openIssue(call, {
|
||||
title: `[quarantine] ${slug}`,
|
||||
body: quarantineBody(slug),
|
||||
labels: ['security', 'quarantine'],
|
||||
log,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export async function vtIssues(call, rows, log = console.log) {
|
||||
const bySlug = new Map(rows.map((r) => [r.slug, r]));
|
||||
for (const slug of validSlugs([...bySlug.keys()], log)) {
|
||||
await openIssue(call, {
|
||||
title: `[vt] ${slug}`,
|
||||
body: vtBody(bySlug.get(slug)),
|
||||
labels: ['security'],
|
||||
log,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ONE tracking issue for the weekly link sweep: refreshed in place while the
|
||||
* sweep fails, closed the first week it comes back clean (docs/12 §5).
|
||||
*/
|
||||
export async function linkRot(call, { failing, report, runUrl, log = console.log }) {
|
||||
const existing = await findIssue(call, LINK_ROT_TITLE);
|
||||
if (failing && existing) {
|
||||
await call('PATCH', `/issues/${existing.number}`, { body: report });
|
||||
await call('POST', `/issues/${existing.number}/comments`, {
|
||||
body: `Still failing in ${runUrl} — the report above was refreshed.`,
|
||||
});
|
||||
log(`Refreshed #${existing.number}`);
|
||||
return 'refreshed';
|
||||
}
|
||||
if (failing) {
|
||||
await openIssue(call, { title: LINK_ROT_TITLE, body: report, labels: ['link-rot'], log });
|
||||
return 'opened';
|
||||
}
|
||||
if (existing) {
|
||||
await call('POST', `/issues/${existing.number}/comments`, {
|
||||
body: `Every official link resolved in ${runUrl}. Closing; the next failure opens a fresh report.`,
|
||||
});
|
||||
await call('PATCH', `/issues/${existing.number}`, { state: 'closed' });
|
||||
log(`Closed #${existing.number}`);
|
||||
return 'closed';
|
||||
}
|
||||
log('All links healthy; nothing to report.');
|
||||
return 'healthy';
|
||||
}
|
||||
|
||||
const USAGE =
|
||||
'usage: gitea.mjs <pr|pr-open|dispatch|status|quarantine-issues|vt-issues|link-rot> …';
|
||||
|
||||
/** How many arguments each command needs at least. */
|
||||
const ARITY = {
|
||||
pr: 3,
|
||||
'pr-open': 1,
|
||||
dispatch: 2,
|
||||
status: 3,
|
||||
'quarantine-issues': 0,
|
||||
'vt-issues': 1,
|
||||
'link-rot': 3,
|
||||
};
|
||||
|
||||
function fail(message) {
|
||||
console.error(`::error::gitea.mjs: ${message}`);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Runs one command; its input is already checked. */
|
||||
async function run(call, command, args, out) {
|
||||
switch (command) {
|
||||
case 'pr': {
|
||||
const [head, title, bodyFile, labels = ''] = args;
|
||||
const r = await openPull(call, {
|
||||
head,
|
||||
title,
|
||||
body: readFileSync(bodyFile, 'utf8'),
|
||||
labels: labels
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean),
|
||||
});
|
||||
out('number', r.number);
|
||||
out('operation', r.operation);
|
||||
return;
|
||||
}
|
||||
case 'pr-open': {
|
||||
const pull = await findPull(call, args[0]);
|
||||
console.log(pull ? `#${pull.number} is open` : `No open pull request from ${args[0]}`);
|
||||
out('open', pull ? 'true' : 'false');
|
||||
return;
|
||||
}
|
||||
case 'dispatch':
|
||||
await dispatch(call, args[0], args.slice(1));
|
||||
return;
|
||||
case 'status': {
|
||||
const [sha, context, result, url] = args;
|
||||
await recordStatus(call, { sha, context, result, url });
|
||||
return;
|
||||
}
|
||||
case 'quarantine-issues':
|
||||
await quarantineIssues(call, args);
|
||||
return;
|
||||
case 'vt-issues':
|
||||
await vtIssues(call, JSON.parse(readFileSync(args[0], 'utf8')));
|
||||
return;
|
||||
default: {
|
||||
// 'link-rot' — the last command ARITY knows.
|
||||
const [exitCode, reportFile, runUrl] = args;
|
||||
await linkRot(call, {
|
||||
failing: exitCode !== '0',
|
||||
report: readFileSync(reportFile, 'utf8'),
|
||||
runUrl,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function main(argv = process.argv.slice(2), env = process.env) {
|
||||
const out = (key, value) => {
|
||||
if (env['GITHUB_OUTPUT']) appendFileSync(env['GITHUB_OUTPUT'], `${key}=${value}\n`);
|
||||
};
|
||||
const [command = '', ...args] = argv;
|
||||
const { GITEA_API: api, GITEA_REPO: repo, GITEA_TOKEN: token } = env;
|
||||
if (!api || !repo || !token) return fail('GITEA_API, GITEA_REPO and GITEA_TOKEN are required');
|
||||
if (!Object.hasOwn(ARITY, command)) return fail(USAGE);
|
||||
if (args.length < ARITY[command])
|
||||
return fail(`${command} needs ${ARITY[command]} argument(s) — ${USAGE}`);
|
||||
try {
|
||||
await run(client({ api, repo, token }), command, args, out);
|
||||
return 0;
|
||||
} catch (e) {
|
||||
return fail(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.main) process.exitCode = await main();
|
||||
@@ -0,0 +1,383 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// gitea.mjs — the bots' pull requests, issues, dispatches and commit statuses
|
||||
// (D38). The script runs for real, as the workflows run it, against a small
|
||||
// in-process stand-in for Gitea's REST API that records every request.
|
||||
|
||||
import { createServer, type IncomingMessage, type Server } from 'node:http';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import { project, runAsync } from './fixture';
|
||||
|
||||
interface Row {
|
||||
number: number;
|
||||
title: string;
|
||||
body: string;
|
||||
state: string;
|
||||
labels: number[];
|
||||
head?: { ref: string };
|
||||
base?: { ref: string };
|
||||
}
|
||||
|
||||
interface Fake {
|
||||
labels: { id: number; name: string }[];
|
||||
pulls: Row[];
|
||||
issues: Row[];
|
||||
comments: { issue: number; body: string }[];
|
||||
dispatches: { file: string; ref: string }[];
|
||||
statuses: { sha: string; state: string; context: string; target_url?: string }[];
|
||||
requests: string[];
|
||||
failOn?: string;
|
||||
}
|
||||
|
||||
let fake: Fake;
|
||||
let server: Server;
|
||||
let api = '';
|
||||
|
||||
const PREFIX = '/api/v1/repos/poli0981/softharbor';
|
||||
|
||||
async function bodyOf(req: IncomingMessage): Promise<Record<string, unknown>> {
|
||||
let text = '';
|
||||
for await (const chunk of req) text += chunk;
|
||||
return text ? (JSON.parse(text) as Record<string, unknown>) : {};
|
||||
}
|
||||
|
||||
function page<T>(rows: T[], url: URL): T[] {
|
||||
const limit = Number(url.searchParams.get('limit'));
|
||||
const n = Number(url.searchParams.get('page'));
|
||||
return rows.slice((n - 1) * limit, n * limit);
|
||||
}
|
||||
|
||||
beforeEach(async () => {
|
||||
fake = {
|
||||
labels: [
|
||||
{ id: 39, name: 'dependencies' },
|
||||
{ id: 40, name: 'security' },
|
||||
],
|
||||
pulls: [],
|
||||
issues: [],
|
||||
comments: [],
|
||||
dispatches: [],
|
||||
statuses: [],
|
||||
requests: [],
|
||||
};
|
||||
server = createServer((req, res) => {
|
||||
void (async () => {
|
||||
const url = new URL(req.url ?? '/', 'http://x');
|
||||
const path = url.pathname.slice(PREFIX.length);
|
||||
const body = await bodyOf(req);
|
||||
fake.requests.push(`${req.method} ${path}`);
|
||||
const send = (status: number, data?: unknown) => {
|
||||
res.writeHead(status, { 'content-type': 'application/json' });
|
||||
res.end(data === undefined ? '' : JSON.stringify(data));
|
||||
};
|
||||
if (req.headers.authorization !== 'token job-token') return send(401, { message: 'no' });
|
||||
if (!url.pathname.startsWith(PREFIX)) return send(404, { message: 'repo' });
|
||||
if (fake.failOn && path.startsWith(fake.failOn)) return send(500, { message: 'boom' });
|
||||
|
||||
let m: RegExpMatchArray | null;
|
||||
if (req.method === 'GET' && path === '/labels') return send(200, page(fake.labels, url));
|
||||
if (req.method === 'GET' && path === '/pulls')
|
||||
return send(
|
||||
200,
|
||||
page(
|
||||
fake.pulls.filter((p) => p.state === 'open'),
|
||||
url,
|
||||
),
|
||||
);
|
||||
if (req.method === 'GET' && path === '/issues')
|
||||
return send(
|
||||
200,
|
||||
page(
|
||||
fake.issues.filter((i) => i.state === 'open'),
|
||||
url,
|
||||
),
|
||||
);
|
||||
if (req.method === 'POST' && path === '/pulls') {
|
||||
const pull: Row = {
|
||||
number: 100 + fake.pulls.length,
|
||||
title: String(body['title']),
|
||||
body: String(body['body']),
|
||||
state: 'open',
|
||||
labels: body['labels'] as number[],
|
||||
head: { ref: String(body['head']) },
|
||||
base: { ref: String(body['base']) },
|
||||
};
|
||||
fake.pulls.push(pull);
|
||||
return send(201, pull);
|
||||
}
|
||||
if (req.method === 'POST' && path === '/issues') {
|
||||
const issue: Row = {
|
||||
number: 200 + fake.issues.length,
|
||||
title: String(body['title']),
|
||||
body: String(body['body']),
|
||||
state: 'open',
|
||||
labels: body['labels'] as number[],
|
||||
};
|
||||
fake.issues.push(issue);
|
||||
return send(201, issue);
|
||||
}
|
||||
if ((m = /^\/(pulls|issues)\/(\d+)$/.exec(path)) && req.method === 'PATCH') {
|
||||
const rows = m[1] === 'pulls' ? fake.pulls : fake.issues;
|
||||
const row = rows.find((r) => r.number === Number(m?.[2]));
|
||||
if (!row) return send(404, { message: 'no such row' });
|
||||
Object.assign(row, body);
|
||||
return send(200, row);
|
||||
}
|
||||
if ((m = /^\/issues\/(\d+)\/comments$/.exec(path)) && req.method === 'POST') {
|
||||
fake.comments.push({ issue: Number(m[1]), body: String(body['body']) });
|
||||
return send(201, { id: 1 });
|
||||
}
|
||||
if ((m = /^\/actions\/workflows\/([^/]+)\/dispatches$/.exec(path)) && req.method === 'POST') {
|
||||
fake.dispatches.push({ file: decodeURIComponent(m[1] ?? ''), ref: String(body['ref']) });
|
||||
return send(204);
|
||||
}
|
||||
if ((m = /^\/statuses\/([0-9a-f]+)$/.exec(path)) && req.method === 'POST') {
|
||||
fake.statuses.push({ sha: m[1] ?? '', ...(body as Omit<Fake['statuses'][0], 'sha'>) });
|
||||
return send(201, { id: 1 });
|
||||
}
|
||||
return send(404, { message: `unrouted ${req.method} ${path}` });
|
||||
})();
|
||||
});
|
||||
await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve));
|
||||
api = `http://127.0.0.1:${(server.address() as AddressInfo).port}/api/v1`;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await new Promise((resolve) => server.close(resolve));
|
||||
});
|
||||
|
||||
function gitea(
|
||||
args: string[],
|
||||
files: Record<string, string> = {},
|
||||
env: Record<string, string> = {},
|
||||
) {
|
||||
const root = project({ 'keep.txt': '', ...files });
|
||||
const output = join(root, 'out.txt');
|
||||
const done = runAsync('gitea.mjs', root, {
|
||||
args,
|
||||
env: {
|
||||
GITEA_API: api,
|
||||
GITEA_REPO: 'poli0981/softharbor',
|
||||
GITEA_TOKEN: 'job-token',
|
||||
GITHUB_OUTPUT: output,
|
||||
...env,
|
||||
},
|
||||
});
|
||||
return done.then((r) => ({ ...r, output: () => readFileSync(output, 'utf8'), root }));
|
||||
}
|
||||
|
||||
const issue = (number: number, title: string): Row => ({
|
||||
number,
|
||||
title,
|
||||
body: '',
|
||||
state: 'open',
|
||||
labels: [],
|
||||
});
|
||||
|
||||
describe('pr', () => {
|
||||
it('opens the pull request with the labels that exist, and says which one is missing', async () => {
|
||||
const r = await gitea(
|
||||
['pr', 'vt/recheck', 'data: VirusTotal re-check', 'body.md', 'security, quarantine'],
|
||||
{
|
||||
'body.md': 'the summary',
|
||||
},
|
||||
);
|
||||
expect(r.code).toBe(0);
|
||||
expect(fake.pulls).toHaveLength(1);
|
||||
expect(fake.pulls[0]).toMatchObject({
|
||||
title: 'data: VirusTotal re-check',
|
||||
body: 'the summary',
|
||||
labels: [40],
|
||||
head: { ref: 'vt/recheck' },
|
||||
base: { ref: 'main' },
|
||||
});
|
||||
expect(r.out).toContain('label "quarantine" does not exist');
|
||||
expect(r.output()).toBe('number=100\noperation=created\n');
|
||||
});
|
||||
|
||||
it('updates the open pull request from the same branch instead of opening another', async () => {
|
||||
fake.pulls.push({ ...issue(7, 'old'), head: { ref: 'vt/recheck' }, base: { ref: 'main' } });
|
||||
fake.pulls.push({
|
||||
...issue(8, 'other'),
|
||||
head: { ref: 'quarantine/auto' },
|
||||
base: { ref: 'main' },
|
||||
});
|
||||
const r = await gitea(['pr', 'vt/recheck', 'new title', 'body.md'], { 'body.md': 'new body' });
|
||||
expect(r.code).toBe(0);
|
||||
expect(fake.pulls).toHaveLength(2);
|
||||
expect(fake.pulls[0]).toMatchObject({ title: 'new title', body: 'new body' });
|
||||
expect(fake.requests).not.toContain('POST /pulls');
|
||||
expect(fake.requests).not.toContain('GET /labels');
|
||||
expect(r.output()).toBe('number=7\noperation=updated\n');
|
||||
});
|
||||
|
||||
it('tells the workflow whether a pull request from a branch is open', async () => {
|
||||
fake.pulls.push({ ...issue(9, 'x'), head: { ref: 'vt/recheck' }, base: { ref: 'main' } });
|
||||
const open = await gitea(['pr-open', 'vt/recheck']);
|
||||
expect(open.output()).toBe('open=true\n');
|
||||
expect(open.out).toContain('#9 is open');
|
||||
const none = await gitea(['pr-open', 'quarantine/auto']);
|
||||
expect(none.output()).toBe('open=false\n');
|
||||
});
|
||||
});
|
||||
|
||||
describe('dispatch and status', () => {
|
||||
it('dispatches each workflow on the ref', async () => {
|
||||
const r = await gitea(['dispatch', 'vt/recheck', 'ci.yml', 'security.yml']);
|
||||
expect(r.code).toBe(0);
|
||||
expect(fake.dispatches).toEqual([
|
||||
{ file: 'ci.yml', ref: 'vt/recheck' },
|
||||
{ file: 'security.yml', ref: 'vt/recheck' },
|
||||
]);
|
||||
});
|
||||
|
||||
it('records a passed or failed job under the check name protection matches', async () => {
|
||||
await gitea(['status', 'abc123', 'CI / build (workflow_dispatch)', 'success', 'https://run/1']);
|
||||
await gitea(['status', 'abc123', 'CI / gates (workflow_dispatch)', 'failure']);
|
||||
expect(fake.statuses).toEqual([
|
||||
expect.objectContaining({
|
||||
sha: 'abc123',
|
||||
state: 'success',
|
||||
context: 'CI / build (workflow_dispatch)',
|
||||
target_url: 'https://run/1',
|
||||
}),
|
||||
expect.objectContaining({ state: 'failure', context: 'CI / gates (workflow_dispatch)' }),
|
||||
]);
|
||||
expect(fake.statuses[1]).not.toHaveProperty('target_url');
|
||||
});
|
||||
|
||||
it('records nothing for a cancelled or skipped job', async () => {
|
||||
const r = await gitea(['status', 'abc123', 'CI / build (workflow_dispatch)', 'cancelled']);
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('cancelled — nothing to record');
|
||||
const empty = await gitea(['status', 'abc123', 'CI / build (workflow_dispatch)', '']);
|
||||
expect(empty.out).toContain('no result — nothing to record');
|
||||
expect(fake.statuses).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('tracking issues', () => {
|
||||
it('opens one quarantine issue per new slug, never a second, never for a malformed one', async () => {
|
||||
fake.labels.push({ id: 41, name: 'quarantine' });
|
||||
fake.issues.push(issue(5, '[quarantine] old-app'));
|
||||
const r = await gitea(['quarantine-issues', 'bad-app', 'old-app', 'Not;a slug']);
|
||||
expect(r.code).toBe(0);
|
||||
expect(fake.issues.map((i) => i.title)).toEqual([
|
||||
'[quarantine] old-app',
|
||||
'[quarantine] bad-app',
|
||||
]);
|
||||
expect(fake.issues[1]?.labels).toEqual([40, 41]);
|
||||
expect(fake.issues[1]?.body).toContain('`bad-app` was flagged and moved to `data/quarantine/`');
|
||||
expect(r.out).toContain('[quarantine] old-app is already tracked in #5');
|
||||
expect(r.out).toContain("skipping unexpected slug 'Not;a slug'");
|
||||
});
|
||||
|
||||
it('opens one issue per VirusTotal detection from the review file', async () => {
|
||||
fake.issues.push(issue(6, '[vt] tracked'));
|
||||
const review = [
|
||||
{
|
||||
slug: 'some-app',
|
||||
evidence: 'https://www.virustotal.com/gui/url/x',
|
||||
malicious: 1,
|
||||
suspicious: 0,
|
||||
was: 'clean',
|
||||
status: 'unverified',
|
||||
},
|
||||
{
|
||||
slug: 'tracked',
|
||||
evidence: 'e',
|
||||
malicious: 2,
|
||||
suspicious: 1,
|
||||
was: 'clean',
|
||||
status: 'unverified',
|
||||
},
|
||||
];
|
||||
const r = await gitea(['vt-issues', 'review.json'], { 'review.json': JSON.stringify(review) });
|
||||
expect(r.code).toBe(0);
|
||||
expect(fake.issues).toHaveLength(2);
|
||||
expect(fake.issues[1]).toMatchObject({ title: '[vt] some-app', labels: [40] });
|
||||
expect(fake.issues[1]?.body).toContain('**1 malicious, 0 suspicious**');
|
||||
expect(fake.issues[1]?.body).toContain('`clean` → `unverified`');
|
||||
});
|
||||
|
||||
it('finds an open issue past the first page', async () => {
|
||||
for (let n = 1; n <= 55; n++) fake.issues.push(issue(n, `filler ${n}`));
|
||||
fake.issues.push(issue(56, '[quarantine] deep'));
|
||||
const r = await gitea(['quarantine-issues', 'deep']);
|
||||
expect(r.out).toContain('already tracked in #56');
|
||||
expect(fake.requests.filter((q) => q === 'GET /issues')).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('link-rot', () => {
|
||||
const linkRot = (code: string) =>
|
||||
gitea(['link-rot', code, 'out.md', 'https://run/9'], { 'out.md': '# report' });
|
||||
|
||||
it('opens the tracking issue on the first failure', async () => {
|
||||
fake.labels.push({ id: 42, name: 'link-rot' });
|
||||
await linkRot('2');
|
||||
expect(fake.issues).toEqual([
|
||||
expect.objectContaining({
|
||||
title: 'link-check: broken official links',
|
||||
body: '# report',
|
||||
labels: [42],
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it('refreshes the open issue while the sweep keeps failing', async () => {
|
||||
fake.issues.push(issue(12, 'link-check: broken official links'));
|
||||
const r = await linkRot('2');
|
||||
expect(fake.issues[0]?.body).toBe('# report');
|
||||
expect(fake.comments).toEqual([
|
||||
{ issue: 12, body: 'Still failing in https://run/9 — the report above was refreshed.' },
|
||||
]);
|
||||
expect(r.out).toContain('Refreshed #12');
|
||||
});
|
||||
|
||||
it('closes it the first week every link resolves', async () => {
|
||||
fake.issues.push(issue(12, 'link-check: broken official links'));
|
||||
await linkRot('0');
|
||||
expect(fake.issues[0]?.state).toBe('closed');
|
||||
expect(fake.comments[0]?.body).toContain('Every official link resolved in https://run/9');
|
||||
});
|
||||
|
||||
it('does nothing when the sweep is clean and nothing is open', async () => {
|
||||
const r = await linkRot('0');
|
||||
expect(r.out).toContain('All links healthy');
|
||||
expect(fake.requests).toEqual(['GET /issues']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('failures', () => {
|
||||
it('fails loudly on an API error', async () => {
|
||||
fake.failOn = '/actions';
|
||||
const r = await gitea(['dispatch', 'main', 'ci.yml']);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('::error::gitea.mjs: POST /actions/workflows/ci.yml/dispatches → 500');
|
||||
});
|
||||
|
||||
it('refuses to run without the API, the repository and the token', async () => {
|
||||
const r = await gitea(['pr-open', 'x'], {}, { GITEA_TOKEN: '' });
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('GITEA_API, GITEA_REPO and GITEA_TOKEN are required');
|
||||
});
|
||||
|
||||
it('rejects an unknown command and a missing argument', async () => {
|
||||
const unknown = await gitea(['merge']);
|
||||
expect(unknown.code).toBe(1);
|
||||
expect(unknown.out).toContain('usage: gitea.mjs');
|
||||
const short = await gitea(['status', 'abc123']);
|
||||
expect(short.code).toBe(1);
|
||||
expect(short.out).toContain('status needs 3 argument(s)');
|
||||
});
|
||||
|
||||
it('writes no output file when the workflow gives none', async () => {
|
||||
const r = await gitea(['pr-open', 'x'], {}, { GITHUB_OUTPUT: '' });
|
||||
expect(r.code).toBe(0);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
/**
|
||||
* Post-build HTML fix-ups. Runs between `astro build` and the dist/ checks.
|
||||
*
|
||||
* 1. Move the CSP <meta> to the top of <head>.
|
||||
*
|
||||
* A meta-tag CSP only governs what the parser meets AFTER it. Astro appends
|
||||
* its generated tag at the END of <head>, behind every blocking and
|
||||
* deferred script there (errors.js, theme.js, registerSW.js) — so those
|
||||
* loaded under no policy at all. They are our own same-origin files and
|
||||
* would pass `script-src 'self'` anyway; the point is that NOTHING in the
|
||||
* document should precede the policy that is supposed to cover it. Placing
|
||||
* the tag right after `<meta charset>` (which must stay first, within the
|
||||
* first 1024 bytes) makes the whole head subject to it. check-csp.mjs
|
||||
* asserts the result on every page.
|
||||
*
|
||||
* Idempotent: a page whose meta already follows the charset is left alone.
|
||||
*/
|
||||
import { readFileSync, readdirSync, statSync, writeFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const DIST = join(process.cwd(), 'dist');
|
||||
const CHARSET = '<meta charset="utf-8">';
|
||||
const CSP_META = /<meta http-equiv="content-security-policy" content="[^"]*">/i;
|
||||
|
||||
function walk(dir) {
|
||||
const out = [];
|
||||
for (const entry of readdirSync(dir)) {
|
||||
const p = join(dir, entry);
|
||||
if (statSync(p).isDirectory()) out.push(...walk(p));
|
||||
else if (p.endsWith('.html')) out.push(p);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
let moved = 0;
|
||||
let pages = 0;
|
||||
for (const file of walk(DIST)) {
|
||||
pages++;
|
||||
const html = readFileSync(file, 'utf8');
|
||||
const meta = CSP_META.exec(html)?.[0];
|
||||
const at = html.indexOf(CHARSET);
|
||||
if (!meta || at === -1) continue; // check-csp.mjs reports both cases
|
||||
if (html.indexOf(meta) === at + CHARSET.length) continue;
|
||||
const without = html.replace(meta, '');
|
||||
const insertAt = without.indexOf(CHARSET) + CHARSET.length;
|
||||
writeFileSync(file, without.slice(0, insertAt) + meta + without.slice(insertAt));
|
||||
moved++;
|
||||
}
|
||||
|
||||
console.log(`postbuild — CSP meta moved to the top of <head> on ${moved} of ${pages} pages`);
|
||||
@@ -9,11 +9,18 @@
|
||||
* rendering on the next build.
|
||||
*
|
||||
* MOVE, never delete: the file keeps its schema so restoring is a plain
|
||||
* `git mv` plus a status edit, and the reason lives in the tracking issue and
|
||||
* the commit message. History is the audit trail.
|
||||
* move back plus a status edit, and the reason lives in the tracking issue and
|
||||
* the commit message. History is the audit trail. (A plain filesystem rename;
|
||||
* git records it as a rename when the move is committed.)
|
||||
*
|
||||
* Idempotent; exits 0 when there is nothing to do. Writes the moved slugs to
|
||||
* the `moved` GitHub output so the workflow can open a PR and one issue each.
|
||||
* Two callers:
|
||||
* - a maintainer, locally: set `security.status` to "flagged", run
|
||||
* `pnpm quarantine`, commit both the flag and the move in one PR — the
|
||||
* `gates` check (validate:data) rejects a flagged entry left in place;
|
||||
* - .gitea/workflows/quarantine.yml, daily and on data pushes, as the
|
||||
* safety net. It reads the moved slugs from the `moved` step output.
|
||||
*
|
||||
* Idempotent; exits 0 when there is nothing to do.
|
||||
*/
|
||||
import {
|
||||
appendFileSync,
|
||||
@@ -28,6 +35,7 @@ import { join } from 'node:path';
|
||||
const APPS_DIR = join(process.cwd(), 'src/data/apps');
|
||||
const QUARANTINE_DIR = join(process.cwd(), 'data/quarantine');
|
||||
|
||||
const SLUG_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
||||
const moved = [];
|
||||
|
||||
if (existsSync(APPS_DIR)) {
|
||||
@@ -49,15 +57,23 @@ if (existsSync(APPS_DIR)) {
|
||||
console.error(`quarantine: ${file} already in quarantine — leaving both for review`);
|
||||
continue;
|
||||
}
|
||||
const slug = file.replace(/\.json$/, '');
|
||||
// The slug reaches a workflow output, a commit message and an issue title;
|
||||
// anything that is not a plain kebab-case slug is left for a human.
|
||||
if (!SLUG_RE.test(slug)) {
|
||||
console.error(`quarantine: refusing to move ${file} — not a valid slug`);
|
||||
process.exitCode = 1;
|
||||
continue;
|
||||
}
|
||||
renameSync(path, dest);
|
||||
moved.push(file.replace(/\.json$/, ''));
|
||||
moved.push(slug);
|
||||
console.log(`quarantine: moved ${file} → data/quarantine/`);
|
||||
}
|
||||
}
|
||||
|
||||
if (moved.length === 0) console.log('quarantine: nothing flagged');
|
||||
|
||||
// Space-separated, consumed by .github/workflows/quarantine.yml.
|
||||
// Space-separated, consumed by .gitea/workflows/quarantine.yml.
|
||||
if (process.env['GITHUB_OUTPUT']) {
|
||||
appendFileSync(process.env['GITHUB_OUTPUT'], `moved=${moved.join(' ')}\n`);
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Copyright (C) 2026 poli0981 (SkullMute)
|
||||
//
|
||||
// quarantine.mjs (hard rule 5: move, never delete) and extract-urls.mjs (the
|
||||
// lychee feed) — the two scripts the scheduled workflows run.
|
||||
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { project, run } from './fixture';
|
||||
|
||||
const entry = (status: string, links: Record<string, string | null> = {}, evidence?: string) =>
|
||||
JSON.stringify({ name: 'X', links, security: { status, evidence } });
|
||||
|
||||
describe('quarantine', () => {
|
||||
it('moves flagged entries out of the content tree and reports them to the workflow', () => {
|
||||
const root = project({
|
||||
'src/data/apps/bad-app.json': entry('flagged'),
|
||||
'src/data/apps/good-app.json': entry('clean'),
|
||||
'src/data/apps/broken.json': '{ nope',
|
||||
});
|
||||
const r = run('quarantine.mjs', root, { env: { GITHUB_OUTPUT: join(root, 'out.txt') } });
|
||||
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.out).toContain('moved bad-app.json → data/quarantine/');
|
||||
expect(r.out).toContain('skipping unparseable broken.json');
|
||||
expect(existsSync(join(root, 'src/data/apps/bad-app.json'))).toBe(false);
|
||||
expect(readFileSync(join(root, 'data/quarantine/bad-app.json'), 'utf8')).toBe(entry('flagged'));
|
||||
expect(existsSync(join(root, 'src/data/apps/good-app.json'))).toBe(true);
|
||||
expect(readFileSync(join(root, 'out.txt'), 'utf8')).toBe('moved=bad-app\n');
|
||||
});
|
||||
|
||||
it('is idempotent, and reports an empty move list', () => {
|
||||
const root = project({ 'src/data/apps/good-app.json': entry('clean') });
|
||||
const r = run('quarantine.mjs', root, { env: { GITHUB_OUTPUT: join(root, 'out.txt') } });
|
||||
expect(r.out).toContain('nothing flagged');
|
||||
expect(readFileSync(join(root, 'out.txt'), 'utf8')).toBe('moved=\n');
|
||||
});
|
||||
|
||||
it('never overwrites a quarantined file, and never moves a malformed slug', () => {
|
||||
const root = project({
|
||||
'src/data/apps/twice.json': entry('flagged'),
|
||||
'data/quarantine/twice.json': entry('flagged', { homepage: 'https://old.test/' }),
|
||||
'src/data/apps/Not A Slug.json': entry('flagged'),
|
||||
});
|
||||
const r = run('quarantine.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('twice.json already in quarantine — leaving both for review');
|
||||
expect(r.out).toContain('refusing to move Not A Slug.json');
|
||||
expect(existsSync(join(root, 'src/data/apps/twice.json'))).toBe(true);
|
||||
expect(readFileSync(join(root, 'data/quarantine/twice.json'), 'utf8')).toContain('old.test');
|
||||
});
|
||||
});
|
||||
|
||||
describe('extract-urls', () => {
|
||||
const apps = {
|
||||
'src/data/apps/a.json': entry(
|
||||
'clean',
|
||||
{ homepage: 'https://b.test/', repo: null },
|
||||
'https://vt.test/a',
|
||||
),
|
||||
'src/data/apps/b.json': entry('clean', {
|
||||
homepage: 'https://a.test/',
|
||||
download: 'https://b.test/',
|
||||
}),
|
||||
};
|
||||
|
||||
it('prints every official URL once, sorted', () => {
|
||||
const r = run('extract-urls.mjs', project(apps));
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.stdout).toBe('https://a.test/\nhttps://b.test/\nhttps://vt.test/a\n');
|
||||
});
|
||||
|
||||
it('with --added, checks only the URLs on lines a diff adds', () => {
|
||||
// A re-check PR rewrites evidence; a data PR adds a whole new file.
|
||||
const diff = [
|
||||
'diff --git a/src/data/apps/a.json b/src/data/apps/a.json',
|
||||
'--- a/src/data/apps/a.json',
|
||||
'+++ b/src/data/apps/a.json',
|
||||
'@@ -19,2 +19,2 @@',
|
||||
'- "evidence": "https://vt.test/old",',
|
||||
'+ "evidence": "https://vt.test/new",',
|
||||
'- "checkedAt": "2026-07-30"',
|
||||
'+ "checkedAt": "2026-10-23"',
|
||||
'diff --git a/src/data/apps/new.json b/src/data/apps/new.json',
|
||||
'+++ b/src/data/apps/new.json',
|
||||
'+ "homepage": "https://new.test",',
|
||||
'+ "repo": null,',
|
||||
'+ "download": "https://new.test/get?os=win",',
|
||||
' unchanged "https://context.test/"',
|
||||
].join('\n');
|
||||
const r = run('extract-urls.mjs', project(apps), { args: ['--added'], input: diff });
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.stdout).toBe('https://new.test\nhttps://new.test/get?os=win\nhttps://vt.test/new\n');
|
||||
});
|
||||
|
||||
it('with --added and an empty diff, prints nothing', () => {
|
||||
const r = run('extract-urls.mjs', project(apps), { args: ['--added'], input: '' });
|
||||
expect(r.code).toBe(0);
|
||||
expect(r.stdout).toBe('');
|
||||
});
|
||||
|
||||
it('keeps going past a malformed file, but fails the run', () => {
|
||||
const root = project({ ...apps, 'src/data/apps/c.json': '{' });
|
||||
const r = run('extract-urls.mjs', root);
|
||||
expect(r.code).toBe(1);
|
||||
expect(r.out).toContain('skipping c.json');
|
||||
expect(r.stdout).toContain('https://vt.test/a');
|
||||
});
|
||||
});
|
||||