feat #14740: fallback update endpoint
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+36
-29
@@ -45,47 +45,53 @@ restarts the app. Debian builds do not update themselves.
|
||||
- `RELEASE_BASE_URL`: the Gitea repository,
|
||||
`https://gitea.euvino.eu/public/call-recorder`. The download URLs in `latest.json`
|
||||
point to `${RELEASE_BASE_URL}/releases/download/v<version>/<file>`.
|
||||
- `UPDATE_JSON_URL`: where the app looks for `latest.json`. `build-release.sh` writes
|
||||
it into `plugins.updater.endpoints` in `src-tauri/tauri.conf.json`.
|
||||
- `UPDATE_JSON_URLS`: where the app looks for `latest.json`. `build-release.sh`
|
||||
writes them, in this order, into `plugins.updater.endpoints` in
|
||||
`src-tauri/tauri.conf.json`.
|
||||
|
||||
Do not edit the endpoint in `tauri.conf.json` by hand. Change `release.env`; the next
|
||||
release build writes the endpoint into `tauri.conf.json`.
|
||||
Do not edit the endpoints in `tauri.conf.json` by hand. Change `release.env`; the
|
||||
next release build writes them into `tauri.conf.json`.
|
||||
|
||||
The repository and its releases must be readable without logging in: the app
|
||||
downloads anonymously.
|
||||
|
||||
### Hosting the feed: two options
|
||||
### The two feed URLs
|
||||
|
||||
The endpoint is compiled into the app. Changing it only affects versions built after
|
||||
the change; installed versions keep asking the old URL. So check the URL right after
|
||||
the first release, before anyone relies on updates.
|
||||
The app tries the endpoints in order and uses the first one that returns a release.
|
||||
A `404` or a network error on one moves on to the next one:
|
||||
|
||||
**A: `latest.json` as a release asset (default)**
|
||||
1. `https://gitea.euvino.eu/public/call-recorder/releases/latest/download/latest.json`:
|
||||
`latest.json` as an asset of the newest release (not a draft, not a pre-release).
|
||||
This works only if Gitea redirects `releases/latest/download/<file>` to the newest
|
||||
release.
|
||||
2. `https://gitea.euvino.eu/public/call-recorder/raw/branch/master/latest.json`:
|
||||
`latest.json` committed to the root of `master`.
|
||||
|
||||
```
|
||||
UPDATE_JSON_URL="${RELEASE_BASE_URL}/releases/latest/download/latest.json"
|
||||
→ https://gitea.euvino.eu/public/call-recorder/releases/latest/download/latest.json
|
||||
```
|
||||
Each release serves both:
|
||||
|
||||
Gitea has to redirect `releases/latest/download/<file>` to the newest release (not a
|
||||
draft, not a pre-release). That cannot be checked before the first release exists.
|
||||
Check it right after publishing the first release:
|
||||
- uploading the release assets covers URL 1 (step 7 below);
|
||||
- committing `latest.json` to the root of `master` covers URL 2 (step 8 below).
|
||||
|
||||
The endpoints are compiled into the app. Installed versions keep asking the URLs
|
||||
they were built with, which is why both are configured from the start.
|
||||
|
||||
After the first release, check which URL works:
|
||||
|
||||
```sh
|
||||
curl -sIL https://gitea.euvino.eu/public/call-recorder/releases/latest/download/latest.json
|
||||
curl -sIL https://gitea.euvino.eu/public/call-recorder/raw/branch/master/latest.json
|
||||
```
|
||||
|
||||
The final status must be `200`. If it is `404`, switch to B and release again.
|
||||
The final status of a working URL is `200`. Then:
|
||||
|
||||
**B: `latest.json` committed to `master`**
|
||||
- **URL 1 works:** a later version may drop URL 2 from `UPDATE_JSON_URLS`. Every
|
||||
installed version also asks URL 1, so step 8 is no longer needed.
|
||||
- **Only URL 2 works:** a later version may drop URL 1. Step 8 (committing
|
||||
`latest.json`) stays part of every release.
|
||||
|
||||
```
|
||||
UPDATE_JSON_URL="${RELEASE_BASE_URL}/raw/branch/master/latest.json"
|
||||
→ https://gitea.euvino.eu/public/call-recorder/raw/branch/master/latest.json
|
||||
```
|
||||
|
||||
Comment out the A line in `release.env` and uncomment the B line. As the last step of
|
||||
every release, commit `latest.json` to the repository root (step 8 below).
|
||||
Caveat: if URL 1 answered `200` with something that is not JSON (e.g. an HTML page),
|
||||
the updater would stop there instead of trying URL 2. Gitea answers a missing file
|
||||
with `404`, which falls through as intended.
|
||||
|
||||
## Releasing a version
|
||||
|
||||
@@ -105,7 +111,7 @@ installed one.
|
||||
- checks the key and password by signing a probe file, and stops if the key does
|
||||
not belong to `plugins.updater.pubkey`,
|
||||
- sets the version in `src-tauri/tauri.conf.json`, `src-tauri/Cargo.toml` and
|
||||
`ui/package.json` (the build updates `Cargo.lock` too), and writes the endpoint
|
||||
`ui/package.json` (the build updates `Cargo.lock` too), and writes the endpoints
|
||||
from `release.env` into `tauri.conf.json`,
|
||||
- builds the Windows installer (`scripts/build-windows.sh`), the `.deb` and the
|
||||
`.AppImage`, each with its `.sig`,
|
||||
@@ -145,7 +151,7 @@ installed one.
|
||||
7. Upload **every** file from `dist-release/0.1.1/` as a release asset, including the
|
||||
`.sig` files and `latest.json`. Keep the file names: `latest.json` points to them.
|
||||
|
||||
8. Option B only: once the assets are uploaded, publish the feed:
|
||||
8. Once the assets are uploaded, publish the feed for URL 2 as well:
|
||||
|
||||
```sh
|
||||
cp dist-release/0.1.1/latest.json latest.json
|
||||
@@ -158,10 +164,11 @@ installed one.
|
||||
|
||||
```sh
|
||||
curl -sL https://gitea.euvino.eu/public/call-recorder/releases/latest/download/latest.json | jq .
|
||||
curl -sL https://gitea.euvino.eu/public/call-recorder/raw/branch/master/latest.json | jq .
|
||||
```
|
||||
|
||||
(Option B: the `raw/branch/master/latest.json` URL.) It must show the new version,
|
||||
and the `url` entries must download.
|
||||
The URL(s) that work must show the new version, and the `url` entries must
|
||||
download.
|
||||
|
||||
## Checking an update on Windows 11
|
||||
|
||||
|
||||
Reference in New Issue
Block a user