On the libunftp version in use, server.listen() returns Err when the server is shut down gracefully, and the listen task writes that into the shared last_error asynchronously. ftp_save_settings restarts the server (stop -> sleep -> start): start() clears last_error and brings up a new server, but the *old* listen task then returns its expected "shutdown error" and writes it into the same shared slot — so a perfectly running server reports `server error: shutdown error`. Give each server instance an epoch. The listen task records its error only while it is still the current server; stop() moves the epoch on (so the server's own shutdown is ignored) and clears last_error, since a server stopped on purpose is not a server in error. No command signatures change. cargo build/clippy/test to run in CI (no Rust toolchain on this machine). Claude-Session: https://claude.ai/code/session_01RAkmwWv6L5KmpX4h9JPD2i
apps/desktop
Tauri 2 shell around apps/app: the same interface as the web, running natively.
The window loads the web app from the server (PHOTOREPORT_APP_URL at build time, default
https://app.next.photoreport.pt). The desktop app is therefore always on the latest version: every web deploy
updates it, and the installer only needs rebuilding when the native shell itself changes. tauri dev still uses
the local dev server.
What the shell adds today:
- Sign-in through the browser (device authorization): the desktop never sees the password.
- Refresh token in the OS keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service). Without a keychain the session stays in memory and ends when the app closes.
- Local FTP server for cameras (
src/ftp.rs, Library → FTP local). See below. - Local catalogue (
src/catalog.rs, Preferências → Catálogo local). See below. - Works without network: when the server can't be reached at start-up, the window opens the copy of the web app bundled in the installer (photo engine included), so the catalogue, local FTP and editing originals on disk go on; edits wait in the offline queue.
- Updates itself (
src/updater.rs): a notice offers each new shell version; one click installs it and restarts.
Replaces PhotoReport_Studio (Flutter) and the archived bridge.photoreport.pt.
Local catalogue
Folders on the computer (archive, card copies, Photo Mechanic ingest folders) whose photos the app knows by their
SHA-256, the fingerprint the server keeps for every photo. Any photo of those folders that is also on the server
opens in the editor from disk, at full resolution, with no download. JPEG, HEIC/TIFF/PNG and the usual RAW files
are indexed; hidden folders and Lightroom preview caches (*.lrdata) are skipped. Re-indexing only reads files
whose size or date changed. The catalogue only reads: nothing is moved, renamed or deleted. Settings and the cache
are in the app's config folder (catalog.json, catalog-cache.json, local-index.json).
Updates
The web app inside the window updates with every web deploy. The shell checks
<API>/v1/desktop/update/{target}/{arch}/{version} at start and every 6 hours; the API reads the latest
desktop-v* release on Gitea (DESKTOP_RELEASES_API, DESKTOP_RELEASES_TOKEN, read-only) and passes the
installer through, so the private repository stays private. Installers are signed with the release key
(tauri signer generate): the private key and its password are the Gitea secrets TAURI_SIGNING_PRIVATE_KEY and
TAURI_SIGNING_PRIVATE_KEY_PASSWORD, the public key is the variable TAURI_UPDATER_PUBKEY (compiled into the app
as PHOTOREPORT_UPDATER_PUBKEY). A build without the public key never updates itself.
Local FTP (camera → this computer → event)
FTP local in the Library starts an FTP server on the computer (passive ports 50000–50100). Configurar sets, like the old Studio:
- the port (default 2121);
- one or more logins, as simple as you like on a private network (e.g.
1dx/1dx); - the ingest folder the camera writes to (default
~/Desktop/ingest); - the work folder originals move to once the server has them (default
~/Desktop/{year}/{date} - {event}); - whether it starts with the app.
Settings are saved in the app's config folder (ftp.json, readable by the user only). The panel shows the
computer's network addresses to type into the camera. The camera and the computer must be on the same network.
The first time, macOS asks whether to accept incoming connections: Allow.
- JPEG only; other files (RAW) stay in the ingest folder.
- A photo counts as complete when the FTP session reports it finished, or when it has stopped changing.
- Each one is sent to the event chosen in the panel, through the same resumable upload as Importar. The event's IPTC template is applied on the server.
- Once the server has it, the original moves to the event's work folder. Nothing is deleted.
- Whatever did not go (no network, app closed) stays in ingest and goes on the next start or with "Reenviar".
- The feed runs while you work in any module, not only the Library.
- The window can only read photos inside the ingest folder (
ftp_readchecks the path).
Plain FTP is unencrypted. It is meant for the local network only: do not forward the port on the router.
Develop
pnpm --filter @photoreport/desktop dev # runs the web app dev server and opens the native window
Linux needs libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libsecret-1-dev.
The shell is outside the root Cargo workspace because of those system libraries.
Release
Tag desktop-vX.Y.Z -> .gitea/workflows/desktop-release.yml. macOS and Windows installers need runners on
those systems (see the workflow header).
On a Mac, without a runner: bash infra/desktop/build-macos.sh. It installs what is missing (Rust, pnpm, the wasm
tools), builds the photo engine and the app, and opens the folder with PhotoReport_<version>_universal.dmg. The
build is not signed: the first time, open it with right-click → Open. Signing and notarisation need an Apple
Developer ID.