#603 Tell desktop users and platform administrators of newer releases (#601)
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#603
- pull request
- state:merged
Closes #601. Desktop users and signed-in platform administrators now hear about a newer release. ## Desktop app - **Check:** a new `desktop_latest_release` command asks GitHub's API for the latest release (Rust's `reqwest`, since the webview's CSP allows only IPC). The request carries nothing but itself. - **Release builds only:** the release workflow already sets `OCH_BUILD_VERSION`, and it is now embedded at compile time (`build.rs` rebuilds when it changes). Builds without it never ask. - **Once a day:** the editor keeps the day's answer in `localStorage`. Called with `ask: false`, the command only says which release is running, so a restart doesn't ask again. An upgraded app asks again. - **Banner:** "OpenChronology v0.26.0 is available. This app is v0.25.0.", with **What's new** (the release notes), **Download** (timescale.info's download page, opened in the system browser), **Don't check for updates**, and × to dismiss until the next release. - **Permission:** the command is granted in `capabilities/default.json`. ## Platform - **Who sees it:** a signed-in administrator on a release build, when GitHub's latest release is newer than `dist/build-info.json`'s version. The banner sits under the header, with **What's new**, **How to upgrade** (`docs/administration.md#upgrading`) and **Dismiss until the next release**. - **Latest release:** read through the download page's cached `latestRelease()`, so GitHub is asked at most every ten minutes. - **Dismissal:** kept per administrator and release in `oc_users.update_dismissed`, so it follows them across devices. It's set by the new `POST /api/admin/update-notice` (administrators only, with the CSRF token, release tags only), described in the OpenAPI document. - **Opt-out:** `UPDATE_NOTICES=off` turns it off, documented in `.env.example` and `docs/administration.md`. ## Both - **Version comparison:** `newerRelease` (`src/updates.ts`) compares semantic versions numerically. Builds from main, pre-releases offered as the latest, and unreadable tags are never told to update. A pre-release does see its own final release as newer. ## Tests - **`test/updates.test.mjs`:** the comparison and the switch. - **`test/administration-postgres.mjs`:** the endpoint refuses non-admins, a missing CSRF token and non-tags, and stores the release. - **`test/desktop-cache-browser.mjs`:** with the app's commands mocked, the banner shows, dismissal is stored, and a reload asks only which release is running. - **Local runs:** all of the above pass, as does `test/next-platform.mjs`. - **By hand:** I checked the built platform with a faked older version and newer release. The banner showed for an admin, and after dismissing it, a reload didn't show it again. - **Not compiled here:** this machine lacks the GTK/WebKit libraries Tauri needs, so the desktop Rust is compiled by CI's desktop jobs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/circagraph/timeline-app/pull/603
Related
Open #603 Tell desktop users and platform administrators of newer releases (#601) in the timeline