Generate the job capture token from the admin panel
Deploy with Docker Compose / deploy (push) Successful in 52s

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]>
This commit is contained in:
2026-10-12 13:40:30 +01:00
co-authored by Claude Opus 5.5
parent b8670246a8
commit 26f312e307
15 changed files with 600 additions and 64 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Job tracker capture
// @namespace https://www.adam-french.co.uk/
// @version 1.0.0
// @version 1.0.1
// @description Add the job posting you are looking at to the tracker at /cv/jobs.
// @match *://*/*
// @noframes
@@ -30,8 +30,8 @@
*
* CONFIGURE: Violentmonkey menu -> "Configure job capture". It asks for the
* API base (default below; http://localhost/api for the dev stack) and the
* token, which is the server's JOB_CAPTURE_TOKEN. Both are kept in
* Violentmonkey's own storage. THE TOKEN MUST NEVER BE WRITTEN INTO THIS FILE:
* token, which is generated on the site's admin panel (/admin, "Job capture
* token") and shown there once. Both are kept in Violentmonkey's own storage. THE TOKEN MUST NEVER BE WRITTEN INTO THIS FILE:
* it is served publicly.
*
* WHAT RUNS WHERE: the script matches every site so that the menu command
@@ -135,7 +135,7 @@
);
if (base === null) return false;
const token = prompt(
"Capture token (the server's JOB_CAPTURE_TOKEN)",
"Capture token (generate one on the site's admin panel)",
config.token,
);
if (token === null) return false;