94ad25b6fc44b7b74bc7de2ce0acf96c87c27183
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2e465a463c |
Phase 8 begins: mail, the Notifications page and a test mail
The app sends mail by SMTP submission (src/mail.rs, lettre over rustls with the system's CA bundle, ring as reqwest): VISA_SMTP_HOST, _PORT (465), _SECURITY (tls, starttls, or none for a server on this machine), _USER and the password from VISA_SMTP_PASSWORD_FILE or the credential smtp-password; VISA_MAIL_FROM defaults to "Lanna Desk <user>", VISA_MAIL_REPLY_TO is optional. Without VISA_SMTP_HOST mail is off. The settings are checked at start; the password stays out of Debug. The Notifications page (Office) shows the sender, server and connection, sends a test mail to the address given (offered again next time) and shows the mail server's answer; every message sent or failed is logged (notifications, migration 0011). Text messages say "not yet". Tests: a fake SMTP server checks the envelope, Subject and Reply-To, a refused recipient logged as failed, a bad address and mail switched off. 121 unit, 65 integration. |
||
|
|
16e4cdc73d |
The legal practice: clients, lawyers, contracts, papers, the journal
Lanna Desk's larger work is contracts, general ones and artists', for clients who are Thai or foreign, people or organizations, with several lawyers in the team. The back office gets a Legal section (phase 9 in docs/PLAN.md): - Lawyers: license number, contact, the login of one who uses the app (then "My contracts"), in the team or left. - Clients, as record cards: person or organization, names in English and Thai, stage name or brand, a Thai ID number (checked), a passport or a registration number, the lawyer in charge. - Contracts: code LD-<year>-<n>, the general kinds and the artist kinds (recording, management, publishing, performance, license, merchandise), other party, status, lawyer, dates and value; a contract in force shows its notice day and its end ahead. Filters: general or artists, a lawyer, mine, those over. - Versions: a text kept here, a file (PDF or scan, encrypted as the client's document) or both. They never change: the database refuses UPDATE and DELETE, a version's file cannot be deleted and no document's checksum can change. Any version reads against the one before as a line diff. - Paper copies: the id <code>-P<n> to write on the paper or print as a 90 x 50 mm label with a QR code; where it lies, its state and holder, each move journaled; found again by its id. - The journal: every change in words, in the change's transaction, each entry chained to the one before by SHA-256. The database refuses to change, delete or truncate it; /journal checks the chain and every version's text and fingerprints against its entry, shows the last hash and exports CSV. The sidebar groups its sections: Legal, Visas and stays, Office. Demo data (seed-demo) adds three lawyers, six clients and seven contracts with versions, papers and moves. Documents take a third owner, the client (migration 0009). Checks: fmt, clippy, 115 unit and 62 integration tests (new: versions and the journal, the database refusing changes, a change around the app breaking the chain, paper ids and moves, the demo checking whole); screenshots of the new pages in light, dark and on a phone. |
||
|
|
3d2d8fa30b |
Back office in the website's style; People as record cards
The back office now looks like lannadesk.com: - Light theme as a printed letterhead (warm paper, navy ink, thin gold rules, a gold line across the top), and the default; the dark theme is the same navy and gold and stays a click away. - Trirong for headings and names, Sarabun for text: the website's fonts, self-hosted in static/fonts/ (latin and Thai subsets, OFL), since the CSP allows fonts from this origin only. - The header reads "Lanna Desk, back office"; primary buttons are navy on paper and gold on navy; corners are squarer. People are record cards, like the example record on the website: a monogram, the name in Trirong, nationality and province, the most urgent deadline's chip, the stay today, the next four dated deadlines with how far away they are, the passport and the employer. The filter works on the cards; "Table" shows the table as before (?view=table), and the switch keeps the employer and archive filters. Checks: fmt, clippy, 109 unit and 57 integration tests (the cards show the stay, the next dates and the monogram; the table view and the switch keep their filters); screenshots of People (light, dark, phone), a person, the deadlines and a client link. |
||
|
|
eafe918bcc |
Lanna Desk: logo, a public page at /, the back office at /desk, full sign-out
Logo: a Lanna gable whose crossed kalae horns stand over a desk, gold on navy, with "Lanna Desk" and "Visas · stays · contracts" in Sarabun drawn as outlines. static/brand/ has the mark, the logo for light and for dark backgrounds and a one-color version; scripts/gen_logo.py makes them, the favicon and the header's mark from forms/fonts/Sarabun-Bold/SemiBold (SIL Open Font License, next to the Regular already there). `/` is now lannadesk.com's public page (templates/landing.html, static/landing.css): what Lanna Desk takes care of, how a client starts (write, open the link, sign first, we keep the dates), how the data is kept, contact@lannadesk.com and "Staff sign-in". It needs no session and shows no records. The back office's first page, the deadlines, moves to `/desk` (web::HOME): the header, the nav, the filter, the login's default target and the messages' links follow. Signing out now ends the session at id.cnx.network too. Kanidm names no end_session_endpoint, but its GET /ui/logout ends the session and clears its cookies (SameSite=Lax, so they come along on a top-level navigation). The logout form may only lead to this site (CSP form-action 'self'), so /signed-out sends the browser on with a refresh and offers the link as well; providers that are not Kanidm keep the old page. Checks: fmt, clippy, 109 unit and 57 integration tests (the public page open and free of records, /desk behind the sign-in, the sign-out page leading to the provider); the page at 1280 and 390 px; the header's mark in both themes; the style check on the README, PLAN and the page. |
||
|
|
e5e30c977c |
Lanna Desk: the app's name, for its move to lannadesk.com
The header (staff pages, messages and the client link), page titles, footer, messages, the pack's cover line and the PDFs' creator now say Lanna Desk (lannadesk.com) instead of visa.buildfor.life. The company named in the client's texts and agreements stays B4L. Nothing depends on the name the app is reached under: VISA_PUBLIC_URL comes from the fleet, which moves it to https://lannadesk.com and redirects visa.buildfor.life there with the path, so links already sent keep working. README, AGENTS, PLAN and the release notes name the new address. Checks: fmt, clippy, 108 unit and 57 integration tests; the header at 360 and 390 px and on a desktop. |
||
|
|
d0e13dffd2 |
Agreements the client signs on the link (task 7.6)
Built into the app rather than a separate signing service: any number of agreements (the processing of the client's data first, legal services and consultations later), each in versions whose text never changes. - Staff (Agreements in the sidebar, src/web/agreements.rs): paste the lawyers' text (empty line = paragraph, "# " heading, "- " list item), preview it as the client reads it, publish version 1; a changed text is the next version, the same text again is refused, and the database refuses any change to a published one (migrations/0007, trigger). Switch an agreement off and links stop asking for it. - Client: every active agreement is the first step of every link. The client reads it, ticks that they accept, types their name and signs with a finger or the mouse (static/signature.js; a PNG of the pad). A text changed while they read it is refused. A new version is asked for again at the next link. - The signed copy (src/agreements/pdf.rs, Sarabun so Thai prints, long Thai words cut without parting marks from their letter): the text, the name, the record, the time, the drawing, the link, the forwarded address, the browser and the text's SHA-256; kept as the person's encrypted document of kind "agreement", all in one transaction with the signature and the audit rows (actor link N). - The person's page shows each agreement's state (signed, not signed, to sign again) and every signed copy. - Phones: the section row now scrolls sideways instead of wrapping, so it keeps one height with five sections and Sign out. - Demo data: an invented agreement with a Thai paragraph. Checks: fmt, clippy; 105 unit and 56 integration tests (tests/agreements.rs: versions that never change, signing with a drawing, address and browser recorded, the PDF, signing again after a change, a stale version refused, switched off); layout check light/dark desk/phone on the agreement pages, the client's agreement page, the person page and the people list: no problems; a drawn signature in Edge at 390x844 signed and printed. |
||
|
|
17426dba12 |
The commit that runs: in the footer and at /version
Every page's footer names the commit the binary is built from, with a link to it on the forge, and /version answers with the full hash, open without a login like /healthz, so a script can tell which release is live. build.rs writes COMMIT: from VISA_COMMIT, which the flake sets to its source's revision (a Nix build has no .git), else from git in a checkout, else empty. The flake sets it on the package alone, not on the dependencies' build, which so stays cached from commit to commit. |
||
|
|
83bc481952 |
Phase 2: companies, stay records, deadlines
Companies become records of their own, and the stay in Thailand is recorded in full; from these records the app works out each person's deadlines (docs/PLAN.md, phase 2). - Companies: list, page, form, archive; Thai name, the 13-digit registration number with its check digit verified, address and the director who signs. The employer is chosen from them on the person form and on work permits; a company's page adds people to it; the people list and the Deadlines page filter by employer. Migration 0002 turns the free-text employers into companies. - Stay records, each one `Kind` in src/records.rs with one form, one set of routes and the same audit entries: arrivals and departures with the TDAC, extensions of stay (approved, under consideration, refused), 90-day reports with the receipt's next date, visas, re-entry permits and work permits. Passports, visas and companies are chosen from the person's own records; the server checks the choice. - The deadline engine (src/deadlines.rs, a pure function with a unit test per rule): the 90-day report from day 1 of each arrival, reset by a report or an extension, with the in-person and online windows and the in-person rule after a new passport or an extension; the extension window from 30 days before to the last working day; the decision to collect; overstay with its fine; TM.30 after each arrival; passport and work permit expiry; re-entry permits; visas still to be used. - The Deadlines page at /, the person's status and deadlines on the Overview and the new "Visa and stay" tab, the person's Activity tab, and the next deadline in the people list. - The online 90-day window ends 7 days before the due date (the plan said 8; the Immigration Bureau's TM.47 manual says 7). - 69 tests: 45 unit tests and 24 integration tests. |
||
|
|
2e009700a9 |
Phase 1: app, Kanidm login, people, passports, addresses, audit log
visa.buildfor.life keeps the immigration records of the foreigners B4L looks after. This first phase is the base the deadlines and extension packs build on (docs/PLAN.md, phases 2 to 7). - One Rust binary (axum 0.8, minijinja, sqlx on PostgreSQL) with its templates, static files and migrations compiled in. - Login through Kanidm (OpenID Connect with PKCE and a nonce, ES256), client visa-web, group visa; sessions in PostgreSQL keyed by the SHA-256 of the cookie. VISA_INSECURE_NO_LOGIN=1 for loopback development only. - Same-site check and form token on every POST; a CSP without inline script or style; security headers. - People: list with filter, page, create, edit, archive, restore. - Passports from the machine-readable zone with check digits (ICAO 9303 TD3); expiry warnings at 12 and 6 months. - Addresses in Thailand in the order Thai forms use, with the house master and the TM.30 receipt. - Append-only audit log of every view and change, with the names of the changed fields but never their values (PDPA); the Activity page. - Invented demo people (visa seed-demo, refused when login is on). - 40 tests: unit tests, pages with demo data, the forms, the audit log and the whole login against a fake OpenID provider. - CI: gitleaks over the history, fmt, clippy and the tests against PostgreSQL 18; the pre-commit secret scan. |