#439 The desktop makes timelines from files, each opening in its own app (#433)
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#439
- pull request
- state:merged
Closes #433. The desktop app gets **From files…**, which makes a new timeline with one moment per file. A folder of photos becomes an album you browse by when each photo was taken. Each moment's source is the file itself, and clicking it opens the file in the system's app for it. ## The populator's choices - **Folders and files:** picked in the native dialog only. The page never sends a path: Rust scans only what was picked there (`Population` state in `main.rs`). - **Search subfolders too:** on by default. Hidden entries are skipped and links to other folders are never followed. - **Which files and their date**, following the requested type: `fileType := anyFile { date: created | modified } | mediaFile { date: created | modified | metadata }` - `metadata` means the EXIF date taken (or digitized) for photos, and the creation date in the header for video and audio. nom-exif (MIT, pure Rust) reads both. - A file without that date is left out and counted. There's no fallback to another date. - **Times without a zone:** read in this computer's zone (the default) or in UTC. - **GPS:** a switch, off by default. When on, a moment gets `location: {latitude, longitude}`. - **Title:** starts as the first folder's name. ## What a moment holds - **Title:** the file's name. - **`sources`:** the file as a `file:///…` link. - **`tags`:** `file:photo`, `file:video`, `file:audio` or `file:other`. - **Time:** exact to the nanosecond. - **ID:** a hash of the file's path, so it's the same each time. The new timeline: - has a Gregorian display in the computer's zone, and the Sources plugin; - is staged like an `.ochx` import, so it opens unsaved, ready for Save As; - reports progress, can be stopped, and ends with a summary of what was made and what was left out, and why. **Limits:** 100,000 moments and 1,000,000 entries examined per run. ## Opening a file (`desktop_open_file`, `desktop_reveal_file`) - **Confirmation:** the first time a timeline opens a file, the app asks, naming the file. - **What it refuses:** - anything that isn't an existing regular file on this computer; - programs, scripts, installers, shortcuts and launchers, judged by the link's name and by its resolved target; - on Unix, executable files unless they are media (files on memory cards are often 0777). - **Show in folder** always works. It selects the file on macOS and Windows, and opens the folder on Linux. - **No shell:** the opener is given the path as one argument. - HTTPS source links in the inspector now open in the system browser on the desktop too. ## Local paths are never stored on a server - **Client:** `transport.ts` takes `file://` strings out of every request body (`requestApi`, `requestProgress`, `exportSqlite`) and shows how many stayed on the computer. - **Server:** `body()` in `server/http.mjs` refuses with 400 any JSON request holding a `file://` string anywhere, as a backstop. - Text such as "File: the report" isn't affected: a match requires `file://`. - On the web and in the offline file, a file source shows its name as text, noting it's on the computer that added it. ## Follow-up Thumbnails, per your note: #440. ## Tests - **Rust (`src-tauri`, 8 tests, run locally):** - EXIF dates with and without a zone; - GPS; - a video's header date; - dating by file dates through subfolders, with hidden entries skipped; - stable IDs; - cancelling; - every refusal case for opening a file, including a symlink named `.jpg` that points at a script. The test photos and video are built inside the tests. - **Unit tests:** `test/local-files.test.mjs` covers the validation and removal of local links, and `test/http.test.mjs` covers the server's refusal. All 434 pass. - **Browser test:** `test/populate-browser.mjs` stands in for the native side. It checks that the choices follow the file type, that no path goes to Rust, the new timeline and its summary, the one-time confirmation, and Show in folder. It passes in the Playwright image. - **N……
Related
Open #439 The desktop makes timelines from files, each opening in its own app (#433) in the timeline