feat(updater): in-app update on desktop, releases link on Android
Anyone who installed an AppImage or ran the Windows installer was frozen
on that version forever. Nothing in the app ever mentioned a new release
existed, and the release notes were the only announcement.
Desktop now checks a signed manifest, shows the version and its notes in
Settings, and installs and relaunches on request. The signature check is
the whole point: it is what stops a substituted download from being
installed by the app itself. Windows binaries stay unsigned for
SmartScreen purposes -- that is a code-signing certificate, a separate
problem -- but the update payload is verified against our own key.
Android is deliberately not wired to the updater. An app may not replace
its own APK; that is the package installer's job, and the plugin has no
Android implementation. It gets a link to the releases page instead of a
button that would throw.
The plugins are gated with a target-triple cfg rather than
cfg(desktop). Cargo only evaluates target cfgs in a [target.'cfg(..)']
table, so cfg(desktop) matches nothing, silently drops the dependency,
and fails much later with "Permission updater:default not found" -- which
is exactly what the first attempt here did.
Where the manifest lives took some finding. This Gitea serves
/releases/download/<tag>/<asset> but 404s on
/releases/latest/download/<asset> (verified against a real asset), so
there is no stable latest-release URL. The gitea-pages branch is
force-pushed wholesale by publish-docs.yml, so it cannot host the file
either. latest.json therefore gets its own orphan branch, read over the
raw-file URL, and is published from a scratch repo in RUNNER_TEMP rather
than by switching branches in the checkout -- doing that would have left
the following steps standing on a one-commit history, and the next step
but one runs release:notes against the real commit range.
Also fixed, all of it release-integrity:
- "appimage" is in bundle.targets. The release notes have advertised an
AppImage for months; tauri.conf.json never built one, the artifact
step globbed for *.AppImage, found nothing, and said nothing. The
step now fails instead.
- The .AppImage.tar.gz/.sig pair and the NSIS .sig are collected. A
manifest referencing a signature that was never uploaded fails only
on the user's machine, so the manifest step also refuses to write an
entry with an empty signature.
- Release notes are generated by release:notes from the traceability
graph, which is what CLAUDE.md has asked for all along, instead of a
fixed heredoc that said "see CHANGELOG.md for detailed changes" and
linked "GitHub Issues" on a Gitea-hosted project.
- The notes tell users how to verify a download with SHA256SUMS.
Requirements UR-077 / DR-217, tests UT-208 (12 cases over the version
comparison and the platform decision, including that a pre-release does
not offer itself as an upgrade to the matching release).
Verified: 1070 frontend tests, cargo check for both the host and
aarch64-linux-android (confirming the plugins are absent there), clippy
-D warnings, svelte-check 0 errors.
This commit is contained in:
@@ -30,6 +30,14 @@
|
||||
import { experimentalNativeVideo } from "$lib/stores/nativeVideo";
|
||||
import { getPlaybackCapabilities } from "$lib/services/playbackCapabilities";
|
||||
import { createLogger } from "$lib/utils/logger";
|
||||
import { openUrl } from "@tauri-apps/plugin-opener";
|
||||
import {
|
||||
checkForUpdate,
|
||||
installUpdate,
|
||||
updateCapability,
|
||||
RELEASES_URL,
|
||||
type UpdateAction,
|
||||
} from "$lib/utils/updateCheck";
|
||||
|
||||
const log = createLogger("SettingsPage");
|
||||
|
||||
@@ -140,6 +148,11 @@
|
||||
onMount(async () => {
|
||||
await loadSettings();
|
||||
supportsNativeVideo = (await getPlaybackCapabilities()).supportsNativeVideo;
|
||||
|
||||
// Which update story this platform gets. Android cannot install its own
|
||||
// APK, so it is offered the releases page instead of an install button.
|
||||
const { platform } = await import("@tauri-apps/plugin-os");
|
||||
canInstallUpdates = updateCapability(platform()) === "install";
|
||||
});
|
||||
|
||||
async function loadSettings() {
|
||||
@@ -419,6 +432,54 @@
|
||||
cacheConfig.wifiOnly = !cacheConfig.wifiOnly;
|
||||
persistCache();
|
||||
}
|
||||
// ---------------------------------------------------------------------
|
||||
// Updates
|
||||
//
|
||||
// The decision of *what to offer* lives in $lib/utils/updateCheck.ts and is
|
||||
// unit-tested there; this component only renders the answer. On Android the
|
||||
// answer is always "open the releases page" -- the updater plugin is not
|
||||
// compiled for that target at all.
|
||||
//
|
||||
// TRACES: UR-077 | DR-217
|
||||
let updateState = $state<"idle" | "checking" | "current" | "available" | "installing" | "failed">(
|
||||
"idle",
|
||||
);
|
||||
let updateAction = $state<UpdateAction>({ kind: "none" });
|
||||
let updateProgress = $state(0);
|
||||
let canInstallUpdates = $state(true);
|
||||
|
||||
async function handleCheckForUpdates() {
|
||||
updateState = "checking";
|
||||
try {
|
||||
if (!canInstallUpdates) {
|
||||
// Nothing to interrogate on mobile; go straight to the download page.
|
||||
await openUrl(RELEASES_URL);
|
||||
updateState = "idle";
|
||||
return;
|
||||
}
|
||||
const action = await checkForUpdate();
|
||||
updateAction = action;
|
||||
updateState = action.kind === "none" ? "current" : "available";
|
||||
} catch (e) {
|
||||
log.warn("update check failed", e);
|
||||
updateState = "failed";
|
||||
}
|
||||
}
|
||||
|
||||
async function handleInstallUpdate() {
|
||||
updateState = "installing";
|
||||
updateProgress = 0;
|
||||
try {
|
||||
// installUpdate relaunches the app on success, so there is deliberately
|
||||
// no "done" state here -- the process is gone before we could set one.
|
||||
await installUpdate((fraction) => {
|
||||
updateProgress = fraction;
|
||||
});
|
||||
} catch (e) {
|
||||
log.error("update install failed", e);
|
||||
updateState = "failed";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="max-w-2xl mx-auto space-y-8 p-6">
|
||||
@@ -1096,6 +1157,90 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Updates.
|
||||
Desktop installs in place; Android can only be pointed at the
|
||||
releases page, because an app may not replace its own APK. The
|
||||
decision lives in $lib/utils/updateCheck.ts, not in this markup.
|
||||
TRACES: UR-077 | DR-217 -->
|
||||
<div class="border-t border-gray-700 pt-6">
|
||||
<h2 class="text-2xl font-bold text-white mb-4">Updates</h2>
|
||||
|
||||
<div class="bg-[var(--color-surface)] rounded-lg p-6 space-y-4">
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<h3 class="text-lg font-semibold text-white">
|
||||
{canInstallUpdates ? "Check for updates" : "Get the latest version"}
|
||||
</h3>
|
||||
<p class="text-sm text-gray-400 mt-1">
|
||||
{#if canInstallUpdates}
|
||||
Downloads are verified against JellyTau's signing key before anything is
|
||||
installed.
|
||||
{:else}
|
||||
Android installs are handled by the system installer — this opens the releases
|
||||
page.
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
class="px-4 py-2 rounded-lg bg-[var(--color-jellyfin)] text-white font-medium disabled:opacity-50 whitespace-nowrap"
|
||||
onclick={handleCheckForUpdates}
|
||||
disabled={updateState === "checking" || updateState === "installing"}
|
||||
>
|
||||
{#if updateState === "checking"}
|
||||
Checking…
|
||||
{:else if canInstallUpdates}
|
||||
Check now
|
||||
{:else}
|
||||
Open releases
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#if updateState === "current"}
|
||||
<p class="text-sm text-green-400">You're on the latest version.</p>
|
||||
{:else if updateState === "failed"}
|
||||
<p class="text-sm text-yellow-400">
|
||||
Couldn't reach the update server. This is safe to ignore — JellyTau keeps working.
|
||||
</p>
|
||||
{:else if updateState === "installing"}
|
||||
<div>
|
||||
<p class="text-sm text-gray-300 mb-2">
|
||||
Downloading… {Math.round(updateProgress * 100)}%
|
||||
</p>
|
||||
<div class="h-2 bg-gray-700 rounded-full overflow-hidden">
|
||||
<div
|
||||
class="h-full bg-[var(--color-jellyfin)] transition-all"
|
||||
style="width: {updateProgress * 100}%"
|
||||
></div>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 mt-2">JellyTau will restart when this finishes.</p>
|
||||
</div>
|
||||
{:else if updateState === "available" && updateAction.kind === "install"}
|
||||
<div class="border border-gray-700 rounded-lg p-4 space-y-3">
|
||||
<p class="text-white font-medium">Version {updateAction.version} is available</p>
|
||||
{#if updateAction.notes}
|
||||
<pre
|
||||
class="text-sm text-gray-300 whitespace-pre-wrap max-h-48 overflow-y-auto">{updateAction.notes}</pre>
|
||||
{/if}
|
||||
<button
|
||||
class="px-4 py-2 rounded-lg bg-[var(--color-jellyfin)] text-white font-medium"
|
||||
onclick={handleInstallUpdate}
|
||||
>
|
||||
Install and restart
|
||||
</button>
|
||||
</div>
|
||||
{:else if updateState === "available" && updateAction.kind === "open-releases"}
|
||||
<button
|
||||
class="text-sm text-[var(--color-jellyfin)] underline"
|
||||
onclick={() =>
|
||||
openUrl(updateAction.kind === "open-releases" ? updateAction.url : RELEASES_URL)}
|
||||
>
|
||||
Version {updateAction.version} is available — open the releases page
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Box -->
|
||||
<div class="bg-blue-900/20 border border-blue-800 rounded-lg p-4">
|
||||
<div class="flex gap-3">
|
||||
|
||||
Reference in New Issue
Block a user