Every page of the pack is now A4 upright, so it prints as one stack. A
PDF page or a whole-page picture that lies wider than tall is turned
onto the page (a small one that fits as it is stays as it is), and a
PDF page is only made smaller, never larger.
A picture never prints larger than its resolution allows (the JFIF or
PNG dpi, else 150 dpi), nor larger than its kind's box: passport pages,
visas and stamps 180 x 128 mm, cards 130 x 90 mm, and a phone's
screenshot (the TDAC, or any picture about twice as tall as wide)
150 x 75 mm. These print at the top of the page.
Cards: a new kind "ID card", and the work permit, take two pictures in
one upload as front and back (migration 0008 documents.back_of). The
Documents tab marks them front/back, lists them together and offers
"Print both sides" (.../documents/{id}/sides.pdf); the pack prints both
on one sheet. The client link takes ID cards too. The demo seeds a TDAC
screenshot and an ID card's two sides.
Checks: fmt, clippy, 108 unit and 57 integration tests (print sizes,
dpi reading, the back following its front, the paired upload, its
audit and the sides PDF); the demo pack's pages checked as images.
The Documents tab's actions stack on a phone, so none is cut off.
Scans and photos of a person's papers, and a company's documents for the
extension packs, uploaded on a dashed strip that takes dropped files: up to
10 files of 20 MB each, 64 MB in all; PDF, JPEG, PNG and WebP, told by their
first bytes.
- src/files.rs: one file per document as <id>.vdoc, AES-256-GCM under a key
per file (HKDF-SHA256 from the file key and a random salt in the header);
the document's id is authenticated with it. The key comes from
VISA_FILES_KEY_FILE or the credential files-key; with the login on, the
app does not start without it and VISA_FILES_DIR.
- migrations/0003: documents (a person's or a company's, the record it
belongs to, kind, date on it, note, file name, type, size, SHA-256);
audit_log gets company_id and the action download.
- A Documents tab per person, the documents on the company's page, and each
record's documents next to its Edit link with "+ Document".
- An upload's form token is its first field and is checked before any file
is read; the guard lets multipart through only to the two upload addresses.
- Files open under their own CSP and are never cached; a download is named
after the person or company, the kind and the date. Every upload, view,
download, change and deletion is in the audit log.
- visa files-check; demo documents in seed-demo; scripts/dev.sh keeps the
local documents and their key in .dev/; /favicon.ico for image and PDF
pages.
Tests: 57 unit and 33 integration (8 new for documents). Edge check of the
strip (choose, drop, too large), an upload, the PDF and image viewers under
the file policy: no problems, no console errors.