Commit Graph

9 Commits

Author SHA1 Message Date
86644abf07 fix: tojson filter must return Markup to avoid HTML-escaping quotes
All checks were successful
Deploy / deploy (push) Successful in 15s
Jinja2 autoescaping turns " into " after filters run unless
the filter returns a Markup (safe) object. json.dumps alone produced
broken JS (const REPLICA_NAME = "name";).
Wrap json.dumps output in markupsafe.Markup to prevent escaping.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 22:44:23 +01:00
f76aba0f48 fix: update TemplateResponse to Starlette 0.41 signature
All checks were successful
Deploy / deploy (push) Successful in 16s
Starlette 0.41.x removed the old TemplateResponse(name, context) API.
Switch to the new TemplateResponse(request, name, context) signature,
which is the only supported form in Starlette >= 0.41.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 22:36:24 +01:00
15599b9f01 fix: add tojson Jinja2 filter to fix 500 on replica detail page
All checks were successful
Deploy / deploy (push) Successful in 17s
FastAPI's Jinja2Templates doesn't include Flask's tojson filter.
Register json.dumps as the tojson filter so replica_detail.html
can safely embed replica.name in a JS string literal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 22:04:31 +01:00
cdc9407ff3 Implement master promotion feature
All checks were successful
Deploy / deploy (push) Successful in 33s
Allows promoting any replica to master with zero document re-downloads.
The sync_map rebuild uses existing DB data only — pure in-memory join.

Changes:
- app/sync/promote.py: preflight() checks (doc count, sync lock, ack
  warnings) and promote() transaction (pause scheduler, rebuild all
  sync_maps, create old-master replica, swap settings, resume scheduler)
- app/api/master.py: GET /api/master/promote/{id}/preflight (dry run)
  and POST /api/master/promote/{id} (execute)
- app/models.py: add promoted_from_master bool field to Replica
- app/database.py: idempotent ALTER TABLE migration for new column
- app/main.py: register master router
- app/templates/replica_detail.html: "Promote to Master" button +
  dialog with pre-flight summary, 3-card stats, ack checkboxes, spinner
- app/ui/routes.py: flash query param on dashboard route
- app/templates/dashboard.html: blue info banner for post-promotion flash

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 21:17:01 +01:00
eee4d11f44 Redesign replicas page with professional B2B layout
All checks were successful
Deploy / deploy (push) Successful in 14s
- Two-column layout: add form (left) + prerequisites guide (right)
- Help sidebar with numbered checklist: reachability, API token, interval
- Callout for existing-instance reconcile workflow
- "What gets synced" info card with primary-color accent border
- Form fields with helper text under each input
- Spinner/busy state on submit buttons during API calls
- Clean status badges replacing emoji in replica table
- Better modal footer layout for edit dialog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 10:11:00 +01:00
e660808640 Add reset-ts endpoint to reset last_sync_ts without clearing sync_map
All checks were successful
Deploy / deploy (push) Successful in 14s
Needed to safely recover missing docs: run reconcile first (populates
sync_map for existing docs), then reset-ts, then sync (only missing
docs get uploaded, existing ones get metadata patch only).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 21:44:37 +01:00
cbcf88ca96 fix: resync clears last_sync_ts; add live doc counts to dashboard
All checks were successful
Deploy / deploy (push) Successful in 14s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 20:10:12 +01:00
c87bc6a954 fix: httpx 0.28 AsyncClient multipart compat — pass all fields via files= list
All checks were successful
Deploy / deploy (push) Successful in 15s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 20:01:34 +01:00
b99dbf694d feat: implement pngx-controller with Gitea CI/CD deployment
All checks were successful
Deploy / deploy (push) Successful in 30s
- Full FastAPI sync engine: master→replica document sync via paperless REST API
- Web UI: dashboard, replicas, logs, settings (Jinja2 + HTMX + Pico CSS)
- APScheduler background sync, SSE live log stream, Prometheus metrics
- Fernet encryption for API tokens at rest
- pngx.env credential file: written on save, pre-fills forms on load
- Dockerfile with layer-cached uv build, Python healthcheck
- docker-compose with host networking for Tailscale access
- Gitea Actions workflow: version bump, secret injection, docker compose deploy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 17:59:25 +01:00