Drop narration, history and restated-code comments across the repo,
keep short ones for security boundaries, upstream quirks and ordering
constraints, and record the convention in CLAUDE.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Caddy takes nginx's place in compose: ports 80/443, the fixed address
172.28.255.251 that cloudflared pins the public names to, the network
aliases, the healthcheck and the autoheal label. nginx and certbot are
removed from compose; Caddy already holds its own certificates in
./caddy/data, obtained while it ran beside nginx. `traffic` now tails
logs/caddy/payloads.log, and the dev override switches Caddy to its dev
sites instead of putting nginx in DEV_MODE.
Docs and comments that described nginx's behaviour now describe Caddy's:
CLAUDE.md, DEPLOYMENT.md (topology, boot paths, TLS, rate limits, runbook
with a rollback, rough edges), the READMEs, .env.example and the comments
in the backend, Python service, Vue source and infra files. nginx/ and
certbot/ stay in the repo as the rollback until this has settled.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Access was admin or nothing, so letting a friend print receipts meant making
them a full admin. Users now carry a list of permissions (User.Permissions,
a JSON column), each a key from the registry in services/permissions.go;
admins pass every check. The only key so far is `receipt`.
GET /auth/validate/:permission answers like /auth/validate-admin (200/403/401,
with the same refresh-token fallback, now shared) plus 404 for an unknown key,
and reads the user row rather than the token, so a grant or revoke applies on
the next request. On 200 it returns the username in X-Auth-User.
nginx gets a permission gate beside the admin gate: a location sets
$auth_permission and auth_requests /internal/auth/validate. /receipt/ moves
onto it, forwarding X-Remote-User to the receipt server. 403 now goes to
/no-access rather than back to the login page. The variable must not be given
a server-level default: the subrequest re-runs the server rewrite phase and
would blank it.
The admin panel's Manage Users tab ticks permissions per user
(setUserPermissions, permissionTypes). The login page is no longer
admin-only in wording or destination: a non-admin lands on /account, which
lists the services they can open; /no-access is the same view with a notice.
/auth/validate-admin and every other admin-gated service are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Background panel, the Box editor and the canvas admin bar could only
take a new upload, so reusing a picture meant uploading it again or
pasting its URL. Each now has a picker (UploadPicker.vue): a grid of the
public uploads, newest first, filterable by name.
It lists through a new admin-only GET /api/uploads (Uploads.List), the
union of the Garage bucket and the disk fallback, since nginx serves
from both; a bucket that can't list falls back to the disk's files.
Admin-only because upload URLs are public but unguessable, and a public
listing would give every one away. Private files and anything off the
UploadTypes allow-list are never listed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Frontend: src/uploads.js is the one way to store or show a file
(uploadFile, ACCEPT, kindOf, isUploadUrl, tagFor, mediaSize). Chat,
the box editor, canvas drops and the background editor all use it;
views/home3/upload.js and the chat store's own axios call are gone.
Backend: POST /api/uploads (was /messages/upload) is a thin wrapper over
services.Uploads.Save, which owns validation, naming and storage. The
three per-extension maps are now one UploadTypes table, and a refused
file is an *UploadError whose message is safe to show.
nginx now fetches /uploads/ from Garage first and falls back to the
volume on a 404 or any 5xx, so the bucket is the source of truth and
deleting a file in garage-webui unpublishes it, while a Garage outage
still only affects bucket-only files.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Opt-in and built so Garage can never take the site down:
- the backend writes to the bucket only once S3_ENDPOINT is set, and
falls back to the uploads volume (with a log line) if a write fails;
- nginx serves /uploads/ from the volume first and Garage's anonymous
website endpoint second, so every existing URL keeps working and nginx
boots with no garage container;
- nothing depends_on garage and no variable is required, so a missing
secret cannot fail a deploy.
Private attachments stay on disk, since nginx cannot gate a bucket.
garage/bootstrap.sh sets up the layout, bucket, key and website access;
the runbook is "Garage" in DEPLOYMENT.md.
Also lifts the body limit on the internal auth subrequest, which 413'd
large uploads to gated locations, and reserves the garage and dozzle
page slugs.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
nginx writes one JSON line per request, body included, to
logs/nginx/payloads.log (nginx/payload_log.conf). Bodies mentioning a
password, token or secret are logged as [redacted]. A `traffic` container
tails the file so it shows up as its own stream in Dozzle, which is served
at /dozzle/ behind the admin auth_request.
Dozzle replaces the admin panel's Diagnostics tab, so that tab and the
/admin/logs endpoint behind it are removed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
.env is edited by hand again. Drops the /admin/env endpoints, EnvManager
and its registry, the host-side apply.py watcher and its install script,
the backend's env-apply bind mount, and the Environment tab.
The deploy and maintenance workflows still serialise docker compose, now
on .compose.lock in the checkout instead of env-apply/run/lock.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The job tracker has run from its own image at /jobs/ since 931b02c, so its
old copy here goes: the GraphQL schema, resolvers and models for
applications, references, sources, leads and the search profile; the
capture and email handlers and services; the Python posting reader, lead
scorer and email classifier; the Vue pages, stores and the capture-token
card on the Environment tab; and the userscript (nginx already redirects
its old URL to /jobs/).
The six old tables stay in the stp database: AutoMigrate never drops
anything, and dropping them is a manual step. The env variables stay in
the registry, where they already belong to the jobs service.
Docs (CLAUDE.md, DEPLOYMENT.md and the three READMEs) now describe the
site without the tracker, and DEPLOYMENT.md lists the jobs service and
./jobs-data.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tracker (applications, leads, email pipeline, capture userscript) now
lives in the adamf/job-tracker repo and runs here from its published image.
- docker-compose.yml: a `jobs` service with an explicit environment list
(its own database role; none of the site's other secrets), ./jobs-data
mounted at /data, and nginx waiting for it. The dev override seeds it.
- nginx: /jobs/ proxied to it with the prefix kept, and 301s from
/cv/jobs, /cv/leads and the old userscript URL.
- env_registry.json and .env.example: the email and job-lead variables now
belong to the jobs service; CLAUDE_* to python and jobs; new
POSTGRES_JOBS_* and JOBS_IMAGE_TAG. The compose environment test now
checks the jobs service's list as well as python's.
- backend: no longer starts the email and job-lead schedulers or serves
the capture and email routes, since the tracker reads the same settings
and would otherwise process everything twice. The old job code stays
until the tracker has run for a while.
- vue: the CV page's Jobs button goes to /jobs/; the old routes are gone.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tracker recorded applications but could not find jobs. A new
pipeline (services/job_leads.go, job_sources.go) polls a watch list of
sources on a timer or on request, files unseen postings as leads, marks
which pass a keyword and location pre-filter, and has Claude score those
against a single search profile through a fourth internal Python route,
/internal/jobs/score.
Sources are Greenhouse, Lever and Ashby company boards (public JSON) and
Adzuna and Reed keyword searches (API keys). The two search fetchers are
written from the providers' documentation and tested only against stubs.
Leads are their own table, not a job status, and are not soft deleted:
the (source_kind, external_id) index is the dedup, so a dismissed lead
has to remain a row. A lead reaches the tracker only by promotion, which
goes through UpsertJobApplication. That upsert moves from the capture
handler into services so promotion and the fetcher can share it; the
capture endpoint's behaviour is unchanged.
/cv/leads is the page: inbox, watch list and profile form. The timer is
off unless JOB_LEADS_ENABLED=true and never runs at start-up, so a
deploy spends no Claude calls.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Authorisation: @admin and @signedIn schema directives replace the 25
hand-copied resolver checks. A test fails if a mutation has neither and
is not on the public allow-list, so a new mutation cannot ship unguarded.
IDs: uint model IDs bind through graphql.UintID, removing the ten
int(obj.ID) resolvers.
Job status is a GraphQL enum, tied to services.statusOrder by a test.
Input is strict, so the mutations no longer coerce an unknown status to
"applied"; output is lenient so one legacy row cannot fail the list.
deleteJobApplication and deleteJobAppReference now error on a missing id
like the other deletes.
The rowing reader, the job extractor and now the email classifier reach
the Python service through one services.CallPython helper. The email
pipeline's prompt and fence stripping moved to Python, and
anthropic-sdk-go is gone from go.mod.
Fix the auth test fixture, whose 11-byte secret had been panicking the
services test package since InitAuth began requiring 32 bytes. Add a
test that keeps the python service's compose environment list in step
with the env registry.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add an Environment tab to /admin that lists every variable in .env.example
and lets keys, OAuth settings, email settings and generated secrets be
changed without SSH. Secrets are write-only; infrastructure variables are
shown read-only.
The backend never writes .env or touches Docker. It validates an edit and
queues it in env-apply/run/request.json; env-apply/apply.py, run on the host
by a systemd path unit (env-apply/install.sh), rewrites .env atomically,
keeps .env.bak, and recreates only the services that read the change.
backend/services/env_registry.json is the single list of variables, shared
by the backend and the host script; a test keeps it in step with
.env.example. It replaces the drifted checklist in handle_admin.go. The job
capture token card moves to the new tab.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The userscript's bearer token was an env var, JOB_CAPTURE_TOKEN, so rotating
it meant editing .env and redeploying. It is now minted on the admin
diagnostics panel instead, and the env var is gone.
- services.CaptureToken keeps only a SHA-256 of the token, in
backend/token/job_capture_token.json beside the OAuth tokens, so it
survives rebuilds and cannot be read back. The token is shown once.
- GET/POST/DELETE /admin/capture-token report, generate (replacing any
existing token) and revoke it, behind the cookie-authenticated admin group.
- With no token generated the capture routes still answer 503.
- Userscript bumped to 1.0.1 for the changed prompt text.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Violentmonkey userscript, served by the site and installed from /cv/jobs,
adds the posting open in the browser (LinkedIn, an ATS, any company page) to
the tracker. Claude reads the title, company and location off the page text.
- Three token-guarded REST routes under /api/jobs/capture (status, extract,
upsert). They take a bearer token, JOB_CAPTURE_TOKEN, because the auth
cookies are SameSite=Lax and never sent from another origin. An unset token
switches the routes off.
- The upsert matches on a canonical posting URL, then (company, job title),
so a capture and the email pipeline do not make two rows for one job.
- The Claude call is a new internal Python route, /internal/jobs/extract,
alongside the rowing reader; the client and fence stripping they share move
to python/app/claude.py.
- New "saved" status ranked below "applied", and a description column holding
the posting text, shown per row on the tracker.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
POST /rowing in the Go backend no longer calls the Anthropic SDK. It keeps
the admin gate, EXIF date, duplicate check, sanity bounds and insert, and
sends the image to a new internal Python route, POST /internal/rowing/read,
which makes the Claude call and returns the three numbers it read.
The route spends a paid call and has no auth of its own, so nginx 404s
/py/internal/ and the route refuses anything carrying the proxy headers
nginx adds. The python container now receives CLAUDE_API_KEY.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replaces gin's default logger with a custom formatter:
- /auth/validate-admin (nginx auth_request subrequests — the 5-seconds
flood that is not a user), /auth/refresh and /auth/check no longer log
a line at all on success; their failures are kept.
- Human latency units (15ms, not 153020ns).
- Lines for requests from outside the docker subnet carry the client IP
— the "who is using my site" line — while internal infrastructure
successes stay lean.
- 4xx lines carry " !!", 5xx " !!! SERVER ERROR", both greppable.
The admin panel's Diagnostics log pane gains a "visitors only" filter
that keeps just the IP-suffixed and error lines (on by default).
Co-Authored-By: Claude Code <[email protected]>
Two admin-only REST endpoints and a Diagnostics tab in the admin panel:
- GET /admin/config reports which known environment variables are set,
what each is for, and the value only for non-credential vars. Secrets
are never returned, only their presence.
- GET /admin/logs returns the tail of backend/logs/go.log (Gin traffic
plus application lines), bounded to 256 KiB and 500 lines so the read
is constant-size however large the file has grown.
tailLogFile is split out from the handler and tested for the line cap,
the partial-first-line rule, and the empty/missing cases.
Co-Authored-By: Claude Code <[email protected]>
Security:
- Token revocation. User gains a TokenVersion counter embedded in both
tokens as a "tv" claim; AuthenticateToken rejects a token whose version
no longer matches the row. Logout bumps it, so logging out now kills
outstanding tokens rather than only clearing cookies. Costs one
primary-key SELECT per authenticated request, which is the price of
having revocation at all.
- Spotify OAuth CSRF. The fixed SPOTIFY_AUTH_STATE constant is replaced by
a per-request one-shot nonce, verified and consumed on callback.
- Private chat attachments. Attachments on private messages are written to
/backend/uploads/private/ and served at /uploads/private/, gated by the
same nginx auth_request admin check used for /hasura/ and /notes/.
Private uploads are rejected from non-admin callers.
- The icecast admin UI (/radio/admin/) is behind the admin gate; listener
traffic is untouched.
- Store caches are mutex-guarded, so -race is clean.
Bugs:
- The email pipeline no longer drops emails permanently on transient
failure. Failures record an attempt counter and are retried up to 3
times; the fetch window rewinds to the oldest retryable email's
ReceivedAt, without which a retry could never re-fetch it.
- Rowing duplicate detection distinguishes ErrRecordNotFound from a real
DB error, so a transient failure no longer causes a duplicate insert
plus a paid Claude call.
- DeletePost propagates its delete error instead of reporting success.
- RecentlyPlayed populates the cache it reads.
- main.go exits non-zero if r.Run fails, so a port conflict is visible.
- Python: the scan truncation flag is set on every deadline path;
timed_out is reported by the worker rather than inferred from the clock;
date validation uses Europe/London rather than server-local time.
- Vue: Time.vue and Radio.vue intervals are cleared on unmount; Feed.vue
guards a missing author; Timer.vue gets an explicit state machine and
compares total elapsed seconds; Elle.vue's comma-operator call and
per-frame console.log are fixed.
Simplification:
- One TTLCache replaces three near-identical cache implementations, with
the differing eviction rules as explicit parameters.
- run_scan's transport index no longer uses one object as both ordering
record and live output; its three phases are separate functions.
- _price_hotels submits all work to a single pool, so the nested-executor
deadlock hazard is gone by construction.
- The NDJSON event generators share one implementation.
- IMAP FETCH responses pair each line with its literal in the type, so
callers no longer hand-skip alternate entries.
- Shared helpers for slice-of-pointers, markdown fences and auth cookies.
- Vue: useHotelSearch, createMirrorStore, useRotation, useCreateForm,
useLinkAttrs, ListWidget and LinkTableItems replace duplicated blocks.
- nginx dev config's duplicated :80/:443 bodies share one partial.
Infra: certbot passes --deploy-hook touching a sentinel that nginx's
watcher reloads on, so renewed certs are served without a restart, and the
watcher also removes the manual restart after first issuance. db is gated
on service_healthy, autoheal is pinned, and the unused envsubst entries
are dropped.
Verified: go build/vet, npx vite build, py_compile, docker compose config
for both overlays, bash -n on all scripts, and an envsubst render of every
nginx template (no leftover placeholders, runtime vars preserved, braces
balanced).
Co-Authored-By: Claude Opus 5 <[email protected]>
Readability pass across all four areas of the stack. Comments explain why
rather than what, concentrated at the points where behaviour is non-obvious:
concurrency, caching, auth, scraping and nginx templating.
Backend: doc comments on every exported declaration across handlers,
services, models and resolvers. Resolver commentary lives inside function
bodies so gqlgen does not strip it on regeneration; schema files use #
comments rather than description blocks so introspection output is
unchanged. Extracted the duplicated auth-cookie blocks into helpers.
Frontend: header comments on every component, store and view, including
STATUS: notes marking which of the parallel/legacy views are still live.
Documented the non-reactive animation-state pattern, the homeData hub and
the WebSocket stale-socket guard. Removed a few dead imports and named the
reconnect-backoff and poll-interval constants.
Python: module and function docstrings covering the Travelodge scraping
contract, the deadline threading, the two-executor concurrency and the
NDJSON streaming protocol.
Infra: header blocks on every compose file, nginx template, Dockerfile and
entrypoint, covering the config selection, envsubst allow-lists, rate-limit
semantics and volume persistence. Hoisted the duplicated envsubst variable
list in nginx/entrypoint.sh.
New: backend/README.md, python/README.md, DEPLOYMENT.md, .env.example,
backend/graph/doc.go. Refreshed vue/README.md. Corrected CLAUDE.md, which
stated a 24h access token where main.go sets 7 days.
No behaviour change. go build/vet, vite build, py_compile and docker
compose config all pass.
Co-Authored-By: Claude Opus 5 <[email protected]>
Background poller fetches emails via IMAP or Microsoft Graph API,
classifies them with Claude Haiku, and creates/updates JobApplication
records automatically. Includes manual sync endpoint and OAuth callback.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Deleted handle_activity.go, handle_favorites.go, handle_post.go, and
handle_user.go — all logic already exists in schema.resolvers.go.
Removed corresponding REST routes from main.go. Moved UserCredentials
struct (used by Login handler) into handle_auth.go.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add ValidateAdmin endpoint that checks JWT admin claim for use as an
nginx auth_request subrequest. Widen cookie path from backend endpoint
to "/" so the access_token is sent on all paths. Extend access token
lifetime from 24h to 7 days. Disable hasura service by default via
Docker profile.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Upload, list, and delete fallback music files from the admin page.
Backend handlers validate file type/size and prevent path traversal.
Nginx max body size increased to 50M to support large audio files.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Fix auth bypass in UpdatePost/DeletePost (missing return after auth check)
- Remove Spotify access token from callback response
- Replace internal error messages with generic responses in all handlers
- Harden GraphQL: complexity limit, disable playground/introspection in prod
- Add security headers (X-Frame-Options, HSTS, etc.) to nginx
- Disable Hasura console/dev mode in production
- Add DOMPurify sanitization to Markdown component
- Fix cookie removal to use correct domain/path from auth config
- Fix nil dereference in rowing handler when Claude API errors
- Fix wildcard CORS on stamp endpoint
- Pin nginx and certbot Docker image versions
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Fetches player summary and recently played games from Steam API with
5-minute server-side caching. Displays in the home sidebar with online
indicator and game artwork.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replaces direct browser-to-Gitea API calls with a backend service that
proxies and caches the feed (1-min TTL), served via the existing GraphQL
HomeData query. Commit message parsing now happens server-side.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replace 5 separate REST calls on home page load with a single GraphQL
query. Add homeData store that fetches posts, favorites, activities,
spotify, and auth in one request. Convert all admin mutations and
auth flows to use GraphQL. Add album images to Spotify GraphQL schema.
Co-Authored-By: Claude Opus 4.6 <[email protected]>