Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Updates from inside the app, and saying plainly what Skykeep connects to

Yashwanth Kamireddi14ef834fce12
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 7dc0c99..c3a86bf 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -19,22 +19,37 @@ For anything bigger than a small fix, please open an issue or a [Discussion](htt
## Set up
-You need **Rust 1.85+** ([rustup](https://rustup.rs)), **Node.js 22** and the system libraries Tauri uses.
+You need **Rust** ([rustup](https://rustup.rs) installs the version `rust-toolchain.toml` pins), **Node.js 22** (20 or newer runs everything; Ubuntu 24.04's own Node 18 builds the app, but the Playwright suites need 20+), a C compiler and the system libraries Tauri uses.
```sh
-# Debian / Ubuntu
-sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev libsecret-1-dev \
- libheif-dev libfuse3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev pkg-config
+# Debian 13 / Ubuntu 24.04
+sudo apt install build-essential curl nodejs npm \
+ libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev libsecret-1-dev \
+ libheif-dev libfuse3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev pkg-config \
+ libayatana-appindicator3-dev
# Arch
-sudo pacman -S --needed webkit2gtk-4.1 gtk3 libsecret libheif gstreamer \
+sudo pacman -S --needed base-devel webkit2gtk-4.1 gtk3 libsecret libheif gstreamer \
gst-plugins-base-libs fuse3 rust nodejs npm pkgconf
# Fedora
-sudo dnf install webkit2gtk4.1-devel gtk3-devel librsvg2-devel libsecret-devel \
- libheif-devel fuse3-devel gstreamer1-devel gstreamer1-plugins-base-devel pkgconf-pkg-config
+sudo dnf install gcc gcc-c++ make nodejs npm \
+ webkit2gtk4.1-devel gtk3-devel librsvg2-devel libsecret-devel \
+ libheif-devel fuse3-devel gstreamer1-devel gstreamer1-plugins-base-devel pkgconf-pkg-config \
+ libayatana-appindicator-gtk3-devel
+
+# openSUSE Tumbleweed
+sudo zypper install gcc gcc-c++ make nodejs-default npm-default \
+ webkitgtk3-devel gtk3-devel librsvg-devel libsecret-devel \
+ libheif-devel fuse3-devel gstreamer-devel gstreamer-plugins-base-devel pkgconf-pkg-config \
+ libayatana-appindicator3-devel
```
+The appindicator package is only for `npx tauri build`, the installable packages: it is not
+linked (the Linux tray is ksni's), but tauri-cli sees the `tray-icon` feature the Windows and
+macOS builds ask for and stops with "Can't detect any appindicator library" without it.
+`./run.sh`, `cargo build` and `./check.sh` don't need it.
+
Then:
```sh
@@ -92,7 +107,7 @@ The Windows pipeline (the full test suite, every interface suite in Edge, the in
## Code map
```text
-crates/quince-auth/ Sign-in (Apple's SRP + two-factor), session, keyring, apple_only() allow-list
+crates/quince-auth/ Sign-in (Apple's SRP + two-factor), session, keyring, the network locks (apple_only, listed_only, releases_only)
crates/quince-icloud/ Each iCloud service: CloudKit, Notes (topotext CRDT, tables), Reminders,
Calendar, Contacts, Drive, Photos, push channel
crates/quince-core/ Local library (SQLite), sync, outbox, search, export
@@ -127,7 +142,7 @@ The crates keep the `quince-` prefix from the project's working name.
## Ground rules
-- **Privacy is the product.** Never add a network host, telemetry, analytics, crash reporting or an update check. Every client is built by `apple_only()` (or `listed_only()` for calendar subscriptions), and `crates/quince-auth/tests/apple_only.rs` must keep passing.
+- **Privacy is the product.** Never add a network host, telemetry, analytics or crash reporting. Every client is built by one of three locks in `quince-auth`: `apple_only()` for iCloud, `listed_only()` for calendar subscriptions, and `releases::releases_only()` for Skykeep's own updates (GitHub's release servers only). `crates/quince-auth/tests/apple_only.rs` must keep passing.
- **No personal data** in code, tests, fixtures, logs or screenshots: no real names, emails, phone numbers, note contents, account IDs or tokens. A pre-commit secret scan is a good idea; CI-safe test vectors use `example.invalid`.
- **Instant everywhere.** Every write shows immediately and rolls back with a reason on failure. Never block a redraw on the network.
- **Never lose data.** Merges keep both sides; deletes go to Recently Deleted where Apple has one.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index bbaf5b4..3072ded 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -24,6 +24,6 @@
## Checklist
- [ ] No personal data (real names, emails, notes, account IDs) in code, tests, fixtures or screenshots
-- [ ] No new network host: everything still goes through `apple_only()` (or `listed_only()` for subscriptions)
+- [ ] No new network host: everything still goes through `apple_only()` (or `listed_only()` for subscriptions, `releases_only()` for updates)
- [ ] User-facing text is short, positive and true, and never implies Apple affiliation
- [ ] Commit messages follow the style in [CONTRIBUTING.md](CONTRIBUTING.md#commit-style)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7b4e9c3..5383b74 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -120,7 +120,7 @@ jobs:
# sign-out, and an instant write in each app.
suites="csp a11y boundary signout notes-compose notes-instant reminders-add-done
reminders-instant calendar-edits contacts-select drive-nav photos settings
- search-everything"
+ search-everything updates"
failed=()
for t in $suites; do
if node ".uiverify/$t.mjs" >"$shots/$t.log" 2>&1; then
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e8eddad..f052258 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -8,6 +8,13 @@
# windows — the Windows pipeline (windows.yml): its tests, the .msi and .exe, the smoke test;
# publish — every file in one draft release with its checksums, for a person to read over
# and publish. Nothing is published by itself.
+#
+# The in-app updater (src-tauri/src/updates.rs) reads `latest.json` from the latest published
+# release. Each build signs what it can update — the AppImage, the .exe and the .msi — with
+# the TAURI_SIGNING_PRIVATE_KEY secret (createUpdaterArtifacts: a .sig beside each, with the
+# version signed into it); publish writes latest.json from those signatures. The .deb and .rpm
+# are updated by package managers, so they are not in it. A draft is invisible to the updater
+# until it is published.
name: Release
on:
@@ -23,6 +30,15 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
+ # The updater binds each signature to the version the program was built as, and
+ # latest.json names the tag's: they must be the same, or every update would be refused.
+ - name: The tag is the version built
+ run: |
+ built=$(node -p 'require("./src-tauri/tauri.conf.json").version')
+ if [ "v$built" != "$GITHUB_REF_NAME" ]; then
+ echo "::error::tag $GITHUB_REF_NAME, but tauri.conf.json says $built"
+ exit 1
+ fi
- name: Build dependencies
run: |
sudo apt-get update
@@ -43,10 +59,19 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: npm ci
- name: Build the packages
- # The build machine's paths are never written into the program.
+ # The build machine's paths are never written into the program. The AppImage is signed
+ # for the updater; the key is the release's own secret.
env:
RUSTFLAGS: --remap-path-prefix=${{ github.workspace }}=skykeep
- run: npx tauri build
+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
+ run: |
+ if [ -z "$TAURI_SIGNING_PRIVATE_KEY" ]; then
+ echo "::error::a release needs the TAURI_SIGNING_PRIVATE_KEY secret to sign its updates"
+ exit 1
+ fi
+ npx tauri build --config '{"bundle":{"createUpdaterArtifacts":true}}'
+ ls target/release/bundle/appimage/*.AppImage.sig
# One check for every package: the program is started headless with --background (no
# window is asked for unless sign-in needs one), on its own session bus, in an empty home,
# and must still be running 8 s later. `timeout` ending it (124) is the pass; any other
@@ -107,6 +132,7 @@ jobs:
target/release/bundle/deb/*.deb
target/release/bundle/rpm/*.rpm
target/release/bundle/appimage/*.AppImage
+ target/release/bundle/appimage/*.AppImage.sig
target/release/bundle/SHA256SUMS-linux.txt
if-no-files-found: error
@@ -114,6 +140,10 @@ jobs:
uses: ./.github/workflows/windows.yml
with:
test_first: true
+ updater: true
+ secrets:
+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
publish:
needs: [linux, windows]
@@ -121,13 +151,47 @@ jobs:
permissions:
contents: write
steps:
+ # For the tag's own message, which becomes the update's notes.
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 1
+ path: source
- uses: actions/download-artifact@v4
with:
path: dist
+ # What the in-app updater reads: the version, the tag's message as its notes, and for each
+ # kind of install that updates itself, where its file will be and its signature. The
+ # updater looks for `<os>-<arch>-<installer>`; with no plain `linux-x86_64`, a .deb or .rpm
+ # can never be handed the AppImage.
+ - name: The updater's latest.json
+ env:
+ REPO: ${{ github.repository }}
+ run: |
+ git -C source fetch --depth=1 origin "+refs/tags/$GITHUB_REF_NAME:refs/tags/$GITHUB_REF_NAME"
+ notes=$(git -C source tag -l --format='%(contents:subject)%0a%0a%(contents:body)' "$GITHUB_REF_NAME" | sed -e '/-----BEGIN PGP SIGNATURE-----/,$d')
+ one() { find dist -type f -name "$1" | head -n1; }
+ appimage=$(one '*.AppImage'); nsis=$(one '*-setup.exe'); msi=$(one '*.msi')
+ for f in "$appimage" "$nsis" "$msi"; do
+ if [ -z "$f" ] || [ ! -s "$f.sig" ]; then echo "::error::no signed updater file for '$f'"; exit 1; fi
+ done
+ base="https://github.com/$REPO/releases/download/$GITHUB_REF_NAME"
+ entry() { jq -n --arg url "$base/$(basename "$1")" --rawfile sig "$1.sig" '{url: $url, signature: ($sig | rtrimstr("\n"))}'; }
+ jq -n \
+ --arg version "${GITHUB_REF_NAME#v}" \
+ --arg notes "$notes" \
+ --arg date "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
+ --argjson appimage "$(entry "$appimage")" \
+ --argjson nsis "$(entry "$nsis")" \
+ --argjson msi "$(entry "$msi")" \
+ '{version: $version, notes: ($notes | gsub("^\\s+|\\s+$"; "")), pub_date: $date,
+ platforms: {"linux-x86_64-appimage": $appimage, "windows-x86_64-nsis": $nsis, "windows-x86_64-msi": $msi}}' \
+ > dist/latest.json
+ cat dist/latest.json
- name: A draft release with every file
env:
GH_TOKEN: ${{ github.token }}
run: |
- find dist -type f \( -name '*.deb' -o -name '*.rpm' -o -name '*.AppImage' -o -name '*.msi' -o -name '*-setup.exe' -o -name 'SHA256SUMS*' \) -print0 \
+ find dist -type f \( -name '*.deb' -o -name '*.rpm' -o -name '*.AppImage' -o -name '*.msi' -o -name '*-setup.exe' -o -name 'SHA256SUMS*' \
+ -o -name '*.AppImage.sig' -o -name '*.msi.sig' -o -name '*-setup.exe.sig' -o -name 'latest.json' \) -print0 \
| xargs -0 gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" \
--draft --verify-tag --title "Skykeep ${GITHUB_REF_NAME#v}" --generate-notes
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 31bb3a0..915d4fd 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -32,6 +32,15 @@ on:
edge_ui:
type: boolean
default: false
+ # A release: the installers signed for the in-app updater, each with its .sig.
+ updater:
+ type: boolean
+ default: false
+ secrets:
+ TAURI_SIGNING_PRIVATE_KEY:
+ required: false
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD:
+ required: false
permissions:
contents: read
@@ -88,10 +97,26 @@ jobs:
RUSTFLAGS: --remap-path-prefix=${{ github.workspace }}=skykeep
run: cargo test --release --workspace --lib --bins --tests --locked --no-fail-fast
- name: Build the installers
- # The build machine's paths are never written into the program.
+ # The build machine's paths are never written into the program. A release also signs
+ # the installers for the in-app updater (createUpdaterArtifacts: a .sig beside each);
+ # the key is the release's alone, so any other build makes the installers only.
+ shell: bash
env:
RUSTFLAGS: --remap-path-prefix=${{ github.workspace }}=skykeep
- run: npx tauri build
+ UPDATER: ${{ inputs.updater && 'yes' || '' }}
+ TAURI_SIGNING_PRIVATE_KEY: ${{ inputs.updater && secrets.TAURI_SIGNING_PRIVATE_KEY || '' }}
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ inputs.updater && secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD || '' }}
+ run: |
+ if [ -n "$UPDATER" ]; then
+ if [ -z "$TAURI_SIGNING_PRIVATE_KEY" ]; then
+ echo "::error::a release needs the TAURI_SIGNING_PRIVATE_KEY secret to sign its updates"
+ exit 1
+ fi
+ npx tauri build --config '{"bundle":{"createUpdaterArtifacts":true}}'
+ ls target/release/bundle/nsis/*-setup.exe.sig target/release/bundle/msi/*.msi.sig
+ else
+ npx tauri build
+ fi
- name: Checksums
shell: pwsh
run: |
@@ -104,6 +129,8 @@ jobs:
path: |
target/release/bundle/msi/*.msi
target/release/bundle/nsis/*.exe
+ target/release/bundle/msi/*.msi.sig
+ target/release/bundle/nsis/*.exe.sig
target/release/bundle/SHA256SUMS-windows.txt
if-no-files-found: error
diff --git a/.uiverify/a11y.mjs b/.uiverify/a11y.mjs
index 39c55f3..5925c54 100644
--- a/.uiverify/a11y.mjs
+++ b/.uiverify/a11y.mjs
@@ -120,6 +120,13 @@ const scenarios = [
await p.keyboard.type("cur");
await settle(p, 500);
}) },
+ // A new version offered (components/UpdateNotice), with its notes open.
+ { name: "update notice", ready: ".update-notice .update-notes[open]",
+ init: () => { window.__update = { version: "0.2.0", notes: "Faster Photos.\nCalendar fixes." }; },
+ act: async (p) => {
+ await p.locator(".update-notice summary").click();
+ await settle(p, 300);
+ } },
{ name: "narrow sidebar", ready: ".is-sidebar-open", viewport: { width: 800, height: 700 }, act: async (p) => {
await p.getByRole("button", { name: "Show Sidebar" }).click();
await settle(p, 500);
@@ -147,6 +154,7 @@ for (const mode of modes) {
...(mode.startsWith("more") ? { contrast: "more" } : {}),
});
await ctx.addInitScript(installStub, { screen: s.screen ?? "library", services: SERVICES, twoFactor: TWO_FACTOR, ...FIXTURES });
+ if (s.init) await ctx.addInitScript(s.init);
const page = await ctx.newPage();
const label = `${s.name} (${mode})`.padEnd(32);
try {
diff --git a/.uiverify/app-keys.mjs b/.uiverify/app-keys.mjs
index 3f444ae..51832aa 100644
--- a/.uiverify/app-keys.mjs
+++ b/.uiverify/app-keys.mjs
@@ -1,6 +1,7 @@
// Keys that work from any app: Ctrl+, opens Settings, Ctrl+/ the Keyboard Shortcuts sheet
// (the app in front listed first; Escape or Done closes it, and the keys go back where they
-// were). Settings sets Calendar's first day of the week and lists what Skykeep talks to.
+// were). Settings sets Calendar's first day of the week and lists what Skykeep talks to: Apple,
+// subscribed calendars, and GitHub's release servers for updates.
//
// BASE=http://localhost:4320 ENGINE=webkit node .uiverify/app-keys.mjs
import { engine, engineName } from "./engine.mjs";
@@ -49,6 +50,8 @@ for (const scheme of ["light", "dark"]) {
const text = await reach.first().innerText();
ok(/apple\.com/.test(text) && /icloud-content\.com/.test(text) && !/\.cn\b/.test(text) && !/China/.test(text), `${scheme}: Apple's domains are listed ${JSON.stringify(text.slice(0, 160))}`);
ok(text.includes("calendar.example.org"), `${scheme}: and each subscribed calendar's host`);
+ ok(/Updates/.test(text) && text.includes("github.com") && text.includes("release-assets.githubusercontent.com") && !text.includes("api.github.com"),
+ `${scheme}: and GitHub's release servers, for updates`);
// ── First Day of Week ──
const picker = page.getByRole("button", { name: /First Day of Week/ });
diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjs
index 7dbe6ec..02db99b 100644
--- a/.uiverify/stub.mjs
+++ b/.uiverify/stub.mjs
@@ -1040,7 +1040,48 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note
case "system_contrast": return window.__contrast ?? false;
// LC_TIME, LANG (appearance.rs): null leaves the engine's own language.
case "system_time_locale": return window.__timeLocale ?? null;
- case "network_reach": return { apple: ["apple.com", "icloud.com", "icloud-content.com"], subscribed: window.__reachSubscribed ?? [] };
+ case "network_reach": return { apple: ["apple.com", "icloud.com", "icloud-content.com"], subscribed: window.__reachSubscribed ?? [],
+ updates: (window.__update?.install ?? "here") === "here" ? ["github.com", "release-assets.githubusercontent.com", "objects.githubusercontent.com"] : [] };
+ // Skykeep's own updates (updates.rs). A test sets `window.__update` (an offer, an install
+ // kind); Update and Restart plays the download, then the wait (`__updateHold`: "changes"
+ // or "typing", lifted by setting it null), then installing. `__updateFail` fails the download.
+ case "update_status": case "update_check": case "update_apply": case "update_later":
+ case "update_auto_set": case "update_typing": {
+ const u = (window.__update ??= {});
+ const base = { install: "here", auto: true, current: "0.1.0", phase: "current", version: null, notes: null,
+ received: 0, total: null, waitingFor: null, problem: null, checkedAt: Math.floor(Date.now() / 1000) - 3600, prompt: false };
+ const st = (window.__updateState ??= { ...base, ...u, ...(u.version && !u.phase ? { phase: "available" } : {}) });
+ const tell = () => window.__emit?.("quince://update", null);
+ const shown = () => ({ ...st, prompt: ["available", "ready", "downloading", "waiting", "installing"].includes(st.phase) && !st.putOff
+ || (st.phase === "failed" && st.inNotice) });
+ (window.__updateCalls ??= []).push([cmd, args]);
+ if (cmd === "update_typing") { window.__typing = args.typing; return null; }
+ if (cmd === "update_auto_set") { st.auto = args.on; tell(); return null; }
+ if (cmd === "update_later") { st.putOff = true; if (st.phase === "downloading" || st.phase === "failed") st.phase = "available"; st.problem = null; tell(); return null; }
+ if (cmd === "update_check") {
+ if (st.install !== "here") throw "Updates come through your package manager.";
+ if (window.__updateCheckFail) { Object.assign(st, { phase: "failed", problem: window.__updateCheckFail, inNotice: false }); return shown(); }
+ if (window.__updateOffer) Object.assign(st, { phase: "available", putOff: false, ...window.__updateOffer });
+ else st.phase = "current";
+ st.checkedAt = Math.floor(Date.now() / 1000);
+ return shown();
+ }
+ if (cmd === "update_apply") {
+ st.putOff = false;
+ const step = (ms) => new Promise((r) => setTimeout(r, ms));
+ (async () => {
+ Object.assign(st, { phase: "downloading", received: 0, total: 1000, problem: null }); tell();
+ for (const n of [250, 600, 1000]) { await step(window.__updateStepMs ?? 150); st.received = n; tell(); }
+ if (window.__updateFail) { Object.assign(st, { phase: "failed", problem: window.__updateFail, inNotice: true }); tell(); return; }
+ while (window.__updateHold && !st.putOff) { Object.assign(st, { phase: "waiting", waitingFor: window.__updateHold }); tell(); await step(150); }
+ if (st.putOff) { st.phase = "ready"; tell(); return; }
+ Object.assign(st, { phase: "installing", waitingFor: null }); tell();
+ window.__restarted = true;
+ })();
+ return null;
+ }
+ return shown();
+ }
case "outbox_resend": case "outbox_discard": {
(window.__outboxCalls ??= []).push([cmd, args.id]);
if (window.__outbox) window.__outbox = { ...window.__outbox, refused: window.__outbox.refused.filter((r) => r.id !== args.id) };
diff --git a/.uiverify/updates.mjs b/.uiverify/updates.mjs
new file mode 100644
index 0000000..259c55f
--- /dev/null
+++ b/.uiverify/updates.mjs
@@ -0,0 +1,160 @@
+// Skykeep's own updates (src-tauri/src/updates.rs, components/UpdateNotice): a new version is
+// offered once, calmly, with its notes; Update and Restart shows the download's progress, says
+// what a restart waits for (changes not yet in iCloud, someone typing) and goes ahead once
+// clear; Later puts it away; a download that fails its signature says so and offers no retry.
+// Settings has Check for Updates Automatically and Check for Updates, and a copy installed by a
+// package manager says who updates it instead. Played against the stub (.uiverify/stub.mjs).
+//
+// BASE=http://localhost:4173 node .uiverify/updates.mjs
+import { engine, engineName } from "./engine.mjs";
+import { SERVICES, installStub } from "./stub.mjs";
+const BASE = process.env.BASE ?? process.env.URL ?? "http://localhost:4173";
+const b = await engine.launch();
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${engineName} ${m}`); if (!p) failures++; };
+
+async function open(update, extra = {}) {
+ const ctx = await b.newContext({ viewport: { width: 1180, height: 820 }, colorScheme: extra.scheme ?? "light" });
+ await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, notesFixture: true });
+ await ctx.addInitScript((u) => { window.__update = u; }, update);
+ const page = await ctx.newPage();
+ page.on("pageerror", (e) => ok(false, `page error: ${e.message}`));
+ await page.goto(BASE, { waitUntil: "networkidle" });
+ await page.waitForTimeout(300);
+ return { ctx, page };
+}
+const notice = (page) => page.locator(".update-notice");
+
+// ── An update is offered ──
+{
+ const { ctx, page } = await open({ version: "0.2.0", notes: "Faster Photos.\nCalendar fixes." });
+ const n = notice(page);
+ await n.waitFor({ timeout: 4000 });
+ const text = await n.innerText();
+ ok(/Skykeep 0\.2\.0 is available/.test(text), `the notice names the version ${JSON.stringify(text.slice(0, 60))}`);
+ ok((await n.count()) === 1, "one notice, not several");
+ const buttons = await n.getByRole("button").allInnerTexts();
+ ok(buttons.includes("Update and Restart") && buttons.includes("Later"), `it offers Update and Restart and Later ${JSON.stringify(buttons)}`);
+ ok(buttons.every((t) => !t.includes("…")), "no button ends in an ellipsis");
+ await n.getByText("What’s New").click();
+ ok((await n.locator(".update-notes-text").innerText()).includes("Calendar fixes."), "its release notes are a click away");
+
+ // Later: gone, and the backend is told.
+ await n.getByRole("button", { name: "Later" }).click();
+ await page.waitForTimeout(200);
+ ok((await notice(page).count()) === 0, "Later puts the notice away");
+ ok(await page.evaluate(() => window.__updateCalls.some(([c]) => c === "update_later")), "and the backend is told");
+ await ctx.close();
+}
+
+// ── Update and Restart: progress, a wait for unsent changes, then installing ──
+{
+ const { ctx, page } = await open({ version: "0.2.0" });
+ await page.evaluate(() => { window.__updateHold = "changes"; window.__updateStepMs = 300; });
+ const n = notice(page);
+ await n.waitFor();
+ await n.getByRole("button", { name: "Update and Restart" }).click();
+ await page.waitForFunction(() => document.querySelector(".update-notice [role=progressbar]"));
+ ok(/Downloading Skykeep 0\.2\.0/.test(await n.innerText()), "the download is said, with its progress");
+ await page.waitForFunction(() => /\d+%/.test(document.querySelector(".update-percent")?.textContent ?? ""));
+ ok(true, "the share downloaded is shown");
+ await page.waitForFunction(() => /reach iCloud/.test(document.querySelector(".update-notice")?.textContent ?? ""), null, { timeout: 5000 });
+ ok(true, "with changes not yet in iCloud, it says it waits for them");
+ ok(!(await page.evaluate(() => window.__restarted ?? false)), "and does not restart");
+ await page.evaluate(() => { window.__updateHold = "typing"; });
+ await page.waitForFunction(() => /finish typing/.test(document.querySelector(".update-notice")?.textContent ?? ""));
+ ok(true, "someone typing: it waits for them to finish");
+ await page.evaluate(() => { window.__updateHold = null; });
+ await page.waitForFunction(() => /Installing Skykeep 0\.2\.0/.test(document.querySelector(".update-notice")?.textContent ?? ""));
+ ok((await n.getByRole("button").count()) === 0, "once clear it installs, with nothing left to press");
+ ok(await page.evaluate(() => window.__restarted === true), "and restarts");
+ await ctx.close();
+}
+
+// ── Typing in this window is reported while an update is near ──
+{
+ const { ctx, page } = await open({ version: "0.2.0" });
+ await notice(page).waitFor();
+ await page.locator(".nav-item", { hasText: "Notes" }).click();
+ await page.locator(".notes").first().waitFor({ state: "attached" });
+ await page.waitForTimeout(300);
+ const field = page.locator("input, textarea, [contenteditable='true']").first();
+ await field.click();
+ await page.keyboard.type("abc");
+ await page.waitForTimeout(200);
+ ok(await page.evaluate(() => window.__typing === true), "typing in this window is told to the backend");
+ await ctx.close();
+}
+
+// ── A download that fails its signature ──
+{
+ const { ctx, page } = await open({ version: "0.2.0" });
+ await page.evaluate(() => {
+ window.__updateFail = "The download didn't match Skykeep's signature, so it wasn't installed. Your current version is unchanged.";
+ });
+ const n = notice(page);
+ await n.waitFor();
+ await n.getByRole("button", { name: "Update and Restart" }).click();
+ await page.waitForFunction(() => /signature/.test(document.querySelector(".update-notice")?.textContent ?? ""));
+ ok((await n.getAttribute("role")) === "alert", "a signature failure is said at once, as an alert");
+ const buttons = await n.getByRole("button").allInnerTexts();
+ ok(!buttons.includes("Try Again") && !buttons.includes("Update and Restart"), `and nothing offers to install it ${JSON.stringify(buttons)}`);
+ ok(!(await page.evaluate(() => window.__restarted ?? false)), "nothing was installed");
+ await ctx.close();
+}
+
+// ── Settings: the switch, Check for Updates, and what it finds ──
+for (const scheme of ["light", "dark"]) {
+ const { ctx, page } = await open({}, { scheme });
+ ok((await notice(page).count()) === 0, `${scheme}: up to date, no notice`);
+ await page.locator(".sidebar-account").click();
+ await page.locator(".settings").waitFor();
+ const group = page.getByRole("region", { name: "Software Update" });
+ await group.waitFor();
+ ok(/Skykeep 0\.1\.0 is up to date/.test(await group.innerText()), `${scheme}: Settings says it is up to date`);
+ const sw = group.getByRole("switch", { name: "Check for Updates Automatically" });
+ ok((await sw.getAttribute("aria-checked")) === "true", `${scheme}: checking automatically is on by default`);
+ await sw.click();
+ ok((await sw.getAttribute("aria-checked")) === "false", `${scheme}: and turns off at once`);
+ ok(await page.evaluate(() => window.__updateCalls.some(([c, a]) => c === "update_auto_set" && a.on === false)), `${scheme}: the backend keeps it`);
+
+ // A check that cannot reach GitHub says so plainly.
+ await page.evaluate(() => { window.__updateCheckFail = "Couldn't reach GitHub to check for updates. Check your connection and try again."; });
+ await group.getByRole("button", { name: "Check for Updates" }).click();
+ await page.waitForFunction(() => /Couldn't reach GitHub/.test(document.querySelector('[aria-label="Software Update"]')?.textContent ?? ""));
+ ok(true, `${scheme}: a failed check is said plainly`);
+
+ // One that finds a version offers it, here and in the notice.
+ await page.evaluate(() => { window.__updateCheckFail = null; window.__updateOffer = { version: "0.3.0" }; });
+ await group.getByRole("button", { name: "Check for Updates" }).click();
+ await page.waitForFunction(() => /0\.3\.0 is available/.test(document.querySelector('[aria-label="Software Update"]')?.textContent ?? ""));
+ ok(await group.getByRole("button", { name: "Update and Restart" }).isVisible(), `${scheme}: a found version can be installed from Settings`);
+ await page.evaluate(() => window.__emit?.("quince://update", null));
+ await notice(page).waitFor();
+ ok((await notice(page).count()) === 1, `${scheme}: and the notice offers it once`);
+
+ // What Skykeep talks to names GitHub's release servers, for updates.
+ const reach = await page.locator(".settings-reach").innerText();
+ ok(/Updates/.test(reach) && reach.includes("github.com") && reach.includes("release-assets.githubusercontent.com"), `${scheme}: GitHub's release servers are listed for updates`);
+ const note = await page.locator(".settings-note").innerText();
+ ok(/GitHub for its own updates/.test(note) && !/only to Apple/.test(note), `${scheme}: the footer says what Skykeep connects to ${JSON.stringify(note)}`);
+ await ctx.close();
+}
+
+// ── A copy a package manager installed: never offered a self-update ──
+{
+ const { ctx, page } = await open({ install: "packageManager" });
+ await page.locator(".sidebar-account").click();
+ const group = page.getByRole("region", { name: "Software Update" });
+ await group.waitFor();
+ const text = await group.innerText();
+ ok(/Updates come through your package manager/.test(text), "a packaged copy says its package manager updates it");
+ ok((await group.getByRole("button").count()) === 0 && (await group.getByRole("switch").count()) === 0, "with nothing to check or switch");
+ const reach = await page.locator(".settings-reach").innerText();
+ ok(!reach.includes("github.com"), "and lists no GitHub host, since it never contacts one");
+ ok((await notice(page).count()) === 0, "and shows no notice");
+ await ctx.close();
+}
+
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 6537030..99538be 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -18,7 +18,9 @@ Five crates sit under the app:
- **quince-auth** signs in (Apple's SRP and two-factor), keeps the session in the system keyring,
and builds every HTTP client. `apple_only()` refuses any host outside Apple's domains before a
- connection exists; `listed_only()` reaches only the calendars you subscribed to.
+ connection exists; `listed_only()` reaches only the calendars you subscribed to;
+ `releases::releases_only()` reaches only GitHub's release servers, for Skykeep's own updates
+ (`src-tauri/src/updates.rs`).
- **quince-icloud** speaks each service: CloudKit records for Notes, Reminders and Photos,
Apple's web APIs for Calendar, Contacts and Drive, and the push channel. It parses and writes;
it stores nothing.
diff --git a/Cargo.lock b/Cargo.lock
index 7685fd8..1b50a37 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -103,6 +103,15 @@ version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
+[[package]]
+name = "arbitrary"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed"
+dependencies = [
+ "derive_arbitrary",
+]
+
[[package]]
name = "arc-swap"
version = "1.9.3"
@@ -1025,6 +1034,17 @@ dependencies = [
"serde_core",
]
+[[package]]
+name = "derive_arbitrary"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 3.0.5",
+]
+
[[package]]
name = "derive_more"
version = "2.1.1"
@@ -1388,6 +1408,16 @@ dependencies = [
"rustc_version",
]
+[[package]]
+name = "filetime"
+version = "0.2.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"
+dependencies = [
+ "cfg-if",
+ "libc",
+]
+
[[package]]
name = "find-msvc-tools"
version = "0.1.12"
@@ -2290,9 +2320,11 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"socket2",
+ "system-configuration",
"tokio",
"tower-service",
"tracing",
+ "windows-registry",
]
[[package]]
@@ -2629,6 +2661,36 @@ dependencies = [
"windows-sys 0.45.0",
]
+[[package]]
+name = "jni"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498"
+dependencies = [
+ "cfg-if",
+ "combine",
+ "jni-macros",
+ "jni-sys 0.4.1",
+ "log",
+ "simd_cesu8",
+ "thiserror 2.0.20",
+ "walkdir",
+ "windows-link 0.2.1",
+]
+
+[[package]]
+name = "jni-macros"
+version = "0.22.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "rustc_version",
+ "simd_cesu8",
+ "syn 2.0.119",
+]
+
[[package]]
name = "jni-sys"
version = "0.3.1"
@@ -2951,6 +3013,12 @@ dependencies = [
"unicase",
]
+[[package]]
+name = "minisign-verify"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "871285dc19d8d0ebe0eef3d0e99a205f2a71363b122632cbbfa4a6c370a960ce"
+
[[package]]
name = "miniz_oxide"
version = "0.8.9"
@@ -3345,6 +3413,18 @@ dependencies = [
"objc2-core-foundation",
]
+[[package]]
+name = "objc2-osa-kit"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"
+dependencies = [
+ "bitflags 2.13.2",
+ "objc2",
+ "objc2-app-kit",
+ "objc2-foundation",
+]
+
[[package]]
name = "objc2-quartz-core"
version = "0.3.2"
@@ -3425,6 +3505,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "openssl-probe"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"
+
[[package]]
name = "option-ext"
version = "0.2.0"
@@ -3450,6 +3536,20 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "osakit"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"
+dependencies = [
+ "objc2",
+ "objc2-foundation",
+ "objc2-osa-kit",
+ "serde",
+ "serde_json",
+ "thiserror 2.0.20",
+]
+
[[package]]
name = "p256"
version = "0.13.2"
@@ -3871,6 +3971,7 @@ dependencies = [
"quince-media",
"quince-vfs",
"reqwest 0.12.28",
+ "semver",
"serde",
"serde_json",
"sha2",
@@ -3879,6 +3980,7 @@ dependencies = [
"tauri-plugin-dialog",
"tauri-plugin-opener",
"tauri-plugin-single-instance",
+ "tauri-plugin-updater",
"tauri-plugin-window-state",
"tauri-winrt-notification",
"tempfile",
@@ -3903,7 +4005,9 @@ dependencies = [
"pbkdf2",
"rand 0.9.5",
"reqwest 0.12.28",
+ "reqwest 0.13.5",
"reqwest_cookie_store",
+ "rustls",
"serde",
"serde_json",
"sha2",
@@ -4304,15 +4408,20 @@ dependencies = [
"http-body",
"http-body-util",
"hyper",
+ "hyper-rustls",
"hyper-util",
"js-sys",
"log",
"percent-encoding",
"pin-project-lite",
+ "rustls",
+ "rustls-pki-types",
+ "rustls-platform-verifier",
"serde",
"serde_json",
"sync_wrapper",
"tokio",
+ "tokio-rustls",
"tokio-util",
"tower",
"tower-http",
@@ -4461,6 +4570,18 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "rustls-native-certs"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4"
+dependencies = [
+ "openssl-probe",
+ "rustls-pki-types",
+ "schannel",
+ "security-framework 3.7.0",
+]
+
[[package]]
name = "rustls-pki-types"
version = "1.15.1"
@@ -4471,6 +4592,33 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "rustls-platform-verifier"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98"
+dependencies = [
+ "core-foundation 0.10.1",
+ "core-foundation-sys",
+ "jni 0.22.4",
+ "log",
+ "once_cell",
+ "rustls",
+ "rustls-native-certs",
+ "rustls-platform-verifier-android",
+ "rustls-webpki",
+ "security-framework 3.7.0",
+ "security-framework-sys",
+ "webpki-root-certs",
+ "windows-sys 0.61.2",
+]
+
+[[package]]
+name = "rustls-platform-verifier-android"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f"
+
[[package]]
name = "rustls-webpki"
version = "0.103.16"
@@ -4503,6 +4651,15 @@ dependencies = [
"winapi-util",
]
+[[package]]
+name = "schannel"
+version = "0.1.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "schemars"
version = "0.8.22"
@@ -4883,6 +5040,22 @@ version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
+[[package]]
+name = "simd_cesu8"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520"
+dependencies = [
+ "rustc_version",
+ "simdutf8",
+]
+
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
[[package]]
name = "siphasher"
version = "1.0.3"
@@ -5086,6 +5259,27 @@ dependencies = [
"syn 2.0.119",
]
+[[package]]
+name = "system-configuration"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
+dependencies = [
+ "bitflags 2.13.2",
+ "core-foundation 0.9.4",
+ "system-configuration-sys",
+]
+
+[[package]]
+name = "system-configuration-sys"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "system-deps"
version = "6.2.2"
@@ -5143,7 +5337,7 @@ dependencies = [
"gdkwayland-sys",
"gdkx11-sys",
"gtk",
- "jni",
+ "jni 0.21.1",
"libc",
"log",
"ndk",
@@ -5176,6 +5370,17 @@ dependencies = [
"syn 2.0.119",
]
+[[package]]
+name = "tar"
+version = "0.4.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
+dependencies = [
+ "filetime",
+ "libc",
+ "xattr",
+]
+
[[package]]
name = "target-lexicon"
version = "0.12.16"
@@ -5215,7 +5420,7 @@ dependencies = [
"heck 0.5.0",
"http",
"image",
- "jni",
+ "jni 0.21.1",
"libc",
"log",
"mime",
@@ -5409,6 +5614,40 @@ dependencies = [
"zbus 5.19.0",
]
+[[package]]
+name = "tauri-plugin-updater"
+version = "2.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7259989d4fe11b2bf51f7d671642249b1837c4ae2da1430dc713ae38f98ceeec"
+dependencies = [
+ "base64 0.22.1",
+ "dirs",
+ "flate2",
+ "futures-util",
+ "http",
+ "infer",
+ "libc",
+ "log",
+ "minisign-verify",
+ "osakit",
+ "percent-encoding",
+ "reqwest 0.13.5",
+ "rustls",
+ "semver",
+ "serde",
+ "serde_json",
+ "tar",
+ "tauri",
+ "tauri-plugin",
+ "tempfile",
+ "thiserror 2.0.20",
+ "time",
+ "tokio",
+ "url",
+ "windows-sys 0.61.2",
+ "zip",
+]
+
[[package]]
name = "tauri-plugin-window-state"
version = "2.5.0"
@@ -5434,7 +5673,7 @@ dependencies = [
"dpi",
"gtk",
"http",
- "jni",
+ "jni 0.21.1",
"objc2",
"objc2-ui-kit",
"objc2-web-kit",
@@ -5457,7 +5696,7 @@ checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f"
dependencies = [
"gtk",
"http",
- "jni",
+ "jni 0.21.1",
"log",
"objc2",
"objc2-app-kit",
@@ -6277,6 +6516,15 @@ dependencies = [
"system-deps 6.2.2",
]
+[[package]]
+name = "webpki-root-certs"
+version = "1.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "58ec80e73fd8baf57bf0d9615554c75348bda990d6d5bbeab964dd068319fecb"
+dependencies = [
+ "rustls-pki-types",
+]
+
[[package]]
name = "webpki-roots"
version = "0.26.11"
@@ -6521,6 +6769,17 @@ dependencies = [
"windows-link 0.2.1",
]
+[[package]]
+name = "windows-registry"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
+dependencies = [
+ "windows-link 0.2.1",
+ "windows-result 0.4.1",
+ "windows-strings 0.5.1",
+]
+
[[package]]
name = "windows-result"
version = "0.3.4"
@@ -6896,7 +7155,7 @@ dependencies = [
"gtk",
"http",
"javascriptcore-rs",
- "jni",
+ "jni 0.21.1",
"libc",
"ndk",
"objc2",
@@ -6943,6 +7202,16 @@ dependencies = [
"pkg-config",
]
+[[package]]
+name = "xattr"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"
+dependencies = [
+ "libc",
+ "rustix",
+]
+
[[package]]
name = "xdg-home"
version = "1.3.0"
@@ -7196,6 +7465,18 @@ dependencies = [
"syn 3.0.5",
]
+[[package]]
+name = "zip"
+version = "4.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"
+dependencies = [
+ "arbitrary",
+ "crc32fast",
+ "indexmap 2.14.2",
+ "memchr",
+]
+
[[package]]
name = "zlib-rs"
version = "0.6.7"
diff --git a/README.md b/README.md
index bc852b1..dcbd8f6 100644
--- a/README.md
+++ b/README.md
@@ -119,6 +119,18 @@ sudo apt install ./Skykeep_*_amd64.deb
sudo dnf install ./Skykeep-*.x86_64.rpm
```
+**openSUSE Tumbleweed**
+
+```sh
+sudo zypper install --allow-unsigned-rpm ./Skykeep-*.x86_64.rpm
+```
+
+<sub>Fedora and openSUSE leave the HEVC decoder out of their own repositories, so iPhone
+HEIC photos and HEVC videos need it from [RPM Fusion](https://rpmfusion.org/Howto/Multimedia)
+(Fedora: `ffmpeg` in place of `ffmpeg-free`, and `libheif-freeworld`) or
+[Packman](https://en.opensuse.org/Additional_package_repositories#Packman) (openSUSE:
+`libavcodec`, `libheif1` and `libde265` from Packman). Everything else works without it.</sub>
+
**Arch, CachyOS, EndeavourOS, Manjaro** <sub>coming to the AUR</sub>
```sh
@@ -131,6 +143,8 @@ paru -S skykeep-git # or: yay -S skykeep-git
chmod +x Skykeep_*_amd64.AppImage && ./Skykeep_*_amd64.AppImage
```
+**Staying up to date.** The Windows installer and the AppImage keep Skykeep current themselves: a new version appears as a notice, with **Update and Restart**, and installs only after it passes its signature check, once your changes have reached iCloud. The `.deb`, `.rpm`, AUR and Flatpak update through your package manager. **Settings ▸ Software Update** has **Check for Updates** and the daily automatic check.
+
<details>
<summary><b>Other ways to install</b></summary>
@@ -168,7 +182,7 @@ On Linux, your desktop may ask you to unlock its keyring the first time. That's
- **Local-first.** Your library lives on your computer, so every app opens instantly, even offline.
- **Your sign-in stays in your system keyring:** Secret Service (GNOME Keyring or KWallet) on Linux, Credential Manager on Windows. Two-factor sign-in is Apple's own.
-- **Talks only to Apple,** plus any calendars you subscribe to. No Skykeep account, no Skykeep server, no telemetry.
+- **Clear about what it connects to:** Apple for your iCloud, the calendars you subscribe to, and GitHub's release servers to check for new versions of Skykeep. Each has a connection of its own that can reach nothing else. No Skykeep account, no analytics.
- **Independent.** Skykeep is an open-source project, not affiliated with or endorsed by Apple.
The details, with the code behind each one, are in [SECURITY.md](SECURITY.md).
diff --git a/SECURITY.md b/SECURITY.md
index a6eb88e..12a72b6 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -7,7 +7,8 @@ serious one.
## What Skykeep talks to
-Apple, and to calendars you subscribe to — nothing else:
+Apple for your iCloud, the calendars you subscribe to, and GitHub's release servers for
+Skykeep's own updates:
- `idmsa.apple.com` — signing in (Apple's own SRP sign-in and two-factor codes).
- `setup.icloud.com`, `www.icloud.com` — opening the session and finding your services.
@@ -16,29 +17,46 @@ Apple, and to calendars you subscribe to — nothing else:
- `calendars.icloud.com` — Apple's public holiday calendars.
- The host of each calendar you subscribe to by address (Calendar ▸ + ▸ New Subscription),
and only once you have: a `webcal://` or `https://` address of a public calendar file.
-
-This is enforced, not only promised: every network client Skykeep makes is built by
-`quince_auth::apple_only()`, whose resolver refuses to look up any host outside `apple.com`,
-`icloud.com` and `icloud-content.com` — a request anywhere else
-fails before a connection exists. A URL that names an address instead of a host
-(`https://1.2.3.4/`) is never looked up, so each request's URL is checked too, a redirect's
-included: anything that is not Apple's by name (or this computer, `127.0.0.1`) is refused the
-same way. The test `crates/quince-auth/tests/apple_only.rs` holds it to that.
-
-A subscribed calendar is fetched by a separate client, `quince_auth::listed_only()`, built for
-each fetch with exactly the hosts of the addresses you subscribed to — the same two locks, a
-resolver that looks up no other name and a check of every request's URL and redirect, so it
-can reach those hosts and nothing else (`listed_tests` in `crates/quince-auth/src/lib.rs`).
-Apple's client is not widened by it. A new install subscribes to nothing, so until you add a
-subscription Skykeep contacts no host but Apple's. A subscription is read-only: nothing is
-ever sent to it but the request for its file, and no Apple data goes with that request.
-
-There are no Skykeep servers. There is no telemetry, analytics, crash reporting or update
-check. Nothing is sent anywhere but Apple (and the requests for the calendars you subscribe
-to), and only what is needed to show and change your
-own data. The window itself cannot reach the network at all: its content security policy
-(`src-tauri/tauri.conf.json`) lets it talk only to the app's own Rust side, which does all
-talking to Apple.
+- `github.com`, then `release-assets.githubusercontent.com` (or
+ `objects.githubusercontent.com`), where GitHub serves release files — only in a copy
+ installed from the AppImage, the Windows installer or the `.msi`, to check for a new version
+ of Skykeep and, when you choose **Update and Restart**, to download it. A `.deb`, `.rpm`,
+ AUR or Flatpak copy never contacts GitHub: its package manager updates it.
+
+Each of these is reached by a connection that can reach its own hosts and nothing else,
+enforced in code rather than promised:
+
+- **Apple.** Every iCloud client is built by `quince_auth::apple_only()`, whose resolver
+ refuses to look up any host outside `apple.com`, `icloud.com` and `icloud-content.com` — a
+ request anywhere else fails before a connection exists. A URL that names an address instead
+ of a host (`https://1.2.3.4/`) is never looked up, so each request's URL is checked too, a
+ redirect's included: anything that is not Apple's by name (or this computer, `127.0.0.1`)
+ is refused the same way. It cannot reach GitHub. `crates/quince-auth/tests/apple_only.rs`
+ holds it to that.
+- **Calendar subscriptions.** A subscribed calendar is fetched by `quince_auth::listed_only()`,
+ built for each fetch with exactly the hosts of the addresses you subscribed to — the same two
+ locks — so it can reach those hosts and nothing else (`listed_tests` in
+ `crates/quince-auth/src/lib.rs`). A subscription is read-only: nothing is sent to it but the
+ request for its file, and no Apple data goes with that request.
+- **Updates.** The updater's client is locked by `quince_auth::releases::releases_only()` to
+ the three GitHub hosts above, exactly (not `api.github.com`, not any other host under
+ them), over HTTPS only, by the same two locks (`crates/quince-auth/src/releases.rs`). It
+ cannot reach Apple. It asks for one file, `latest.json` from the latest release, and sends
+ nothing about you: no account, no identifier, nothing from your library. GitHub, like any
+ website, sees the request come from your network address, and counts downloads of release
+ files.
+
+An update is installed only if it passes its signature check: the updater verifies the
+download against Skykeep's public key (in `src-tauri/tauri.conf.json`) with minisign, and the
+version is signed into the signature, so an older release cannot be passed off as a newer
+one. Skykeep never installs an older version or a prerelease, and never restarts to install
+while a change is still on its way to iCloud or while you are typing. Checking automatically
+can be turned off in **Settings ▸ Software Update**.
+
+There are no Skykeep servers and no Skykeep account. There is no telemetry, analytics or crash
+reporting. The window itself cannot reach the network at all: its content security policy
+(`src-tauri/tauri.conf.json`) lets it talk only to the app's own Rust side, which does all the
+talking, and it is granted none of the updater plugin's commands.
Links you click in a note or an event open in your own browser, mail or map app; a photo's
place opens in this computer's own map app (a `geo:` link), never a website.
diff --git a/crates/quince-auth/Cargo.toml b/crates/quince-auth/Cargo.toml
index 0ebbe12..7efd318 100644
--- a/crates/quince-auth/Cargo.toml
+++ b/crates/quince-auth/Cargo.toml
@@ -22,6 +22,10 @@ cookie_store = { version = "0.21", features = ["serde_json"] }
thiserror = "2"
# Looking up Apple's hosts for the client's own resolver (AppleOnly).
tokio = { workspace = true, features = ["net"] }
+# The updater's client (releases.rs), locked like Apple's: the reqwest the Tauri updater plugin
+# is built on, with no TLS of its own — the plugin's (rustls on ring) is the one compiled.
+reqwest_releases = { package = "reqwest", version = "0.13", default-features = false, features = ["rustls-no-provider"] }
+rustls = { version = "0.23", default-features = false, features = ["ring", "std"] }
[dev-dependencies]
tokio = { workspace = true }
diff --git a/crates/quince-auth/src/lib.rs b/crates/quince-auth/src/lib.rs
index ef12c04..681ec10 100644
--- a/crates/quince-auth/src/lib.rs
+++ b/crates/quince-auth/src/lib.rs
@@ -21,6 +21,7 @@ macro_rules! quiet {
};
}
+pub mod releases;
pub mod session;
pub mod srp;
@@ -1130,8 +1131,9 @@ pub fn is_apple_host(host: &str) -> bool {
.any(|d| host == *d || host.ends_with(&format!(".{d}")))
}
-/// Every HTTP client Skykeep makes starts here: Apple's servers, and nothing else, can be
-/// reached at all (see [`AppleOnly`]).
+/// Every HTTP client Skykeep makes for iCloud starts here: Apple's servers, and nothing else,
+/// can be reached at all (see [`AppleOnly`]). The two other clients are just as narrow:
+/// [`listed_only`] for subscribed calendars and [`releases::releases_only`] for updates.
pub fn apple_only() -> reqwest::ClientBuilder {
let builder = HttpClient::builder()
.dns_resolver(Arc::new(AppleOnly))
@@ -1148,23 +1150,24 @@ pub fn apple_only() -> reqwest::ClientBuilder {
with_system_proxies(builder)
}
+/// The proxy the system names for `scheme` ("https" or "http"), from `HTTPS_PROXY` and the
+/// rest, if any.
+pub(crate) fn env_proxy(scheme: &str) -> Option<String> {
+ let names = if scheme == "https" {
+ ["HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy"]
+ } else {
+ ["HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"]
+ };
+ names
+ .iter()
+ .find_map(|n| std::env::var(n).ok().filter(|v| !v.trim().is_empty()))
+}
+
/// The system's own proxies (`HTTPS_PROXY` and the rest), put back after a refusing proxy has
/// turned them off.
fn with_system_proxies(mut builder: reqwest::ClientBuilder) -> reqwest::ClientBuilder {
- for (scheme, names) in [
- (
- "https",
- ["HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy"],
- ),
- (
- "http",
- ["HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"],
- ),
- ] {
- let Some(via) = names
- .iter()
- .find_map(|n| std::env::var(n).ok().filter(|v| !v.trim().is_empty()))
- else {
+ for scheme in ["https", "http"] {
+ let Some(via) = env_proxy(scheme) else {
continue;
};
let proxy =
@@ -1244,9 +1247,9 @@ fn url_is_apples(url: &reqwest::Url) -> bool {
}
}
-/// The one way Skykeep's client finds a server: a host that is not Apple's is never looked
-/// up, so no request can reach one — "talks only to Apple" is how the code works, not a promise
-/// about it. Apple's are looked up as the system looks up any name.
+/// The one way Apple's client finds a server: a host that is not Apple's is never looked up,
+/// so no request of Apple's client can reach one — how the code works, not a promise about it.
+/// Apple's are looked up as the system looks up any name.
struct AppleOnly;
impl reqwest::dns::Resolve for AppleOnly {
@@ -1255,7 +1258,7 @@ impl reqwest::dns::Resolve for AppleOnly {
Box::pin(async move {
if !is_apple_host(&host) {
let refused: Box<dyn std::error::Error + Send + Sync> =
- format!("{host} is not Apple's, and Skykeep talks only to Apple").into();
+ format!("{host} is not Apple's, and Apple's client reaches only Apple").into();
return Err(refused);
}
let found = tokio::net::lookup_host((host.as_str(), 0)).await?;
diff --git a/crates/quince-auth/src/releases.rs b/crates/quince-auth/src/releases.rs
new file mode 100644
index 0000000..169043d
--- /dev/null
+++ b/crates/quince-auth/src/releases.rs
@@ -0,0 +1,175 @@
+//! The updater's client: GitHub's release servers, and nothing else.
+//!
+//! Skykeep checks for a new version of itself and downloads it from the project's GitHub
+//! Releases. That client is built here, beside Apple's, with the same two locks: a resolver
+//! that looks up no other name, and a check of every request's own URL — a redirect's
+//! included — so an address in a URL, a proxy or a redirect cannot carry it anywhere else.
+//! Apple's client is not widened by it (it still refuses GitHub), and this one cannot reach
+//! Apple.
+//!
+//! It is built on the reqwest the Tauri updater plugin uses (0.13; Apple's is 0.12), since the
+//! plugin makes the requests and hands its client builder over to be locked
+//! (`UpdaterBuilder::configure_client`).
+
+use reqwest_releases as reqwest;
+use std::sync::Arc;
+
+/// Every host a release is fetched from. `latest.json` and each download are asked of
+/// `github.com`, which answers with a redirect to the file itself on GitHub's download host:
+/// `release-assets.githubusercontent.com` today (checked 2026-10-23 on a public release),
+/// `objects.githubusercontent.com` before it, kept because GitHub still sends some downloads
+/// there. `api.github.com` is not needed: the updater reads a file, not the API.
+pub const RELEASE_HOSTS: [&str; 3] = [
+ "github.com",
+ "release-assets.githubusercontent.com",
+ "objects.githubusercontent.com",
+];
+
+/// Where a request that is not GitHub's release servers is pointed: a name the resolver
+/// refuses, so it fails before anything leaves the machine.
+const REFUSED: &str = "http://refused.skykeep.invalid";
+
+/// Whether `host` is one of [`RELEASE_HOSTS`], exactly: no host under them, and no other.
+#[must_use]
+pub fn is_release_host(host: &str) -> bool {
+ let host = host.trim_end_matches('.').to_ascii_lowercase();
+ RELEASE_HOSTS.contains(&host.as_str())
+}
+
+/// Whether a request's URL may be sent: HTTPS, to a release host by name. Never an address,
+/// never this computer, never plain HTTP.
+#[must_use]
+pub fn url_is_release(url: &reqwest::Url) -> bool {
+ url.scheme() == "https"
+ && url.port_or_known_default() == Some(443)
+ // An address never matches a name in the list, so an address in a URL is refused.
+ && url.host_str().is_some_and(is_release_host)
+}
+
+/// Lock a client builder to GitHub's release servers. The updater plugin's own settings (its
+/// user agent, its timeout) are kept; what it can reach is narrowed to [`RELEASE_HOSTS`].
+pub fn releases_only(builder: reqwest::ClientBuilder) -> reqwest::ClientBuilder {
+ // The TLS the plugin is built with has no provider of its own; the plugin sets ring as
+ // the default before it builds a client, and so does this, for a client built here.
+ if rustls::crypto::CryptoProvider::get_default().is_none() {
+ let _ = rustls::crypto::ring::default_provider().install_default();
+ }
+ let mut builder = builder
+ .https_only(true)
+ .redirect(reqwest::redirect::Policy::limited(5))
+ .dns_resolver(Arc::new(ReleasesOnly))
+ // Checked for every request and every redirect: one that is not to a release host is
+ // sent to a "proxy" the resolver will not find, so the refusal reads the same.
+ .proxy(reqwest::Proxy::custom(|url| {
+ (!url_is_release(url)).then(|| REFUSED.to_string())
+ }));
+ // A proxy set above turns the system's off; the system's HTTPS proxy is put back for the
+ // release hosts, as Apple's client puts it back for Apple's.
+ if let Some(via) = crate::env_proxy("https") {
+ builder = builder.proxy(
+ reqwest::Proxy::custom(move |url| (url.scheme() == "https").then(|| via.clone()))
+ .no_proxy(reqwest::NoProxy::from_env()),
+ );
+ }
+ builder
+}
+
+/// The updater client's resolver: a release host is looked up as the system looks up any
+/// name; any other is never looked up at all.
+struct ReleasesOnly;
+
+impl reqwest::dns::Resolve for ReleasesOnly {
+ fn resolve(&self, name: reqwest::dns::Name) -> reqwest::dns::Resolving {
+ let host = name.as_str().to_string();
+ Box::pin(async move {
+ if !is_release_host(&host) {
+ let refused: Box<dyn std::error::Error + Send + Sync> = format!(
+ "{host} is not one of GitHub's release servers, so updates cannot reach it"
+ )
+ .into();
+ return Err(refused);
+ }
+ let found = tokio::net::lookup_host((host.as_str(), 0)).await?;
+ let addrs: reqwest::dns::Addrs = Box::new(found.collect::<Vec<_>>().into_iter());
+ Ok(addrs)
+ })
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn only_the_release_hosts_count() {
+ for ok in [
+ "github.com",
+ "GitHub.com.",
+ "release-assets.githubusercontent.com",
+ "objects.githubusercontent.com",
+ ] {
+ assert!(is_release_host(ok), "{ok}");
+ }
+ for no in [
+ "api.github.com",
+ "gist.github.com",
+ "raw.githubusercontent.com",
+ "githubusercontent.com",
+ "evil-github.com",
+ "github.com.evil.example",
+ "github.io",
+ "apple.com",
+ "setup.icloud.com",
+ "localhost",
+ "example.com",
+ ] {
+ assert!(!is_release_host(no), "{no}");
+ }
+ }
+
+ #[test]
+ fn a_url_must_be_https_to_a_release_host_by_name() {
+ let ok = |u: &str| url_is_release(&reqwest::Url::parse(u).unwrap());
+ assert!(ok(
+ "https://github.com/YashwanthKamireddi/Skykeep/releases/latest/download/latest.json"
+ ));
+ assert!(ok(
+ "https://release-assets.githubusercontent.com/github-production-release-asset/1/2"
+ ));
+ assert!(!ok("http://github.com/x"), "plain HTTP");
+ assert!(!ok("https://github.com:8443/x"), "another port");
+ assert!(!ok("https://140.82.112.3/x"), "an address, not a name");
+ assert!(!ok("https://[::1]/x"), "this computer");
+ assert!(!ok("https://localhost/x"), "this computer by name");
+ assert!(!ok("https://api.github.com/repos/x/y/releases"));
+ assert!(
+ !ok("https://www.icloud.com/"),
+ "Apple's hosts are not the updater's"
+ );
+ }
+
+ /// Refused before connecting: by name (the resolver), by address and by scheme (the URL
+ /// check). Nothing here reaches the network.
+ #[tokio::test]
+ async fn the_updater_client_refuses_everything_else() {
+ let http = releases_only(reqwest::Client::builder()).build().unwrap();
+ for url in [
+ "https://example.com/latest.json",
+ "https://www.icloud.com/",
+ "https://idmsa.apple.com/",
+ "https://93.184.215.14/latest.json",
+ "https://[2606:4700:4700::1111]/",
+ "http://github.com/latest.json",
+ "https://api.github.com/repos/x/y/releases/latest",
+ ] {
+ let err = http.get(url).send().await.expect_err(url);
+ let text = format!("{err:?}");
+ assert!(
+ text.contains("not one of GitHub's release servers")
+ || text.contains("refused.skykeep.invalid")
+ || text.contains("BadScheme"),
+ "{url} was not refused by the lock: {text}"
+ );
+ }
+ }
+}
diff --git a/crates/quince-auth/tests/apple_only.rs b/crates/quince-auth/tests/apple_only.rs
index a295986..9228f93 100644
--- a/crates/quince-auth/tests/apple_only.rs
+++ b/crates/quince-auth/tests/apple_only.rs
@@ -1,5 +1,5 @@
-//! Skykeep talks only to Apple, by construction: the client cannot resolve, so cannot reach,
-//! any host that is not Apple's.
+//! Apple's client reaches only Apple, by construction: it cannot resolve, so cannot reach, any
+//! host that is not Apple's — GitHub's release servers, which the updater uses, included.
#[test]
fn only_apples_hosts_count_as_apples() {
@@ -23,6 +23,9 @@ fn only_apples_hosts_count_as_apples() {
"evilicloud.com",
"tile.openstreetmap.org",
"setup.icloud.com.cn",
+ "github.com",
+ "release-assets.githubusercontent.com",
+ "objects.githubusercontent.com",
] {
assert!(!is_apple_host(no), "{no}");
}
@@ -31,16 +34,46 @@ fn only_apples_hosts_count_as_apples() {
#[tokio::test(flavor = "multi_thread")]
async fn a_client_refuses_anything_but_apple_before_connecting() {
let client = quince_auth::apple_only().build().unwrap();
- let err = client
- .get("https://example.com/")
- .send()
- .await
- .expect_err("a request to a host that is not Apple's");
- let said = format!("{err:?}");
- assert!(
- said.contains("Skykeep talks only to Apple"),
- "refused by the resolver, not the network: {said}"
- );
+ // GitHub's release servers are the updater's own client's, never Apple's.
+ for url in [
+ "https://example.com/",
+ "https://github.com/YashwanthKamireddi/Skykeep/releases/latest/download/latest.json",
+ "https://release-assets.githubusercontent.com/github-production-release-asset/1/2",
+ "https://objects.githubusercontent.com/x",
+ ] {
+ let err = client
+ .get(url)
+ .send()
+ .await
+ .expect_err("a request to a host that is not Apple's");
+ let said = format!("{err:?}");
+ assert!(
+ said.contains("Apple's client reaches only Apple"),
+ "{url}: refused by the resolver, not the network: {said}"
+ );
+ }
+}
+
+/// And the other way round: the updater's client cannot reach Apple.
+#[tokio::test(flavor = "multi_thread")]
+async fn the_updater_client_cannot_reach_apple() {
+ use quince_auth::releases::{is_release_host, releases_only};
+ for host in quince_auth::APPLE_DOMAINS {
+ assert!(!is_release_host(host), "{host}");
+ }
+ let client = releases_only(reqwest_releases::Client::builder())
+ .build()
+ .unwrap();
+ for url in [
+ "https://www.icloud.com/",
+ "https://idmsa.apple.com/appleauth",
+ ] {
+ let err = client.get(url).send().await.expect_err(url);
+ assert!(
+ format!("{err:?}").contains("not one of GitHub's release servers"),
+ "{url}: {err:?}"
+ );
+ }
}
/// An address in the URL is never looked up, so the resolver alone let it through: the URL
@@ -57,7 +90,7 @@ async fn an_address_is_refused_as_a_name_is() {
] {
let err = client.get(url).send().await.expect_err(url);
assert!(
- format!("{err:?}").contains("Skykeep talks only to Apple"),
+ format!("{err:?}").contains("Apple's client reaches only Apple"),
"{url}: {err:?}"
);
}
@@ -74,7 +107,6 @@ async fn an_address_is_refused_as_a_name_is() {
let ok = client.get(format!("{}/ok", server.uri())).send().await;
assert_eq!(ok.unwrap().status(), 200);
let away = client.get(format!("{}/away", server.uri())).send().await;
- assert!(
- format!("{:?}", away.expect_err("redirected away")).contains("Skykeep talks only to Apple")
- );
+ assert!(format!("{:?}", away.expect_err("redirected away"))
+ .contains("Apple's client reaches only Apple"));
}
diff --git a/packaging/flatpak/io.github.yashwanthkamireddi.Skykeep.metainfo.xml b/packaging/flatpak/io.github.yashwanthkamireddi.Skykeep.metainfo.xml
index 6a2695e..a659012 100644
--- a/packaging/flatpak/io.github.yashwanthkamireddi.Skykeep.metainfo.xml
+++ b/packaging/flatpak/io.github.yashwanthkamireddi.Skykeep.metainfo.xml
@@ -26,8 +26,9 @@
</p>
<p>
Sign in once with your Apple Account. Your password stays on this computer, in your
- system keyring. Skykeep talks only to Apple and to calendars you subscribe to: there is
- no Skykeep account, no Skykeep server and no telemetry.
+ system keyring. Skykeep connects to Apple for your iCloud and to the calendars you
+ subscribe to, and Flatpak keeps it up to date. There is no Skykeep account and no
+ analytics.
</p>
<p>
Skykeep is an independent, open-source project. It is not made by, endorsed by, or
diff --git a/packaging/io.github.yashwanthkamireddi.Skykeep.metainfo.xml b/packaging/io.github.yashwanthkamireddi.Skykeep.metainfo.xml
index 1d1f150..81c0d82 100644
--- a/packaging/io.github.yashwanthkamireddi.Skykeep.metainfo.xml
+++ b/packaging/io.github.yashwanthkamireddi.Skykeep.metainfo.xml
@@ -24,8 +24,9 @@
</p>
<p>
Sign in once with your Apple Account. Your password stays on this computer, in your
- system keyring. Skykeep talks only to Apple and to calendars you subscribe to: there is
- no Skykeep account, no Skykeep server and no telemetry.
+ system keyring. Skykeep connects to Apple for your iCloud and to the calendars you
+ subscribe to; the AppImage also checks GitHub for new versions of Skykeep. There is no
+ Skykeep account and no analytics.
</p>
<p>
Skykeep is an independent, open-source project. It is not made by, endorsed by, or
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index ede8bc3..084bdbf 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -34,6 +34,11 @@ notify-rust = "4"
tauri-plugin-single-instance = "2"
libc = "0.2"
tauri-plugin-window-state = "2"
+# Skykeep's own updates (updates.rs), from GitHub Releases. Held to one minor version: its HTTP
+# client is handed to quince_auth::releases to be locked, and the plugin may move to another
+# reqwest in a minor release.
+tauri-plugin-updater = "~2.14"
+semver = "1"
# A merged card's picture made small enough for Apple (contacts_merge.rs): the same build of
# the crate quince-media already uses, so nothing new is compiled.
image = { version = "0.25", default-features = false, features = ["png", "jpeg"] }
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json
index 5973b6d..1248d6e 100644
--- a/src-tauri/capabilities/default.json
+++ b/src-tauri/capabilities/default.json
@@ -1,7 +1,7 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
- "description": "What the window's own page may ask of Tauri itself, and no more: hearing the engine's events (and the webview's dropped files), the app's version for Settings, and a window's title. Open and save dialogs are shown by Skykeep's own commands (grants.rs), so only a file the person chose can reach a command that reads or writes one. Skykeep's own commands are separate. These windows only ever load the app's bundled page (no remote URL is granted anything).",
+ "description": "What the window's own page may ask of Tauri itself, and no more: hearing the engine's events (and the webview's dropped files), the app's version for Settings, and a window's title. Open and save dialogs are shown by Skykeep's own commands (grants.rs), so only a file the person chose can reach a command that reads or writes one. Skykeep's own commands are separate. None of the updater plugin's commands are granted: updates are driven from Rust (updates.rs). These windows only ever load the app's bundled page (no remote URL is granted anything).",
"windows": [
"main",
"app-*",
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 5af0cbc..1cea360 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -51,6 +51,7 @@ mod settings;
#[cfg(windows)]
mod taskbar;
mod timing;
+mod updates;
mod video;
use quince_auth::{Client, SignInOutcome, TwoFactorOptions};
@@ -2074,16 +2075,19 @@ fn save_subscriptions(
}
/// What Skykeep can reach, for Settings: Apple's domains as the network lock holds them
-/// (`quince_auth::APPLE_DOMAINS`, the list the resolver checks), and the host of each calendar
-/// subscribed to, which only its own client can reach.
+/// (`quince_auth::APPLE_DOMAINS`, the list the resolver checks), the host of each calendar
+/// subscribed to, which only its own client can reach, and GitHub's release servers, which
+/// only the updater's client can reach (`quince_auth::releases::RELEASE_HOSTS`) — listed only
+/// for a copy that updates itself, since no other ever contacts them.
#[derive(serde::Serialize)]
struct Reach {
apple: Vec<&'static str>,
subscribed: Vec<String>,
+ updates: Vec<&'static str>,
}
#[tauri::command]
-async fn network_reach(feeds: State<'_, Feeds>) -> UiResult<Reach> {
+async fn network_reach(app: tauri::AppHandle, feeds: State<'_, Feeds>) -> UiResult<Reach> {
let mut subscribed: Vec<String> = feeds
.subs
.lock()
@@ -2096,6 +2100,11 @@ async fn network_reach(feeds: State<'_, Feeds>) -> UiResult<Reach> {
Ok(Reach {
apple: quince_auth::APPLE_DOMAINS.to_vec(),
subscribed,
+ updates: if updates::this_install(&app) == updates::Install::Here {
+ quince_auth::releases::RELEASE_HOSTS.to_vec()
+ } else {
+ Vec::new()
+ },
})
}
@@ -5137,6 +5146,14 @@ static LAUNCHED_AS_APP: AtomicBool = AtomicBool::new(false);
/// library the moment it is made (SQLite commits as it goes), and what waits to be sent is
/// written down as it waits.
fn shutdown(app: &tauri::AppHandle, code: i32) -> ! {
+ wind_down(app);
+ // SAFETY: ends the process at once; nothing after it runs.
+ unsafe { libc::_exit(code) }
+}
+
+/// What ending Skykeep does first, however it ends — Quit, a signal, or an update restarting
+/// it: once, however many of them arrive.
+fn wind_down(app: &tauri::AppHandle) {
static ENDING: AtomicBool = AtomicBool::new(false);
if !ENDING.swap(true, Ordering::SeqCst) {
// Where each window was, kept before the quick exit below skips the usual teardown.
@@ -5150,8 +5167,6 @@ fn shutdown(app: &tauri::AppHandle, code: i32) -> ! {
cpu::stop();
mount::release_within(Duration::from_secs(3));
}
- // SAFETY: ends the process at once; nothing after it runs.
- unsafe { libc::_exit(code) }
}
/// What is kept of a window between runs: its size, place and maximised state — never whether
@@ -5618,6 +5633,9 @@ fn build_tray(app: &tauri::App) -> tauri::Result<()> {
}
fn main() {
+ // Started by an update: the version it replaced finishes exiting first, so this launch is
+ // not handed to it as a second one (single instance, below).
+ updates::after_update();
timing::start();
login::note_launch();
steady_drawing();
@@ -5674,6 +5692,9 @@ fn main() {
)
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_opener::init())
+ // Skykeep's own updates (updates.rs). Driven from Rust only: the window is granted none
+ // of the plugin's commands (capabilities/default.json).
+ .plugin(tauri_plugin_updater::Builder::new().build())
// The window shows Quince and nothing else. A link to anywhere outside it — a phone
// number, an address, a web page in a note or an event — goes to the app this
// computer uses for it. Followed in place, a `tel:` link replaced the whole window
@@ -5720,6 +5741,10 @@ fn main() {
if let tauri::WindowEvent::DragDrop(drop) = event {
grants::dropped(drop);
}
+ // A window gone for good: the update notice, if it showed it, moves to another.
+ if let tauri::WindowEvent::Destroyed = event {
+ updates::put_away(window.app_handle(), window.label());
+ }
// Coming back to a window is when a change made elsewhere is looked for at once.
if let tauri::WindowEvent::Focused(true) = event {
push::wake();
@@ -5738,10 +5763,12 @@ fn main() {
// drawn. Remade on demand it took about half a second, which the founder
// asked to be gone; keeping its web view costs about 190 MB in the tray.
window.hide().ok();
+ updates::put_away(window.app_handle(), window.label());
} else if window.label().starts_with("app-") {
api.prevent_close();
window.hide().ok();
apps::put_away(window);
+ updates::put_away(window.app_handle(), window.label());
}
}
})
@@ -5923,6 +5950,12 @@ fn main() {
// its task died, and nothing waiting was sent all session.
outbox::start(app.handle().clone());
appearance::watch(app.handle().clone());
+ // Skykeep's own updates: how it was installed decides whether it updates itself.
+ app.manage(updates::Updates::new(
+ updates::this_install(app.handle()),
+ &updates::load_prefs(app.handle()),
+ ));
+ updates::spawn(app.handle().clone());
// A photo cache past what this computer can spare now — the disk filled since —
// is brought back under its budget first thing.
let trim = app.handle().clone();
@@ -6042,6 +6075,12 @@ fn main() {
appearance::system_contrast,
appearance::system_time_locale,
network_reach,
+ updates::update_status,
+ updates::update_check,
+ updates::update_apply,
+ updates::update_later,
+ updates::update_auto_set,
+ updates::update_typing,
auth_status,
auth_resume,
auth_sign_in,
diff --git a/src-tauri/src/updates.rs b/src-tauri/src/updates.rs
new file mode 100644
index 0000000..e40ba6a
--- /dev/null
+++ b/src-tauri/src/updates.rs
@@ -0,0 +1,1151 @@
+//! Skykeep's own updates, from the project's GitHub Releases.
+//!
+//! Only a copy installed from the AppImage, the Windows installer (.exe) or the .msi updates
+//! itself. A .deb, an .rpm, the AUR, a distribution's own package or the Flatpak is updated by
+//! its package manager and is never offered an update here ([`install_kind`]).
+//!
+//! Shortly after launch, and about once a day after that, the latest release's `latest.json`
+//! is read through a client that can reach GitHub's release servers and nothing else
+//! (`quince_auth::releases`). A newer version is offered in one window, never in several. It
+//! is downloaded only when the person asks, verified against Skykeep's public key by the
+//! updater plugin (a minisign signature with the version signed into it, so an older release
+//! cannot be passed off as a newer one), and installed only once nothing is waiting to reach
+//! iCloud and nobody is typing. Then Skykeep restarts into it.
+//!
+//! A check made on its own that fails (offline, GitHub busy) is never said. One asked for in
+//! Settings is, plainly. A download that fails its signature is never installed, and says so.
+
+use serde::Serialize;
+use std::collections::HashMap;
+use std::path::{Path, PathBuf};
+use std::sync::{Mutex, MutexGuard};
+use std::time::{Duration, Instant};
+use tauri::utils::config::BundleType;
+use tauri::{AppHandle, Emitter, Manager};
+use tauri_plugin_updater::{Error, Update, UpdaterExt};
+
+/// Told to every window when anything here changes; each asks for its own [`Status`] again.
+pub const CHANGED: &str = "quince://update";
+
+/// The first check, after launch: late enough not to compete with the library opening.
+const FIRST_CHECK: Duration = Duration::from_secs(45);
+/// Then about once a day, counted on the wall clock so a night asleep counts.
+const EVERY_SECS: i64 = 24 * 60 * 60;
+/// After a check that failed by itself: again in a few hours, never sooner.
+const AFTER_FAILURE_SECS: i64 = 3 * 60 * 60;
+/// How often the schedule looks at the clock.
+const TICK: Duration = Duration::from_secs(10 * 60);
+/// A window's "someone is typing" lasts this long unless it is said again.
+const TYPING_LASTS: Duration = Duration::from_secs(15);
+/// After a download, a moment for every window to say whether it is being typed in.
+const SETTLE: Duration = Duration::from_millis(1500);
+/// How often a waiting restart looks again.
+const WAIT_STEP: Duration = Duration::from_secs(2);
+
+/// How this copy of Skykeep was installed, which decides who updates it.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub enum Install {
+ /// The AppImage, the Windows installer or the .msi: updated here.
+ Here,
+ /// A .deb, an .rpm, the AUR or a distribution's package: its package manager updates it.
+ PackageManager,
+ /// Flatpak updates it.
+ Flatpak,
+ /// A development build, run from the source.
+ Development,
+ /// Anything else, such as a program copied by hand: nothing here can replace it safely.
+ Manual,
+}
+
+/// Who updates this copy. `bundle` is what Tauri's bundler wrote into the program when it
+/// packaged it (none for a `cargo build`, which is how the AUR and the Flatpak build it);
+/// `appimage` whether it runs as an AppImage now, which is the file the update replaces.
+pub fn install_kind(
+ os: &str,
+ bundle: Option<BundleType>,
+ appimage: bool,
+ flatpak: bool,
+ debug: bool,
+) -> Install {
+ if debug {
+ return Install::Development;
+ }
+ if flatpak {
+ return Install::Flatpak;
+ }
+ match (os, bundle) {
+ ("linux", Some(BundleType::AppImage)) if appimage => Install::Here,
+ // Packaged as an AppImage but not run as one (extracted by hand): no file to replace.
+ ("linux", Some(BundleType::AppImage)) => Install::Manual,
+ ("linux", _) => Install::PackageManager,
+ ("windows", Some(BundleType::Nsis | BundleType::Msi)) => Install::Here,
+ _ => Install::Manual,
+ }
+}
+
+/// This copy's [`Install`].
+pub fn this_install(app: &AppHandle) -> Install {
+ #[cfg(target_os = "linux")]
+ let appimage = app.env().appimage.is_some();
+ #[cfg(not(target_os = "linux"))]
+ let appimage = {
+ let _ = app;
+ false
+ };
+ let flatpak = std::env::var_os("FLATPAK_ID").is_some() || Path::new("/.flatpak-info").exists();
+ install_kind(
+ std::env::consts::OS,
+ tauri::utils::platform::bundle_type(),
+ appimage,
+ flatpak,
+ cfg!(debug_assertions),
+ )
+}
+
+/// Whether `offered` is an update to `current`: newer, and a full release. Never a downgrade,
+/// never the same version again, never a prerelease (there is no prerelease channel).
+pub fn is_update(current: &semver::Version, offered: &semver::Version) -> bool {
+ offered.pre.is_empty() && offered > current
+}
+
+/// What a downloaded update is waiting for before Skykeep restarts to install it.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub enum Hold {
+ /// Changes, photos or Drive files that have not reached iCloud yet.
+ Changes,
+ /// Someone is typing in a window.
+ Typing,
+}
+
+/// Whether Skykeep may restart now, and if not, why. Never while anything made here is still on
+/// its way to iCloud — the outbox's changes, photos being uploaded, files written in the Drive
+/// folder — and never while someone is typing.
+pub fn hold(changes: usize, uploads: usize, files: usize, typing: bool) -> Option<Hold> {
+ if changes > 0 || uploads > 0 || files > 0 {
+ Some(Hold::Changes)
+ } else if typing {
+ Some(Hold::Typing)
+ } else {
+ None
+ }
+}
+
+/// Which window shows the update notice: the one already showing it while it is on screen, or
+/// else the window asking, if it is on screen. Never two at once.
+pub fn claim(
+ holder: Option<&str>,
+ holder_shown: bool,
+ asker: &str,
+ asker_shown: bool,
+) -> Option<String> {
+ match holder {
+ Some(h) if h == asker || holder_shown => Some(h.to_string()),
+ _ if asker_shown => Some(asker.to_string()),
+ _ => None,
+ }
+}
+
+/// Where things went wrong, for saying what it means.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum Stage {
+ Check,
+ Download,
+ Install,
+}
+
+/// Whether an error is the signature refusing the download.
+pub fn is_signature(e: &Error) -> bool {
+ matches!(
+ e,
+ Error::Minisign(_)
+ | Error::Base64(_)
+ | Error::SignatureUtf8(_)
+ | Error::SignedVersionMismatch { .. }
+ | Error::MissingSignedVersion
+ )
+}
+
+/// What went wrong, said plainly: never the library's own words, which name nothing the
+/// person can act on.
+pub fn problem(stage: Stage, e: &Error) -> String {
+ if is_signature(e) {
+ return "The download didn't match Skykeep's signature, so it wasn't installed. \
+ Your current version is unchanged."
+ .into();
+ }
+ match (stage, e) {
+ (Stage::Check, Error::Reqwest(_)) => {
+ "Couldn't reach GitHub to check for updates. Check your connection and try again."
+ .into()
+ }
+ (Stage::Check, Error::ReleaseNotFound | Error::Network(_)) => {
+ "GitHub didn't answer just now. Try again later.".into()
+ }
+ (Stage::Check, _) => "Couldn't read the update information. Try again later.".into(),
+ (Stage::Download, _) => {
+ "The download didn't finish. Nothing was changed, so you can try again.".into()
+ }
+ (Stage::Install, Error::PreviousAppNotRestored(_)) => {
+ "The update couldn't be installed. Download Skykeep again from its releases page."
+ .into()
+ }
+ (Stage::Install, _) => {
+ "The update couldn't be installed. Your current version is unchanged.".into()
+ }
+ }
+}
+
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+enum Phase {
+ #[default]
+ Idle,
+ Checking,
+ /// Checked: no newer version.
+ Current,
+ /// A newer version, not downloaded.
+ Available,
+ Downloading,
+ /// Downloaded and verified, kept for when the person says.
+ Ready,
+ /// Downloaded and verified, waiting for a moment it can restart.
+ Waiting(Hold),
+ Installing,
+ /// `notice`: said in the update notice (it came of Update and Restart), not only Settings.
+ Failed {
+ notice: bool,
+ },
+}
+
+impl Phase {
+ fn name(self) -> &'static str {
+ match self {
+ Phase::Idle => "idle",
+ Phase::Checking => "checking",
+ Phase::Current => "current",
+ Phase::Available => "available",
+ Phase::Downloading => "downloading",
+ Phase::Ready => "ready",
+ Phase::Waiting(_) => "waiting",
+ Phase::Installing => "installing",
+ Phase::Failed { .. } => "failed",
+ }
+ }
+
+ /// Whether Update and Restart is under way.
+ fn applying(self) -> bool {
+ matches!(
+ self,
+ Phase::Downloading | Phase::Waiting(_) | Phase::Installing
+ )
+ }
+}
+
+/// The updater's state, shared by every window.
+pub struct Updates(Mutex<Inner>);
+
+struct Inner {
+ install: Install,
+ auto: bool,
+ phase: Phase,
+ update: Option<Update>,
+ /// The verified download on disk, kept across a restart.
+ staged: Option<PathBuf>,
+ received: u64,
+ total: Option<u64>,
+ problem: Option<String>,
+ checked_at: Option<i64>,
+ /// The version Later was chosen for: not offered again until the next check finds it.
+ put_off: Option<String>,
+ /// A version whose download failed its signature: never offered again in this run.
+ refused: Option<String>,
+ /// The window showing the notice.
+ holder: Option<String>,
+ /// Each window being typed in, and when it last said so.
+ typing: HashMap<String, Instant>,
+ /// Which Update and Restart is current; Later moves it on, ending a wait.
+ attempt: u64,
+}
+
+impl Updates {
+ pub fn new(install: Install, prefs: &Prefs) -> Self {
+ Self(Mutex::new(Inner {
+ install,
+ auto: prefs.auto,
+ phase: Phase::Idle,
+ update: None,
+ staged: None,
+ received: 0,
+ total: None,
+ problem: None,
+ checked_at: prefs.checked_at,
+ put_off: None,
+ refused: None,
+ holder: None,
+ typing: HashMap::new(),
+ attempt: 0,
+ }))
+ }
+
+ fn lock(&self) -> MutexGuard<'_, Inner> {
+ self.0
+ .lock()
+ .unwrap_or_else(std::sync::PoisonError::into_inner)
+ }
+}
+
+/// What a window shows of the updater: in Settings, and (when `prompt`) as its notice.
+#[derive(Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Status {
+ install: Install,
+ auto: bool,
+ current: String,
+ phase: &'static str,
+ version: Option<String>,
+ notes: Option<String>,
+ received: u64,
+ total: Option<u64>,
+ waiting_for: Option<Hold>,
+ problem: Option<String>,
+ checked_at: Option<i64>,
+ /// This window is the one that shows the notice.
+ prompt: bool,
+}
+
+/// What is kept between runs, in `updates.json`.
+#[derive(serde::Serialize, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct Prefs {
+ #[serde(default = "on")]
+ pub auto: bool,
+ #[serde(default)]
+ pub checked_at: Option<i64>,
+}
+
+fn on() -> bool {
+ true
+}
+
+impl Default for Prefs {
+ fn default() -> Self {
+ Self {
+ auto: true,
+ checked_at: None,
+ }
+ }
+}
+
+fn prefs_path(app: &AppHandle) -> PathBuf {
+ crate::state_dir(app).join("updates.json")
+}
+
+pub fn load_prefs(app: &AppHandle) -> Prefs {
+ std::fs::read(prefs_path(app))
+ .ok()
+ .and_then(|b| serde_json::from_slice(&b).ok())
+ .unwrap_or_default()
+}
+
+fn save_prefs(app: &AppHandle, prefs: &Prefs) {
+ let path = prefs_path(app);
+ let tmp = path.with_extension("json.tmp");
+ let Ok(text) = serde_json::to_vec_pretty(prefs) else {
+ return;
+ };
+ if std::fs::write(&tmp, text).is_ok() {
+ let _ = std::fs::rename(&tmp, &path);
+ }
+}
+
+fn remember(app: &AppHandle, i: &Inner) {
+ save_prefs(
+ app,
+ &Prefs {
+ auto: i.auto,
+ checked_at: i.checked_at,
+ },
+ );
+}
+
+fn unix_now() -> i64 {
+ std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .map_or(0, |d| d.as_secs() as i64)
+}
+
+fn changed(app: &AppHandle) {
+ app.emit(CHANGED, ()).ok();
+}
+
+/// The updater for this copy: the plugin's, with its endpoint and public key from
+/// tauri.conf.json, its client locked to GitHub's release servers, and Skykeep's own version
+/// policy. On Windows the installer takes over as Skykeep exits; the library is let go of
+/// first, as Quit lets go of it.
+fn updater(app: &AppHandle) -> tauri_plugin_updater::Result<tauri_plugin_updater::Updater> {
+ let leaving = app.clone();
+ app.updater_builder()
+ .timeout(Duration::from_secs(30))
+ .version_comparator(|current, release| is_update(&current, &release.version))
+ .configure_client(|client| {
+ quince_auth::releases::releases_only(
+ client
+ .connect_timeout(Duration::from_secs(20))
+ .read_timeout(Duration::from_secs(60)),
+ )
+ })
+ .on_before_exit(move || {
+ crate::wind_down(&leaving);
+ leaving.cleanup_before_exit();
+ })
+ .build()
+}
+
+/// Where a download is kept until it is installed: the cache folder, so clearing it costs a
+/// download, never data.
+fn staging_dir(app: &AppHandle) -> Option<PathBuf> {
+ app.path().app_cache_dir().ok().map(|d| d.join("update"))
+}
+
+/// Keep a verified download, with the release it came from, for after a restart.
+fn stage(app: &AppHandle, update: &Update, bytes: &[u8]) -> Option<PathBuf> {
+ let dir = staging_dir(app)?;
+ std::fs::create_dir_all(&dir).ok()?;
+ let package = dir.join("package");
+ let part = dir.join("package.part");
+ std::fs::write(&part, bytes).ok()?;
+ std::fs::rename(&part, &package).ok()?;
+ let release = dir.join("release.json");
+ let tmp = dir.join("release.json.tmp");
+ std::fs::write(&tmp, serde_json::to_vec(&update.raw_json).ok()?).ok()?;
+ std::fs::rename(&tmp, &release).ok()?;
+ Some(package)
+}
+
+fn unstage(app: &AppHandle) {
+ if let Some(dir) = staging_dir(app) {
+ let _ = std::fs::remove_dir_all(dir);
+ }
+}
+
+/// A download kept by an earlier run: taken up again if it is still an update and still
+/// passes its signature, with the version signed into it (the plugin insists on that for a
+/// release read back from disk). Anything else is thrown away — including the download of the
+/// version now running, once the update is done.
+fn restore(app: &AppHandle) {
+ let Some(dir) = staging_dir(app) else {
+ return;
+ };
+ let release = dir.join("release.json");
+ let package = dir.join("package");
+ if !release.exists() {
+ unstage(app);
+ return;
+ }
+ let restored = (|| {
+ let raw: serde_json::Value = serde_json::from_slice(&std::fs::read(&release).ok()?).ok()?;
+ let update = updater(app).ok()?.restore_update(raw).ok()??;
+ let bytes = std::fs::read(&package).ok()?;
+ update.verify(&bytes).ok()?;
+ Some(update)
+ })();
+ match restored {
+ Some(update) => {
+ let updates = app.state::<Updates>();
+ let mut i = updates.lock();
+ i.update = Some(update);
+ i.staged = Some(package);
+ i.phase = Phase::Ready;
+ drop(i);
+ changed(app);
+ }
+ None => unstage(app),
+ }
+}
+
+/// Look for a newer version. `asked`: from Settings, so a failure is said; otherwise a failure
+/// is kept quiet. Answers whether the check reached GitHub.
+async fn check(app: &AppHandle, asked: bool) -> bool {
+ let updates = app.state::<Updates>();
+ let before = {
+ let mut i = updates.lock();
+ if i.install != Install::Here || matches!(i.phase, Phase::Checking) || i.phase.applying() {
+ return true;
+ }
+ let before = i.phase;
+ i.phase = Phase::Checking;
+ i.problem = None;
+ before
+ };
+ changed(app);
+ let found = match updater(app) {
+ Ok(u) => u.check().await,
+ Err(e) => Err(e),
+ };
+ let mut i = updates.lock();
+ let reached = match found {
+ Ok(Some(update)) => {
+ i.checked_at = Some(unix_now());
+ if i.refused.as_deref() == Some(update.version.as_str()) {
+ // Its download failed its signature this run: not offered again.
+ i.phase = if asked {
+ i.problem = Some(format!(
+ "Skykeep {} didn't match its signature, so it won't be installed.",
+ update.version
+ ));
+ Phase::Failed { notice: false }
+ } else {
+ before
+ };
+ } else if i.staged.is_some()
+ && i.update.as_ref().map(|u| &u.version) == Some(&update.version)
+ {
+ // Already downloaded.
+ i.phase = Phase::Ready;
+ } else {
+ if i.staged.take().is_some() {
+ unstage(app);
+ }
+ // Found again by a check of its own: offered again, even after Later.
+ if asked || i.put_off.as_deref() != Some(update.version.as_str()) {
+ i.put_off = None;
+ }
+ i.update = Some(update);
+ i.phase = Phase::Available;
+ }
+ true
+ }
+ // No newer version, or none published for this kind of install yet.
+ Ok(None) | Err(Error::TargetNotFound(_) | Error::TargetsNotFound(_)) => {
+ i.checked_at = Some(unix_now());
+ i.phase = if i.staged.is_some() {
+ Phase::Ready
+ } else {
+ Phase::Current
+ };
+ true
+ }
+ Err(e) => {
+ if asked {
+ i.problem = Some(problem(Stage::Check, &e));
+ i.phase = Phase::Failed { notice: false };
+ } else {
+ i.phase = before;
+ }
+ false
+ }
+ };
+ remember(app, &i);
+ drop(i);
+ changed(app);
+ reached
+}
+
+/// What is still on its way to iCloud: the outbox's changes, photos being uploaded, and files
+/// written in the Drive folder.
+async fn unsent(app: &AppHandle) -> (usize, usize, usize) {
+ let (changes, uploads) = {
+ let library = app.state::<crate::Data>();
+ let library = library.0.lock().await;
+ (
+ library.outbox_count().unwrap_or(1),
+ library.unfinished_uploads().map_or(1, |u| u.len()),
+ )
+ };
+ let files = crate::mount::unsent_files(&crate::state_dir(app));
+ (changes, uploads, files)
+}
+
+fn typing_now(i: &Inner) -> bool {
+ i.typing.values().any(|at| at.elapsed() < TYPING_LASTS)
+}
+
+/// Update and Restart: download (unless already downloaded), wait for a moment nothing would be
+/// lost, install, restart.
+async fn apply(app: AppHandle) {
+ let updates = app.state::<Updates>();
+ let (attempt, update, staged) = {
+ let mut i = updates.lock();
+ if i.install != Install::Here || i.phase.applying() {
+ return;
+ }
+ let Some(update) = i.update.clone() else {
+ return;
+ };
+ i.attempt += 1;
+ i.problem = None;
+ i.put_off = None;
+ (i.attempt, update, i.staged.clone())
+ };
+
+ // The package: kept from before, checked again, or downloaded now.
+ let kept = match staged {
+ Some(path) => {
+ let check = update.clone();
+ tauri::async_runtime::spawn_blocking(move || {
+ std::fs::read(&path)
+ .ok()
+ .filter(|bytes| check.verify(bytes).is_ok())
+ })
+ .await
+ .ok()
+ .flatten()
+ }
+ None => None,
+ };
+ let bytes = match kept {
+ Some(bytes) => bytes,
+ None => match download(&app, &update).await {
+ Some(bytes) => bytes,
+ None => return,
+ },
+ };
+
+ // Waiting for a moment nothing would be lost: every window has a moment to say it is
+ // being typed in, then it is looked at again every few seconds.
+ tokio::time::sleep(SETTLE).await;
+ loop {
+ let (changes, uploads, files) = unsent(&app).await;
+ let step = {
+ let mut i = updates.lock();
+ if i.attempt != attempt {
+ // Later: the download is kept, for whenever the person says.
+ return;
+ }
+ match hold(changes, uploads, files, typing_now(&i)) {
+ None => {
+ i.phase = Phase::Installing;
+ None
+ }
+ Some(h) => {
+ let fresh = i.phase != Phase::Waiting(h);
+ i.phase = Phase::Waiting(h);
+ Some(fresh)
+ }
+ }
+ };
+ match step {
+ None => break,
+ Some(true) => changed(&app),
+ Some(false) => {}
+ }
+ tokio::time::sleep(WAIT_STEP).await;
+ }
+ changed(&app);
+ // A moment for the notice to say so before the windows go.
+ tokio::time::sleep(Duration::from_millis(400)).await;
+
+ // Installed (verified once more first). On Windows the installer takes over and Skykeep
+ // exits inside this call; on Linux the AppImage is replaced and Skykeep starts it again.
+ let installing = update.clone();
+ let done = tauri::async_runtime::spawn_blocking(move || installing.install(&bytes)).await;
+ match done {
+ Ok(Ok(())) => {
+ unstage(&app);
+ relaunch(&app);
+ }
+ Ok(Err(e)) => fail(&app, Stage::Install, &e, &update.version),
+ Err(_) => fail(
+ &app,
+ Stage::Install,
+ &Error::InvalidUpdaterFormat,
+ &update.version,
+ ),
+ }
+}
+
+/// Download and verify, telling the windows how far it has come.
+async fn download(app: &AppHandle, update: &Update) -> Option<Vec<u8>> {
+ let updates = app.state::<Updates>();
+ {
+ let mut i = updates.lock();
+ i.phase = Phase::Downloading;
+ i.received = 0;
+ i.total = None;
+ }
+ changed(app);
+ // Only from GitHub's release servers; the client would refuse anywhere else too, but this
+ // says why.
+ if !quince_auth::releases::url_is_release(&update.download_url) {
+ fail(
+ app,
+ Stage::Download,
+ &Error::ReleaseNotFound,
+ &update.version,
+ );
+ return None;
+ }
+ let mut told = Instant::now();
+ let tell = app.clone();
+ let got = update
+ .download(
+ |chunk, total| {
+ let updates = tell.state::<Updates>();
+ let mut i = updates.lock();
+ i.received += chunk as u64;
+ i.total = total;
+ drop(i);
+ // A few times a second, not once a chunk.
+ if told.elapsed() >= Duration::from_millis(200) {
+ told = Instant::now();
+ changed(&tell);
+ }
+ },
+ || {},
+ )
+ .await;
+ match got {
+ Ok(bytes) => {
+ let staged = {
+ let app = app.clone();
+ let update = update.clone();
+ let bytes = bytes.clone();
+ tauri::async_runtime::spawn_blocking(move || stage(&app, &update, &bytes))
+ .await
+ .ok()
+ .flatten()
+ };
+ let mut i = updates.lock();
+ i.staged = staged;
+ i.phase = Phase::Ready;
+ drop(i);
+ changed(app);
+ Some(bytes)
+ }
+ Err(e) => {
+ fail(app, Stage::Download, &e, &update.version);
+ None
+ }
+ }
+}
+
+fn fail(app: &AppHandle, stage: Stage, e: &Error, version: &str) {
+ quiet!("update: {stage:?} failed: {e}");
+ let updates = app.state::<Updates>();
+ let mut i = updates.lock();
+ if is_signature(e) {
+ // Never installed, never offered again this run, and nothing of it kept.
+ i.refused = Some(version.to_string());
+ i.staged = None;
+ unstage(app);
+ }
+ if i.put_off.as_deref() == Some(version) && !is_signature(e) {
+ // Later was chosen while it downloaded: nothing to say, it can be tried again.
+ i.phase = if i.staged.is_some() {
+ Phase::Ready
+ } else {
+ Phase::Available
+ };
+ } else {
+ i.problem = Some(problem(stage, e));
+ i.phase = Phase::Failed { notice: true };
+ }
+ drop(i);
+ changed(app);
+}
+
+/// Start the new version: the AppImage just written, told to wait until this one has gone
+/// (`--updated=<pid>`, [`after_update`]) so it is not handed to this one as a second launch.
+#[cfg(target_os = "linux")]
+fn relaunch(app: &AppHandle) {
+ let program = app
+ .env()
+ .appimage
+ .map(PathBuf::from)
+ .or_else(|| std::env::current_exe().ok());
+ crate::wind_down(app);
+ if let Some(program) = program {
+ let _ = std::process::Command::new(program)
+ .arg(format!("--updated={}", std::process::id()))
+ .spawn();
+ }
+ // SAFETY: ends the process at once; nothing after it runs.
+ unsafe { libc::_exit(0) }
+}
+
+/// Elsewhere the installer has already ended Skykeep and starts the new version itself.
+#[cfg(not(target_os = "linux"))]
+fn relaunch(app: &AppHandle) {
+ app.restart();
+}
+
+/// Started by an update (`--updated=<pid>`): wait, briefly, for the version that started this
+/// one to finish exiting. Called first thing in `main`.
+pub fn after_update() {
+ let Some(pid) = std::env::args().find_map(|a| {
+ a.strip_prefix("--updated=")
+ .and_then(|p| p.parse::<u32>().ok())
+ }) else {
+ return;
+ };
+ #[cfg(target_os = "linux")]
+ {
+ let gone = format!("/proc/{pid}");
+ let until = Instant::now() + Duration::from_secs(10);
+ while Path::new(&gone).exists() && Instant::now() < until {
+ std::thread::sleep(Duration::from_millis(50));
+ }
+ }
+ #[cfg(not(target_os = "linux"))]
+ let _ = pid;
+}
+
+/// Whether a check made on its own should go ahead: not offline, and not on a metered
+/// connection (a phone's hotspot), as this desktop's network monitor says. Elsewhere, yes:
+/// a check that fails offline is kept quiet anyway.
+async fn network_allows(app: &AppHandle) -> bool {
+ #[cfg(target_os = "linux")]
+ {
+ let (tx, rx) = std::sync::mpsc::channel();
+ let asked = app.run_on_main_thread(move || {
+ use gtk::gio::prelude::NetworkMonitorExt;
+ let monitor = gtk::gio::NetworkMonitor::default();
+ let _ = tx.send(monitor.is_network_available() && !monitor.is_network_metered());
+ });
+ if asked.is_err() {
+ return true;
+ }
+ tauri::async_runtime::spawn_blocking(move || {
+ rx.recv_timeout(Duration::from_secs(5)).unwrap_or(true)
+ })
+ .await
+ .unwrap_or(true)
+ }
+ #[cfg(not(target_os = "linux"))]
+ {
+ let _ = app;
+ true
+ }
+}
+
+/// Take up a download kept from before, then check shortly after launch and about once a day.
+/// Only a copy that updates itself does any of it.
+pub fn spawn(app: AppHandle) {
+ if app.state::<Updates>().lock().install != Install::Here {
+ return;
+ }
+ tauri::async_runtime::spawn(async move {
+ let restoring = app.clone();
+ let _ = tauri::async_runtime::spawn_blocking(move || restore(&restoring)).await;
+ tokio::time::sleep(FIRST_CHECK).await;
+ let mut next = 0;
+ loop {
+ let auto = app.state::<Updates>().lock().auto;
+ if auto && unix_now() >= next && network_allows(&app).await {
+ next = unix_now()
+ + if check(&app, false).await {
+ EVERY_SECS
+ } else {
+ AFTER_FAILURE_SECS
+ };
+ }
+ tokio::time::sleep(TICK).await;
+ }
+ });
+}
+
+/// A window was put away or closed: if it showed the notice, another window on screen takes it.
+pub fn put_away(app: &AppHandle, label: &str) {
+ let Some(updates) = app.try_state::<Updates>() else {
+ return;
+ };
+ let mut i = updates.lock();
+ i.typing.remove(label);
+ if i.holder.as_deref() == Some(label) {
+ i.holder = None;
+ drop(i);
+ changed(app);
+ }
+}
+
+fn status(app: &AppHandle, window: &tauri::Window) -> Status {
+ let updates = app.state::<Updates>();
+ // Whether each window is on screen is asked before the lock is taken: the answer comes
+ // from the main thread.
+ let holder = updates.lock().holder.clone();
+ let holder_shown = holder
+ .as_deref()
+ .and_then(|l| app.get_webview_window(l))
+ .is_some_and(|w| w.is_visible().unwrap_or(false));
+ let asker_shown = window.is_visible().unwrap_or(false);
+ let mut i = updates.lock();
+ let offers = match i.phase {
+ Phase::Available | Phase::Ready => {
+ let version = i.update.as_ref().map(|u| u.version.as_str());
+ version.is_some() && i.put_off.as_deref() != version
+ }
+ Phase::Downloading | Phase::Waiting(_) | Phase::Installing => true,
+ Phase::Failed { notice } => notice,
+ _ => false,
+ };
+ let prompt = if offers {
+ i.holder = claim(
+ i.holder.as_deref(),
+ holder_shown && i.holder == holder,
+ window.label(),
+ asker_shown,
+ );
+ i.holder.as_deref() == Some(window.label())
+ } else {
+ i.holder = None;
+ false
+ };
+ let update = i.update.as_ref();
+ Status {
+ install: i.install,
+ auto: i.auto,
+ current: app.package_info().version.to_string(),
+ phase: i.phase.name(),
+ version: update.map(|u| u.version.clone()),
+ notes: update
+ .and_then(|u| u.body.clone())
+ .filter(|n| !n.trim().is_empty()),
+ received: i.received,
+ total: i.total,
+ waiting_for: match i.phase {
+ Phase::Waiting(h) => Some(h),
+ _ => None,
+ },
+ problem: i.problem.clone(),
+ checked_at: i.checked_at,
+ prompt,
+ }
+}
+
+/// The updater, as this window shows it.
+#[tauri::command]
+pub async fn update_status(app: AppHandle, window: tauri::Window) -> Result<Status, String> {
+ Ok(status(&app, &window))
+}
+
+/// Check for Updates, from Settings: always reaches out, whatever the automatic setting.
+#[tauri::command]
+pub async fn update_check(app: AppHandle, window: tauri::Window) -> Result<Status, String> {
+ refuse_unless_here(&app)?;
+ check(&app, true).await;
+ Ok(status(&app, &window))
+}
+
+/// Update and Restart.
+#[tauri::command]
+pub async fn update_apply(app: AppHandle) -> Result<(), String> {
+ refuse_unless_here(&app)?;
+ tauri::async_runtime::spawn(apply(app));
+ Ok(())
+}
+
+/// Later: the notice goes, in every window; a download is kept, and a restart waiting for its
+/// moment does not happen. The next check of its own offers it again.
+#[tauri::command]
+pub async fn update_later(app: AppHandle) -> Result<(), String> {
+ let updates = app.state::<Updates>();
+ let mut i = updates.lock();
+ if i.phase == Phase::Installing {
+ return Err("Skykeep is installing the update now.".into());
+ }
+ i.attempt += 1;
+ i.put_off = i.update.as_ref().map(|u| u.version.clone());
+ i.phase = match i.phase {
+ Phase::Downloading => Phase::Available,
+ Phase::Waiting(_) => Phase::Ready,
+ Phase::Failed { .. } if i.staged.is_some() => Phase::Ready,
+ Phase::Failed { .. } if i.update.is_some() => Phase::Available,
+ Phase::Failed { .. } => Phase::Idle,
+ other => other,
+ };
+ i.problem = None;
+ drop(i);
+ changed(&app);
+ Ok(())
+}
+
+/// Check for Updates Automatically.
+#[tauri::command]
+pub async fn update_auto_set(on: bool, app: AppHandle) -> Result<(), String> {
+ let updates = app.state::<Updates>();
+ let mut i = updates.lock();
+ i.auto = on;
+ remember(&app, &i);
+ drop(i);
+ changed(&app);
+ Ok(())
+}
+
+/// A window is being typed in, or no longer is: a restart waits for it.
+#[tauri::command]
+pub async fn update_typing(typing: bool, app: AppHandle, window: tauri::Window) {
+ let updates = app.state::<Updates>();
+ let mut i = updates.lock();
+ if typing {
+ i.typing.insert(window.label().to_string(), Instant::now());
+ } else {
+ i.typing.remove(window.label());
+ }
+}
+
+fn refuse_unless_here(app: &AppHandle) -> Result<(), String> {
+ match app.state::<Updates>().lock().install {
+ Install::Here => Ok(()),
+ Install::PackageManager => Err("Updates come through your package manager.".into()),
+ Install::Flatpak => Err("Updates come through Flatpak.".into()),
+ Install::Development => {
+ Err("This is a development build, so it doesn't update itself.".into())
+ }
+ Install::Manual => Err(
+ "This copy wasn't installed by Skykeep's installer, so it doesn't update itself."
+ .into(),
+ ),
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn v(s: &str) -> semver::Version {
+ semver::Version::parse(s).unwrap()
+ }
+
+ #[test]
+ fn only_a_newer_full_release_is_an_update() {
+ assert!(is_update(&v("0.1.0"), &v("0.2.0")));
+ assert!(is_update(&v("0.1.0"), &v("0.1.1")));
+ assert!(!is_update(&v("0.2.0"), &v("0.2.0")), "the same version");
+ assert!(!is_update(&v("0.2.0"), &v("0.1.9")), "never a downgrade");
+ assert!(
+ !is_update(&v("0.1.0"), &v("0.2.0-beta.1")),
+ "no prereleases"
+ );
+ assert!(!is_update(&v("0.2.0-beta.1"), &v("0.2.0-beta.2")));
+ assert!(is_update(&v("0.2.0-beta.1"), &v("0.2.0")));
+ }
+
+ #[test]
+ fn who_updates_each_kind_of_install() {
+ use BundleType::*;
+ let here = |os, b, ai| install_kind(os, b, ai, false, false);
+ assert_eq!(here("linux", Some(AppImage), true), Install::Here);
+ assert_eq!(here("linux", Some(AppImage), false), Install::Manual);
+ assert_eq!(here("linux", Some(Deb), false), Install::PackageManager);
+ assert_eq!(here("linux", Some(Rpm), false), Install::PackageManager);
+ // The AUR and distribution packages are built with cargo: no bundle type.
+ assert_eq!(here("linux", None, false), Install::PackageManager);
+ // Even a .deb's program started with APPIMAGE set by something else is not replaced.
+ assert_eq!(here("linux", Some(Deb), true), Install::PackageManager);
+ assert_eq!(here("windows", Some(Nsis), false), Install::Here);
+ assert_eq!(here("windows", Some(Msi), false), Install::Here);
+ assert_eq!(here("windows", None, false), Install::Manual);
+ assert_eq!(here("macos", Some(App), false), Install::Manual);
+ assert_eq!(
+ install_kind("linux", Some(AppImage), true, true, false),
+ Install::Flatpak
+ );
+ assert_eq!(
+ install_kind("linux", None, false, true, false),
+ Install::Flatpak
+ );
+ assert_eq!(
+ install_kind("windows", Some(Nsis), false, false, true),
+ Install::Development
+ );
+ }
+
+ #[test]
+ fn never_restart_with_anything_unsent_or_mid_typing() {
+ assert_eq!(hold(0, 0, 0, false), None);
+ assert_eq!(hold(1, 0, 0, false), Some(Hold::Changes));
+ assert_eq!(hold(0, 2, 0, false), Some(Hold::Changes));
+ assert_eq!(hold(0, 0, 3, false), Some(Hold::Changes));
+ assert_eq!(hold(0, 0, 0, true), Some(Hold::Typing));
+ // Unsent changes are said first: they are what a restart would hold up.
+ assert_eq!(hold(4, 0, 0, true), Some(Hold::Changes));
+ }
+
+ #[test]
+ fn the_notice_is_in_one_window_at_a_time() {
+ // The first window on screen to ask takes it.
+ assert_eq!(claim(None, false, "main", true).as_deref(), Some("main"));
+ // A window out of sight does not.
+ assert_eq!(claim(None, false, "app-notes", false), None);
+ // Another window asking while it shows: it stays where it is.
+ assert_eq!(
+ claim(Some("main"), true, "app-notes", true).as_deref(),
+ Some("main")
+ );
+ // Its window put away: the next on screen takes it.
+ assert_eq!(
+ claim(Some("main"), false, "app-notes", true).as_deref(),
+ Some("app-notes")
+ );
+ // Its own window asking keeps it.
+ assert_eq!(
+ claim(Some("main"), false, "main", false).as_deref(),
+ Some("main")
+ );
+ }
+
+ #[test]
+ fn failures_are_said_plainly() {
+ let sig = problem(Stage::Download, &Error::MissingSignedVersion);
+ assert!(sig.contains("wasn't installed"), "{sig}");
+ let mismatch = Error::SignedVersionMismatch {
+ signed: "0.1.0".into(),
+ announced: "9.9.9".into(),
+ };
+ assert!(is_signature(&mismatch));
+ assert!(problem(Stage::Install, &mismatch).contains("signature"));
+ let busy = problem(Stage::Check, &Error::ReleaseNotFound);
+ assert!(busy.contains("GitHub didn't answer"), "{busy}");
+ let partial = problem(Stage::Download, &Error::Network("status 502".into()));
+ assert!(partial.contains("didn't finish"), "{partial}");
+ assert!(!is_signature(&Error::ReleaseNotFound));
+ // Never the library's own words.
+ for p in [busy, partial, sig] {
+ assert!(!p.contains("endpoint") && !p.contains("JSON"), "{p}");
+ }
+ }
+
+ /// The latest.json the release workflow writes (.github/workflows/release.yml, "The
+ /// updater's latest.json"), as it wrote it in a dry run: one the updater reads, naming each
+ /// kind of install that updates itself and no plain `linux-x86_64` a .deb could fall back on.
+ #[test]
+ fn the_release_workflows_latest_json_is_one_the_updater_reads() {
+ let written = r#"{
+ "version": "0.2.0",
+ "notes": "Faster Photos.\n\nCalendar fixes.",
+ "pub_date": "2026-10-23T13:53:28Z",
+ "platforms": {
+ "linux-x86_64-appimage": { "url": "https://github.com/YashwanthKamireddi/Skykeep/releases/download/v0.2.0/Skykeep_0.2.0_amd64.AppImage", "signature": "c2ln" },
+ "windows-x86_64-nsis": { "url": "https://github.com/YashwanthKamireddi/Skykeep/releases/download/v0.2.0/Skykeep_0.2.0_x64-setup.exe", "signature": "c2ln" },
+ "windows-x86_64-msi": { "url": "https://github.com/YashwanthKamireddi/Skykeep/releases/download/v0.2.0/Skykeep_0.2.0_x64_en-US.msi", "signature": "c2ln" }
+ }
+ }"#;
+ let release: tauri_plugin_updater::RemoteRelease = serde_json::from_str(written).unwrap();
+ assert_eq!(release.version, v("0.2.0"));
+ assert!(release
+ .notes
+ .as_deref()
+ .unwrap()
+ .contains("Calendar fixes."));
+ for target in [
+ "linux-x86_64-appimage",
+ "windows-x86_64-nsis",
+ "windows-x86_64-msi",
+ ] {
+ let url = release.download_url(target).unwrap();
+ assert!(quince_auth::releases::url_is_release(url), "{url}");
+ }
+ assert!(release.download_url("linux-x86_64").is_err());
+ assert!(release.download_url("linux-x86_64-deb").is_err());
+ }
+
+ #[test]
+ fn prefs_default_to_checking_automatically() {
+ let p: Prefs = serde_json::from_str("{}").unwrap();
+ assert!(p.auto);
+ let p: Prefs = serde_json::from_str(r#"{"auto":false,"checkedAt":5}"#).unwrap();
+ assert!(!p.auto);
+ assert_eq!(p.checked_at, Some(5));
+ }
+}
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 40904d8..a537732 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -150,5 +150,17 @@
}
}
},
+ "plugins": {
+ "updater": {
+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEQ0NTY5QjZBMEYxODdFNzkKUldSNWZoZ1BhcHRXMUxlV3E1MXdFeGl1YmVTR3FTbEQ4a0RoUVRKaGxnRkM2TGgxTDlRZXpSWU0K",
+ "endpoints": [
+ "https://github.com/YashwanthKamireddi/Skykeep/releases/latest/download/latest.json"
+ ],
+ "requireSignedVersion": true,
+ "windows": {
+ "installMode": "passive"
+ }
+ }
+ },
"mainBinaryName": "skykeep"
}
diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx
index c7f2ce0..7326e62 100644
--- a/src/components/Toast.tsx
+++ b/src/components/Toast.tsx
@@ -100,8 +100,9 @@ export function useErrorToast(error: string | null, clear: () => void) {
}, [error, active]);
}
-/** Drawn once, in the library, over the foot of the content. */
-export function ToastHost() {
+/** Drawn once, in the library, over the foot of the content; `children` (the update notice)
+ * sit above the toasts, in the same column. */
+export function ToastHost({ children }: { children?: React.ReactNode }) {
const list = useSyncExternalStore(subscribe, () => shown);
const lift = useSyncExternalStore(subscribe, clearance);
// A notice is said by a polite live region that is always on the page: one drawn together
@@ -124,6 +125,7 @@ export function ToastHost() {
return (
<>
<div className="toast-host" style={lift ? ({ "--toast-clear": `${lift}px` } as React.CSSProperties) : undefined}>
+ {children}
{list.map((t) => (
<ToastCard key={t.id} toast={t} />
))}
diff --git a/src/components/UpdateNotice.tsx b/src/components/UpdateNotice.tsx
new file mode 100644
index 0000000..5dcb951
--- /dev/null
+++ b/src/components/UpdateNotice.tsx
@@ -0,0 +1,133 @@
+import { useLayoutEffect, useRef, useState } from "react";
+import { ArrowDownToLine, TriangleAlert } from "lucide-react";
+import { fadeIn } from "../lib/fade";
+import { api, messageOf, type UpdateStatus } from "../lib/ipc";
+import { useTypingReport, useUpdateStatus } from "../lib/updates";
+import { Progress } from "./Spinner";
+
+/** The phases in which a restart to update is near enough that typing is reported. */
+const NEAR = new Set<UpdateStatus["phase"]>(["available", "ready", "downloading", "waiting"]);
+
+/**
+ * A new version of Skykeep, said once, calmly, in the window in use: never in two windows at
+ * once (the backend says which one shows it). Update and Restart downloads it with its
+ * progress, waits for a moment nothing would be lost and says what it is waiting for, then
+ * installs and restarts; Later puts it away in every window. Drawn among the toasts, at the
+ * foot of the content.
+ */
+export function UpdateNotice() {
+ const [status, setStatus] = useUpdateStatus();
+ const [error, setError] = useState<string | null>(null);
+ useTypingReport(Boolean(status && status.install === "here" && NEAR.has(status.phase)));
+ if (!status?.prompt || !status.version) return null;
+ const s = status;
+ const name = `Skykeep ${s.version}`;
+
+ const apply = () => {
+ setError(null);
+ setStatus({ ...s, phase: s.phase === "ready" ? "waiting" : "downloading", received: 0, total: null, problem: null });
+ api.updateApply().catch((e) => setError(messageOf(e)));
+ };
+ const later = () => {
+ setStatus({ ...s, prompt: false });
+ api.updateLater().catch(() => {});
+ };
+
+ let line: string;
+ let actions: "offer" | "later" | "retry" | "none" = "offer";
+ switch (s.phase) {
+ case "available":
+ line = `${name} is available`;
+ break;
+ case "ready":
+ line = `${name} is ready to install`;
+ break;
+ case "downloading":
+ line = `Downloading ${name}`;
+ actions = "later";
+ break;
+ case "waiting":
+ line =
+ s.waitingFor === "typing"
+ ? `${name} will install when you finish typing, then Skykeep restarts`
+ : `${name} will install once your changes reach iCloud, then Skykeep restarts`;
+ actions = "later";
+ break;
+ case "installing":
+ line = `Installing ${name}. Skykeep will restart in a moment`;
+ actions = "none";
+ break;
+ case "failed":
+ line = s.problem ?? "The update couldn't be installed. Your current version is unchanged.";
+ // A download that failed its signature is not offered again; anything else may be tried again.
+ actions = /signature/.test(line) ? "later" : "retry";
+ break;
+ default:
+ return null;
+ }
+ const failed = s.phase === "failed" || error !== null;
+ const share = s.total ? s.received / s.total : null;
+
+ return (
+ <NoticeCard failed={failed} onEscape={actions === "none" ? undefined : later}>
+ {failed ? (
+ <TriangleAlert className="toast-glyph" size={15} strokeWidth={2} aria-hidden="true" />
+ ) : (
+ <ArrowDownToLine className="toast-glyph update-glyph" size={15} strokeWidth={2} aria-hidden="true" />
+ )}
+ <div className="update-body">
+ <p className="update-line">{error ?? line}</p>
+ {s.phase === "downloading" && (
+ <div className="update-progress">
+ <Progress value={share} label={`Downloading ${name}`} />
+ {share !== null && <span className="update-percent">{Math.round(share * 100)}%</span>}
+ </div>
+ )}
+ {s.notes && (s.phase === "available" || s.phase === "ready") && (
+ <details className="update-notes">
+ <summary>What’s New</summary>
+ <div className="update-notes-text">{s.notes}</div>
+ </details>
+ )}
+ {actions !== "none" && (
+ <div className="update-actions">
+ <button className="quiet" onClick={later}>
+ {actions === "offer" ? "Later" : actions === "retry" ? "Not Now" : s.phase === "failed" ? "OK" : "Later"}
+ </button>
+ {actions === "offer" && (
+ <button className="toast-action" onClick={apply}>
+ Update and Restart
+ </button>
+ )}
+ {actions === "retry" && (
+ <button className="toast-action" onClick={apply}>
+ Try Again
+ </button>
+ )}
+ </div>
+ )}
+ </div>
+ </NoticeCard>
+ );
+}
+
+function NoticeCard({ failed, onEscape, children }: { failed: boolean; onEscape?: () => void; children: React.ReactNode }) {
+ const card = useRef<HTMLDivElement>(null);
+ useLayoutEffect(() => fadeIn(card.current, { duration: 140 }), []);
+ return (
+ <div
+ ref={card}
+ className={`toast update-notice${failed ? " is-error" : ""}`}
+ role={failed ? "alert" : "group"}
+ aria-label={failed ? undefined : "Skykeep Update"}
+ onKeyDown={(e) => {
+ if (e.key === "Escape" && onEscape) {
+ e.stopPropagation();
+ onEscape();
+ }
+ }}
+ >
+ {children}
+ </div>
+ );
+}
diff --git a/src/lib/ipc.ts b/src/lib/ipc.ts
index 379b819..a271f1b 100644
--- a/src/lib/ipc.ts
+++ b/src/lib/ipc.ts
@@ -70,6 +70,29 @@ export type UploadEvent = {
error: string | null;
};
+/** Told whenever Skykeep's own update moves on; each window asks for its status again. */
+export const UPDATE = "quince://update";
+
+/** Who updates this copy of Skykeep: itself, or the package manager it came from. */
+export type UpdateInstall = "here" | "packageManager" | "flatpak" | "development" | "manual";
+export type UpdateStatus = {
+ install: UpdateInstall;
+ /** Check for Updates Automatically. */
+ auto: boolean;
+ current: string;
+ phase: "idle" | "checking" | "current" | "available" | "downloading" | "ready" | "waiting" | "installing" | "failed";
+ version: string | null;
+ notes: string | null;
+ received: number;
+ total: number | null;
+ /** What a downloaded update waits for before Skykeep restarts. */
+ waitingFor: "changes" | "typing" | null;
+ problem: string | null;
+ checkedAt: number | null;
+ /** This window is the one that shows the update notice. */
+ prompt: boolean;
+};
+
export const SYNCED = "quince://synced";
/** An alert was clicked: open Reminders, where that reminder is. */
export const OPEN_REMINDER = "quince://open-reminder";
@@ -103,7 +126,18 @@ export const api = {
/** What waits to reach Apple, and what Apple turned down. */
outboxStatus: () => invoke<OutboxStatus>("outbox_status"),
/** What the network lock lets Skykeep reach: Apple's domains, and each subscribed calendar's host. */
- networkReach: () => invoke<{ apple: string[]; subscribed: string[] }>("network_reach"),
+ networkReach: () => invoke<{ apple: string[]; subscribed: string[]; updates: string[] }>("network_reach"),
+ /** Skykeep's own updates, as this window shows them (updates.rs). */
+ updateStatus: () => invoke<UpdateStatus>("update_status"),
+ /** Check for Updates, from Settings: a failure is said. */
+ updateCheck: () => invoke<UpdateStatus>("update_check"),
+ /** Update and Restart: download, wait until nothing would be lost, install, restart. */
+ updateApply: () => invoke<void>("update_apply"),
+ /** Later: the notice goes from every window; a download is kept. */
+ updateLater: () => invoke<void>("update_later"),
+ updateAutoSet: (on: boolean) => invoke<void>("update_auto_set", { on }),
+ /** This window is being typed in, or no longer is: a restart to update waits for it. */
+ updateTyping: (typing: boolean) => invoke<void>("update_typing", { typing }),
/** A refused change, sent again. */
outboxResend: (id: number) => invoke<void>("outbox_resend", { id }),
/** A refused change let go of: Apple's version stands. */
diff --git a/src/lib/updates.ts b/src/lib/updates.ts
new file mode 100644
index 0000000..9533e72
--- /dev/null
+++ b/src/lib/updates.ts
@@ -0,0 +1,94 @@
+import { useEffect, useState } from "react";
+import { listen } from "@tauri-apps/api/event";
+import { api, UPDATE, type UpdateStatus } from "./ipc";
+
+/**
+ * Skykeep's own update, as this window sees it: asked of the backend once, again whenever it
+ * says something moved (`quince://update`), and again when the window comes back to the front —
+ * which is how the notice moves to the window in use when the one showing it is put away.
+ */
+export function useUpdateStatus(): [UpdateStatus | null, (s: UpdateStatus) => void] {
+ const [status, setStatus] = useState<UpdateStatus | null>(null);
+ useEffect(() => {
+ let alive = true;
+ const read = () =>
+ api.updateStatus().then(
+ (s) => alive && setStatus(s),
+ () => {},
+ );
+ void read();
+ const stop = listen(UPDATE, () => void read());
+ const back = () => void read();
+ window.addEventListener("focus", back);
+ return () => {
+ alive = false;
+ window.removeEventListener("focus", back);
+ void stop.then((u) => u()).catch(() => {});
+ };
+ }, []);
+ return [status, setStatus];
+}
+
+/*
+ * Whether someone is typing in this window: a key pressed in a text field in the last few
+ * seconds, or a note with words not yet saved (NotesView holds it). A restart to install an
+ * update waits for every window to be clear.
+ */
+const TYPING_MS = 5000;
+const held = new Set<string>();
+let lastKey = 0;
+const watchers = new Set<() => void>();
+const tell = () => watchers.forEach((w) => w());
+
+function editable(t: EventTarget | null): boolean {
+ const el = t as HTMLElement | null;
+ return Boolean(el?.closest?.("input, textarea, [contenteditable=''], [contenteditable='true'], [contenteditable='plaintext-only']"));
+}
+
+if (typeof document !== "undefined") {
+ const typed = (e: Event) => {
+ if (!editable(e.target)) return;
+ const was = typingNow();
+ lastKey = Date.now();
+ if (!was) tell();
+ };
+ document.addEventListener("keydown", typed, true);
+ document.addEventListener("input", typed, true);
+}
+
+/** Hold "typing" under `key` while `on` (a note with words not yet saved). */
+export function holdTyping(key: string, on: boolean) {
+ const had = held.has(key);
+ if (on) held.add(key);
+ else held.delete(key);
+ if (had !== on) tell();
+}
+
+export function typingNow(): boolean {
+ return held.size > 0 || Date.now() - lastKey < TYPING_MS;
+}
+
+/**
+ * While an update could restart Skykeep, tell the backend whether this window is being typed
+ * in: at once when it starts, again every few seconds while it lasts (a window that stops
+ * saying so is taken as clear), and when it ends.
+ */
+export function useTypingReport(active: boolean) {
+ useEffect(() => {
+ if (!active) return undefined;
+ let said: boolean | null = null;
+ const say = () => {
+ const now = typingNow();
+ if (now || said !== now) void api.updateTyping(now).catch(() => {});
+ said = now;
+ };
+ say();
+ watchers.add(say);
+ const timer = window.setInterval(say, 4000);
+ return () => {
+ watchers.delete(say);
+ window.clearInterval(timer);
+ if (said) void api.updateTyping(false).catch(() => {});
+ };
+ }, [active]);
+}
diff --git a/src/screens/Library.tsx b/src/screens/Library.tsx
index c0d1520..6d4dece 100644
--- a/src/screens/Library.tsx
+++ b/src/screens/Library.tsx
@@ -1,4 +1,5 @@
import { ToastHost, toast } from "../components/Toast";
+import { UpdateNotice } from "../components/UpdateNotice";
import { EmptyState } from "../components/EmptyState";
import { StatusLine } from "../components/StatusLine";
import { lazy, Suspense, useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
@@ -573,7 +574,9 @@ export function Library({ onSignOut, onShown }: { onSignOut: (keep: boolean) =>
</EmptyState>
)}
</main>
- <ToastHost />
+ <ToastHost>
+ <UpdateNotice />
+ </ToastHost>
</div>
</SyncProvider>
);
diff --git a/src/screens/NotesView.tsx b/src/screens/NotesView.tsx
index cc3dc55..58eb4d1 100644
--- a/src/screens/NotesView.tsx
+++ b/src/screens/NotesView.tsx
@@ -28,6 +28,7 @@ import { useReveal } from "../lib/reveal";
import { Arriving } from "../components/EmptyState";
import { useArriving, useRevision, useShownRevision } from "../lib/sync";
import { Picker } from "../components/Picker";
+import { holdTyping } from "../lib/updates";
const ALL = "__all__";
@@ -673,6 +674,12 @@ export function NotesView() {
},
[]
);
+ // Words typed and not yet saved: a restart to install an update waits for them (lib/updates).
+ const unsaved = dirty || Boolean(composing?.body.trim());
+ useEffect(() => {
+ holdTyping("notes", unsaved);
+ return () => holdTyping("notes", false);
+ }, [unsaved]);
/**
* Turn what is being typed into a real note, once, without taking the page away.
diff --git a/src/screens/SettingsView.tsx b/src/screens/SettingsView.tsx
index ac498a5..8b5cf07 100644
--- a/src/screens/SettingsView.tsx
+++ b/src/screens/SettingsView.tsx
@@ -24,6 +24,7 @@ import {
settingsApi,
} from "../lib/ipc";
import { freshness, useSync } from "../lib/sync";
+import { useUpdateStatus } from "../lib/updates";
import { setTheme, storedTheme, type Theme } from "../lib/theme";
import { AppIcon } from "../components/AppIcon";
import { AccountAvatar } from "../components/Account";
@@ -801,6 +802,8 @@ export function SettingsView({ onSignOut }: { onSignOut: (keep: boolean) => Prom
)}
</section>
+ <UpdatesGroup />
+
<ReachGroup />
<h2 className="settings-heading">About</h2>
@@ -828,7 +831,7 @@ export function SettingsView({ onSignOut }: { onSignOut: (keep: boolean) => Prom
</button>
</div>
</section>
- <p className="settings-note">Skykeep talks only to Apple, and to calendars you subscribe to. It has no servers of its own.</p>
+ <NetworkNote />
</div>
);
}
@@ -861,16 +864,39 @@ function WeekStartRow() {
);
}
-/**
- * What Skykeep talks to, read from the network lock itself (`quince_auth::APPLE_DOMAINS`): a
- * request to anywhere else fails before a connection exists. Subscribed calendars are listed
- * by host, each reached by a client of its own.
- */
-function ReachGroup() {
- const [reach, setReach] = useState<{ apple: string[]; subscribed: string[] } | null>(null);
+type Reach = { apple: string[]; subscribed: string[]; updates: string[] };
+
+/** What Skykeep can reach, as its network locks hold it (`network_reach`). */
+function useReach(): Reach | null {
+ const [reach, setReach] = useState<Reach | null>(null);
useEffect(() => {
api.networkReach().then(setReach, () => {});
}, []);
+ return reach;
+}
+
+/** A list of hosts, each as code. */
+function Hosts({ hosts }: { hosts: string[] }) {
+ return (
+ <>
+ {hosts.map((h, i) => (
+ <span key={h}>
+ {i > 0 && ", "}
+ <code>{h}</code>
+ </span>
+ ))}
+ </>
+ );
+}
+
+/**
+ * What Skykeep talks to, read from the network locks themselves: Apple's domains
+ * (`quince_auth::APPLE_DOMAINS`), each subscribed calendar's host, and GitHub's release servers
+ * (`quince_auth::releases::RELEASE_HOSTS`) for a copy that updates itself. Each is reached by a
+ * client of its own that can reach nothing else.
+ */
+function ReachGroup() {
+ const reach = useReach();
if (!reach) return null;
const apple = reach.apple.filter((d) => !d.endsWith(".cn"));
return (
@@ -880,26 +906,26 @@ function ReachGroup() {
<div className="settings-row is-stacked">
<span className="settings-label">Apple</span>
<span className="settings-hint settings-hint-wrap">
- {apple.map((d, i) => (
- <span key={d}>
- {i > 0 && ", "}
- <code>{d}</code>
- </span>
- ))}{" "}
- and every address under them. Any other address is refused before a connection opens.
+ <Hosts hosts={apple} /> and every address under them, for your iCloud. These connections can reach nothing else.
</span>
</div>
<div className="settings-row is-stacked">
<span className="settings-label">Calendar Subscriptions</span>
<span className="settings-hint settings-hint-wrap">
- {reach.subscribed.length === 0
- ? "None. A calendar you subscribe to adds its own address here."
- : reach.subscribed.map((h, i) => (
- <span key={h}>
- {i > 0 && ", "}
- <code>{h}</code>
- </span>
- ))}
+ {reach.subscribed.length === 0 ? "None. A calendar you subscribe to adds its own address here." : <Hosts hosts={reach.subscribed} />}
+ </span>
+ </div>
+ <div className="settings-row is-stacked">
+ <span className="settings-label">Updates</span>
+ <span className="settings-hint settings-hint-wrap">
+ {reach.updates.length === 0 ? (
+ "None. This copy of Skykeep is updated by the way you installed it."
+ ) : (
+ <>
+ <Hosts hosts={reach.updates} />, GitHub’s release servers, to check for new versions of Skykeep and download
+ them. Nothing about you is sent.
+ </>
+ )}
</span>
</div>
</section>
@@ -907,6 +933,136 @@ function ReachGroup() {
);
}
+/** The line at the foot of Settings: what Skykeep connects to, true for this copy. */
+function NetworkNote() {
+ const reach = useReach();
+ if (!reach) return null;
+ return (
+ <p className="settings-note">
+ {reach.updates.length > 0
+ ? "Skykeep connects to Apple for your iCloud, to calendars you subscribe to, and to GitHub for its own updates. No Skykeep account, no analytics."
+ : "Skykeep connects to Apple for your iCloud, and to calendars you subscribe to. No Skykeep account, no analytics."}
+ </p>
+ );
+}
+
+/** When this copy last checked, said as a person would. */
+function checkedLine(at: number | null): string {
+ if (at === null) return "Not checked yet";
+ return freshness(at).replace(/^Updated/, "Checked");
+}
+
+/**
+ * Software Update: Check for Updates Automatically, and Check for Updates — or, for a copy a
+ * package manager installed, who updates it instead. What is found is offered by the update
+ * notice; here it can be installed too.
+ */
+function UpdatesGroup() {
+ const [status, setStatus] = useUpdateStatus();
+ const [checking, setChecking] = useState(false);
+ if (!status) return null;
+ const here = status.install === "here";
+ const elsewhere: Record<string, string> = {
+ packageManager: "Updates come through your package manager.",
+ flatpak: "Updates come through Flatpak.",
+ development: "This is a development build, so it doesn’t update itself.",
+ manual: "This copy wasn’t installed by Skykeep’s installer, so it doesn’t update itself.",
+ };
+ const busy = checking || status.phase === "checking";
+ const offered = (status.phase === "available" || status.phase === "ready") && status.version;
+ let line: string;
+ let trouble = false;
+ switch (status.phase) {
+ case "checking":
+ line = "Checking for updates…";
+ break;
+ case "available":
+ case "ready":
+ line = `Skykeep ${status.version} is available`;
+ break;
+ case "downloading":
+ line = `Downloading Skykeep ${status.version}`;
+ break;
+ case "waiting":
+ line =
+ status.waitingFor === "typing"
+ ? `Skykeep ${status.version} will install when you finish typing`
+ : `Skykeep ${status.version} will install once your changes reach iCloud`;
+ break;
+ case "installing":
+ line = `Installing Skykeep ${status.version}`;
+ break;
+ case "failed":
+ line = status.problem ?? "Couldn’t check for updates. Try again later.";
+ trouble = true;
+ break;
+ case "current":
+ line = `Skykeep ${status.current} is up to date · ${checkedLine(status.checkedAt)}`;
+ break;
+ default:
+ line = `Skykeep ${status.current} · ${checkedLine(status.checkedAt)}`;
+ }
+ return (
+ <>
+ <h2 className="settings-heading">Software Update</h2>
+ <section className="settings-group" aria-label="Software Update">
+ {!here ? (
+ <div className="settings-row">
+ <span className="settings-label settings-hint">{elsewhere[status.install]}</span>
+ </div>
+ ) : (
+ <>
+ <div className="settings-row">
+ <span className="settings-label settings-stack">
+ Check for Updates Automatically
+ <span className="settings-hint">Once a day, from Skykeep’s releases on GitHub</span>
+ </span>
+ <button
+ className="switch"
+ role="switch"
+ aria-checked={status.auto}
+ aria-label="Check for Updates Automatically"
+ onClick={() => {
+ const was = status;
+ setStatus({ ...status, auto: !status.auto });
+ api.updateAutoSet(!was.auto).catch(() => setStatus(was));
+ }}
+ >
+ <span className="switch-knob" />
+ </button>
+ </div>
+ <div className="settings-row">
+ <span className={`settings-label settings-hint settings-hint-wrap${trouble ? " is-trouble" : ""}`} aria-live="polite">
+ {line}
+ </span>
+ {offered ? (
+ <button className="quiet" onClick={() => void api.updateApply().catch(() => {})}>
+ Update and Restart
+ </button>
+ ) : (
+ <button
+ className="quiet"
+ disabled={busy || ["downloading", "waiting", "installing"].includes(status.phase)}
+ onClick={() => {
+ setChecking(true);
+ setStatus({ ...status, phase: "checking" });
+ api
+ .updateCheck()
+ .then(setStatus, (e) => setStatus({ ...status, phase: "failed", problem: messageOf(e) }))
+ .finally(() => setChecking(false));
+ }}
+ >
+ Check for Updates
+ </button>
+ )}
+ </div>
+ </>
+ )}
+ </section>
+ </>
+ );
+}
+
/** Notes' Sort Checked Items, Automatically: on this computer, as each iPhone keeps its own. */
function MoveCheckedRow() {
const [on, setOn] = useState(() => {
diff --git a/src/screens/SignIn.tsx b/src/screens/SignIn.tsx
index bff65a7..400dfba 100644
--- a/src/screens/SignIn.tsx
+++ b/src/screens/SignIn.tsx
@@ -158,7 +158,7 @@ export function SignIn({
<p>
<strong>Private by design.</strong> Your password never leaves this computer.
Skykeep proves you know it without sending it, and keeps your session in your
- system keyring. No Skykeep account, no Skykeep servers: it talks only to Apple, and to calendars you subscribe to.
+ system keyring. No Skykeep account and no analytics: your iCloud travels only between this computer and Apple.
</p>
<p>
<strong>Your full Apple Account password.</strong> An app-specific password opens
diff --git a/src/styles/a11y.css b/src/styles/a11y.css
index f693fd2..4a48297 100644
--- a/src/styles/a11y.css
+++ b/src/styles/a11y.css
@@ -73,6 +73,9 @@
}
/* A quiet button is a fill alone; here it has an edge too. */
:is(.quiet, .segment, .picker-button) { box-shadow: inset 0 0 0 1px var(--field-edge); }
+ /* A toast's action (Undo, Update and Restart): its words in the text colour, edged, rather
+ than the accent on a pale tint of itself, which fell just short of 4.5:1. */
+ .toast-action { color: var(--text); box-shadow: inset 0 0 0 1px var(--field-edge); }
}
/* ---- Increase Contrast, read from the desktop ---------------------------------------- */
@@ -128,6 +131,7 @@
outline-offset: -1px;
}
:root[data-contrast="more"] :is(.quiet, .segment, .picker-button) { box-shadow: inset 0 0 0 1px var(--field-edge); }
+:root[data-contrast="more"] .toast-action { color: var(--text); box-shadow: inset 0 0 0 1px var(--field-edge); }
/* ---- Forced colours (Windows High Contrast) -------------------------------------------- */
diff --git a/src/styles/kit.css b/src/styles/kit.css
index a6b687e..ed9a348 100644
--- a/src/styles/kit.css
+++ b/src/styles/kit.css
@@ -414,6 +414,21 @@ textarea.field { padding-block: 5px; resize: vertical; }
.toast-action:focus-visible { outline: var(--focus-ring); outline-offset: 1px; }
.toast-close { color: var(--text-3); }
+/* A new version of Skykeep (components/UpdateNotice): a toast's card, with room for a line,
+ its progress or notes, and its two answers at the foot. Stays until answered. */
+.update-notice { align-items: flex-start; width: min(420px, 100%); padding: 10px 12px 10px 14px; }
+.update-notice .toast-glyph { margin-top: 2px; }
+.update-glyph { color: var(--accent); }
+.update-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
+.update-line { margin: 0; padding: 0; font-weight: 600; text-wrap: pretty; }
+.update-notice.is-error .update-line { font-weight: 400; }
+.update-progress { display: flex; align-items: center; gap: 8px; }
+.update-progress .progress { flex: 1; }
+.update-percent { color: var(--text-2); font-size: var(--t-11); font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
+.update-notes summary { color: var(--text-2); cursor: default; }
+.update-notes-text { margin-top: 6px; max-height: 160px; overflow: auto; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
+.update-actions { display: flex; justify-content: flex-end; gap: 8px; }
+
/* A change Apple turned down for good (components/Unsent): in the flow, until decided. */
.unsent {
display: flex;