Staff make a link for a person (or "+ New client": a record with only the name they know, and its link); the client fills in their own record from their phone without a login, and presses Send. - Links (src/links.rs, migrations/0006): the table keeps the SHA-256 of the token only, as sessions do; the link is shown once, to copy, to email (mailto with the person's address) or as a QR code (qrcode crate, inline SVG). It is open 14 days, until Send, or until staff close it; a new link closes the earlier one. States open, opened, sent, closed, expired. - The client's pages at /c/<token> (src/web/client.rs, client_*.html in a frame of their own, phone first): About you, Passport (the photo reader; a zone fills in the personal details still empty), Address in Thailand, Contact, Documents, Send. Each part is saved on its own, straight into the record. Forms carry the link's own token plus the same-site check. A passport with the same number is changed; an address unlike the current one is added beside it, so the current one and its TM.30 receipt stay; a second save changes what the link added. Uploads (passport page, photo, visa, arrival stamp, TDAC, work permit, other) go through the same checks and encrypted store as staff uploads, tied to the person's newest record of their kind. - Audit: the client's views and changes carry the actor `link <id>`; actions send and close and entity link are new. The person's page shows the newest links, when they were opened and sent, and each record the client changed, with the fields, to check. - Demo data: Erika sent her link an hour ago (phone and email changed), Jane opened hers. - documents::read_upload returns why it refused, so the client's pages answer in their own words. Checks: fmt, clippy; 101 unit and 54 integration tests (tests/client.rs: the link shown once and kept as a hash, a new client, the whole client flow with the login on, forged, closed, expired and made-up links); layout check light/dark desk/phone on the client pages, the person page and the new client form: no problems; the camera reader on the client's passport page with a fake camera filled the form and Send closed the link.
65 lines
2.2 KiB
TOML
65 lines
2.2 KiB
TOML
[package]
|
|
name = "visa"
|
|
version = "0.1.0"
|
|
edition = "2024"
|
|
rust-version = "1.95"
|
|
description = "visa.buildfor.life: immigration records, deadlines and extension packs for foreigners in Thailand"
|
|
publish = false
|
|
# Integration tests are one binary: tests/main.rs declares every tests/*.rs
|
|
# as a module, so the suite links once.
|
|
autotests = false
|
|
|
|
[lib]
|
|
doctest = false
|
|
|
|
[[bin]]
|
|
name = "visa"
|
|
path = "src/main.rs"
|
|
test = false
|
|
|
|
[[test]]
|
|
name = "integration"
|
|
path = "tests/main.rs"
|
|
|
|
[dependencies]
|
|
anyhow = "1"
|
|
axum = { version = "0.8", features = ["multipart"] }
|
|
base64 = "0.22"
|
|
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }
|
|
form_urlencoded = "1"
|
|
# pdf: the blank forms and uploaded PDFs go in as they are; raster-images:
|
|
# uploaded scans and photos in the extension pack.
|
|
krilla = { version = "0.8", default-features = false, features = ["pdf", "raster-images", "simple-text"] }
|
|
minijinja = "2"
|
|
# The client link as a QR code to show on a phone (an inline SVG).
|
|
qrcode = { version = "0.14", default-features = false, features = ["svg"] }
|
|
# The login service's certificate is checked against the system's CA bundle
|
|
# (native roots), so a NixOS VM test can bring its own CA.
|
|
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "json"] }
|
|
# ID token signatures (ES256 from Kanidm, RS256 accepted), PKCE, random tokens
|
|
# and the session hashes, as in proplan and the fleet overview.
|
|
ring = "0.17"
|
|
rustybuzz = "0.20"
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
serde_urlencoded = "0.7"
|
|
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio", "postgres", "chrono", "migrate", "macros"] }
|
|
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread", "signal", "sync", "time"] }
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] }
|
|
|
|
[dev-dependencies]
|
|
http-body-util = "0.1"
|
|
tower = { version = "0.5", features = ["util"] }
|
|
|
|
[profile.dev]
|
|
# Line tables keep file:line in panics at a fraction of full debug info.
|
|
debug = "line-tables-only"
|
|
|
|
[profile.dev.package."*"]
|
|
debug = false
|
|
|
|
[profile.release]
|
|
lto = "thin"
|
|
strip = true
|