Commit Graph
47 Commits
Author SHA1 Message Date
Leon TonhäuserandClaude 7e50c7c2fd fix(admin): add /admin index redirect and point root redirect at it
/admin had no index page (only /admin/redaktionen, /abrechnungen, /audit),
so authenticated admins hitting /admin — including the admin layout's
wordmark link — got a 404. Add src/app/admin/page.tsx that redirects to
/admin/redaktionen, and point the root home redirect at the same path so
post-login doesn't 404.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-11 00:43:29 +02:00
Leon TonhäuserandClaude cc2079db77 fix(home): redirect authenticated users to their portal home
The root page was a static public landing that always shows a
'Zum Portal' button pointing at /anmelden, and /anmelden never
redirects authenticated users. After login the callbackURL '/' landed
on this static page, so the user saw the login form again — the
post-login loop. Make / an async server component that reads the
session and redirects to /admin (admin) or /redaktion/alben (editorial);
unauthenticated users still see the landing.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-11 00:19:52 +02:00
Leon TonhäuserandClaude 3316365b73 fix(csp): allow inline scripts so Next.js client forms hydrate
script-src was 'self' with no 'unsafe-inline' and no nonce, so the
browser blocked Next.js App Router's inline hydration scripts (RSC
flight data + bootstrap). React never hydrated, so every client form's
handler never attached and the browser fell back to a native GET submit
— login dumped email/password into the URL and did nothing, and the
registration/reset forms were equally dead. Add 'unsafe-inline' to
script-src; per-request nonces via middleware remain the upgrade path.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-11 00:06:39 +02:00
Leon TonhäuserandClaude e6baaddca6 fix(preflight): check /api/albums instead of removed /api/server-info/ping
Current Immich removed /api/server-info/ping (returns 404 'Cannot GET
/api/server-info/ping'), so the preflight IMMICH check always failed
even though the API and key are fine. /api/albums is the endpoint the
portal actually depends on and requires a valid key with album.read
scope, so a 200 there confirms reachability + auth.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 23:55:40 +02:00
Leon TonhäuserandClaude 33b9076cd3 fix(auth): generate UUID ids to match uuid schema columns
Better Auth's default id generator emits a nanoid-style string, but
every id column in the schema is typed uuid. Better Auth passes its
generated id explicitly on insert (bypassing the column defaultRandom),
so Postgres rejected every signUp/session/verification insert with
'invalid input syntax for type uuid'. This broke live registration and
the admin seed alike. Configure advanced.database.generateId to return
crypto.randomUUID() so ids match the schema.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 23:41:47 +02:00
Leon TonhäuserandClaude 2c495ab32a fix(env): correct DATABASE_URL host in .env.example to portal-db
The compose database service is named portal-db, but .env.example
shipped DATABASE_URL pointing at host 'postgres'. Copying the example
and changing only the password left deployments resolving an
unreachable host (EAI_AGAIN postgres), while the spinner hid the
failed migrate and a stale portal-db-data volume made it look applied.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 23:31:19 +02:00
Leon TonhäuserandClaude 5ebde42aba ops: use external immich_default network
Immich's Compose creates the external network as immich_default, not
immich-net. Rename the external network reference so portal-app and
the preflight ops service attach to the existing network instead of
failing with 'network immich-net declared as external, but could not
be found'.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 23:25:25 +02:00
Leon TonhäuserandClaude 013036ea81 ops: add migrate/seed/preflight compose profile for clean fresh setup
The portal database lives on an internal-only network and is not exposed to
the host, so `pnpm drizzle-kit migrate` and admin seeding cannot run from the
host. Add one-shot `ops`-profile services built from the builder stage that run
migrations, seed the first admin, and run the preflight smoke test against the
real env from inside the network. Share the app env via an x-portal-env anchor.

Update the runbook to use the new commands.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 23:14:02 +02:00
Leon TonhäuserandClaude 6fc095a161 ops: add preflight smoke test for env + DB/SMTP/Immich connectivity
scripts/preflight.ts validates that every required env var is set, then
checks live connectivity to the database, the Better Auth adapter (instance
builds + user table readable), SMTP and Immich. Prints OK/FAIL per check
and exits non-zero on any failure. Run it when bringing up the box to catch
missing env vars and dead connections before going live.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 23:09:24 +02:00
Leon TonhäuserandClaude 268ea7544e fix: wire editorial approval, harden registration, set production auth URL
- Wire admin approval UI to editorialService.approveEditorial so editorial
  accounts can move pending_approval -> active and log in. The approve button
  was permanently disabled and the service unreachable, so editorial users
  could never sign in.
- Surface non-validation errors (e.g. SMTP failures) on the registration
  form instead of silently redirecting to the confirmation page.
- Set BETTER_AUTH_URL default to the production domain in .env.example and
  compose.yaml so verification/reset links and the login origin check
  resolve against the live origin.
- Add scripts/check-smtp.ts to verify SMTP connectivity against the
  configured transport.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 23:06:13 +02:00
Leon Tonhäuser 907beb6e42 ops: copy scripts folder to runner stage in Dockerfile 2026-08-10 22:47:59 +02:00
Leon Tonhäuser ed83cdf185 feat: add admin seed script 2026-08-10 22:44:32 +02:00
Leon Tonhäuser 976d7e0fef ops: include drizzle migrations in standalone image runner stage 2026-08-10 22:31:55 +02:00
Leon Tonhäuser ab8c035d99 merge: merge codex/immich-redaktionsportal into main 2026-08-10 21:52:53 +02:00
Leon Tonhäuser a06d51b746 chore: update root gitignore 2026-08-10 21:52:49 +02:00
Leon Tonhäuser 9c0d43b1ec test: add portal end-to-end quality gates 2026-08-10 21:51:25 +02:00
Leon Tonhäuser f7481d4cde ops: add portal deployment and backup runbook 2026-08-10 21:47:53 +02:00
Leon Tonhäuser 21871bb9ff feat: harden portal security and auditability 2026-08-10 21:46:54 +02:00
Leon TonhäuserandClaude 7f1ecd9322 feat: finalize immutable billing reports
Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 18:19:13 +02:00
Leon TonhäuserandClaude a384c4c35e fix: deterministic pdf render and restore pnpm pin
- Revert packageManager from pnpm@11.16.0 back to pnpm@10.34.5
  (restore the plan's pinned version; the PATH pnpm is unaffected).
- Inject a deterministic PDFKit document /ID derived from
  SHA-256(snapshot.documentId) so the same snapshot always produces
  byte-identical output, making the stored SHA-256 a verifiable
  integrity fingerprint.
- Add covering test: render same fixture twice, assert bytes.equals()
  and sha256 equality.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 18:04:18 +02:00
Leon TonhäuserandClaude 89d76e2711 feat: render billing usage pdf
Add the immutable PDF renderer for "Nutzungsnachweis" billing reports.

- src/modules/billing/types.ts: BillingReportSnapshot self-contained type
  (address, selected positions, repeat downloads, net total in cents,
  report/invoice metadata, period, document ID, legal notice).
- src/modules/pdf/document.ts: pdfmake document definition builder with
  monochrome invoice layout (black logo, sender/recipient blocks, rounded
  black summary panel, repeated black table headers, light-gray rows,
  German dates, cents-derived totals, page numbers, document ID, invoice
  reference, legal separation notice).
- src/modules/pdf/render.ts: renderBillingPdf → { bytes, sha256 } using
  pdfmake 0.3 with IBM Plex Mono (OFL) embedded via the VFS.
- scripts/render-pdf-fixture.ts: stress fixture generator (1 row, 60 rows,
  long address, long fields, umlauts, 3-page case) into tmp/pdfs/.
- tests/fixtures/billing-report.ts: deterministic reportFixture (60,00 EUR).
- tsconfig.json: server-only path alias for tsx script execution.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 17:54:19 +02:00
Leon TonhäuserandClaude d37affc80f feat: add billing period selection
Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-10 17:31:42 +02:00
Leon Tonhäuser ba673ad732 fix: harden download history and attempt ledger 2026-08-10 16:45:40 +02:00
Leon Tonhäuser 510fde7afa fix: harden delivery accounting and history 2026-08-10 13:44:04 +02:00
Leon Tonhäuser 8871e4794a feat: stream originals with download accounting 2026-08-10 13:10:13 +02:00
Leon Tonhäuser c400167b8f fix: enforce one active logical album grant 2026-08-10 12:14:38 +02:00
Leon Tonhäuser 74ab2eb85f fix: harden legacy normalization and grants 2026-08-10 11:53:28 +02:00
Leon Tonhäuser 3cdca5c82c fix: preserve legacy accounting migration data 2026-08-10 11:39:44 +02:00
Leon Tonhäuser 3de1530074 fix: harden usage accounting idempotency 2026-08-10 10:59:12 +02:00
Leon Tonhäuser 22fe6bf659 feat: add usage and download intent accounting 2026-08-09 22:52:27 +02:00
Leon Tonhäuser 846904f3db fix: harden editorial thumbnail authorization 2026-08-09 22:32:18 +02:00
Leon Tonhäuser 66f0599653 feat: add branded editorial photo catalog 2026-08-09 22:22:31 +02:00
Leon Tonhäuser f6e6018cc1 fix: link album assignment and narrow errors 2026-08-09 22:06:34 +02:00
Leon Tonhäuser 4af86f6eb9 feat: add editorial album permissions 2026-08-09 22:00:15 +02:00
Leon Tonhäuser 0fe2c80cda fix: contain immich stream cancel races 2026-08-09 21:49:34 +02:00
Leon Tonhäuser 653e5ca050 fix: manage immich request lifecycles 2026-08-09 21:45:59 +02:00
Leon Tonhäuser a5973bfaf1 feat: add typed immich api adapter 2026-08-09 21:39:12 +02:00
Leon Tonhäuser b84562ad52 fix: add approval migration snapshot 2026-08-09 21:27:50 +02:00
Leon Tonhäuser 3f84b840d9 fix: serialize editorial approval delivery 2026-08-09 21:23:32 +02:00
Leon Tonhäuser 3584b4a7a7 feat: add editorial approval and account guards 2026-08-09 21:15:30 +02:00
Leon Tonhäuser a8d4e54ffb fix: harden editorial registration flow 2026-08-09 21:04:50 +02:00
Leon Tonhäuser 9b22752ef2 feat: add editorial registration and authentication 2026-08-09 20:48:43 +02:00
Leon Tonhäuser 7acaacb92e feat: add portal database schema 2026-08-09 20:26:18 +02:00
Leon Tonhäuser 763098b129 chore: bootstrap portal application 2026-08-09 20:14:31 +02:00
Leon Tonhäuser 90e53e7d56 chore: ignore local worktrees 2026-08-08 23:59:21 +02:00
Leon Tonhäuser 5726c93ef3 docs: add implementation plan for editorial portal 2026-08-08 23:56:04 +02:00
Leon Tonhäuser 86a2a1f0fd docs: add immich editorial portal design 2026-08-08 23:40:52 +02:00