feat(training): rich-text lessons with inline images and 25 MB manuals
CI / build (push) Has been cancelled

Admins were authoring plain-text lessons, which made illustrated tutorials
and reordering images impossible. Lesson bodies are now sanitized HTML from a
Tiptap editor with alignment, sizing, drag-reorder and alt text, and inline
images reuse the training_resources table so no migration is needed.
Attachments grow to 25 MB, PDFs stream inline, and SVG is rejected because it
can execute as a document. Legacy plain-text bodies are normalized on read.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-20 12:18:24 +00:00
parent e8759cdee8
commit cb5976edb2
18 changed files with 1799 additions and 114 deletions
+4 -4
View File
@@ -553,10 +553,10 @@ Still missing screens (APIs exist): volunteer profile + prefs, blackout calendar
## 13. Training, uploads, settings
- Lessons: plain-text body, published flag, ordering. Volunteers see published; admins author/publish/delete. Two starter lessons seeded only when the table is empty.
- Attachments: images/PDF/plain text/Markdown/Word, ≤5 MB, random stored name, metadata in Postgres, bytes under `UPLOAD_DIR`.
- Uploads verify **magic bytes** against the declared MIME.
- Serving requires a session; only images render inline, everything else is an attachment, with `nosniff`.
- Lessons: sanitized rich-text HTML body (headings, lists, links, inline images with alignment/size/move controls), published flag, ordering. Volunteers see published; admins author/publish/delete. Two plain-text starter lessons seeded only when the table is empty and normalized to HTML on read.
- Attachments: images/PDF/plain text/Markdown/Word, ≤25 MB, random stored name, metadata in Postgres, bytes under `UPLOAD_DIR`.
- Uploads verify **magic bytes** against the declared MIME; SVG is rejected because it can execute as a document.
- Serving requires a session; images and PDFs render inline, everything else is a download, with `nosniff`.
- Any signed-in team member can fetch any attachment id (team-wide content by design).
- Delete removes bytes best-effort; there is no orphan-file sweep.
- Runtime settings: `app_settings` holds sender/inbox and the Gmail address + AES-256-GCM app password. Blank password keeps the stored one; an empty address disconnects Gmail. Saves are audited without the secret.