mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
feat(updater): macOS auto-update via Tauri Updater
- tauri-plugin-updater wired into lib.rs with pubkey + GitHub Releases endpoint in tauri.conf.json; updater:default capability granted - AppUpdater.tsx: on macOS, the download button now invokes the updater plugin (check + downloadAndInstall) which downloads the signed .app.tar.gz, verifies the minisign signature against the bundled pubkey, replaces /Applications/Psysonic.app, and relaunches. Windows and Linux keep the existing "download DMG/EXE/AppImage via reqwest then point to the folder" flow - CI: pass TAURI_SIGNING_PRIVATE_KEY + _PASSWORD to tauri-action so the .sig files are produced alongside the update bundles - New generate-manifest job (after build-macos-windows) runs scripts/generate-update-manifest.js which downloads the .sig files from the release, assembles latest.json for darwin-aarch64 and darwin-x86_64, and uploads it back as a release asset Windows will be added to latest.json once the Certum cert is active. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -166,6 +166,42 @@ export default function AppUpdater() {
|
||||
};
|
||||
|
||||
const handleDownload = async () => {
|
||||
// On macOS: use the Tauri Updater plugin — downloads .app.tar.gz, verifies
|
||||
// the minisign signature against the bundled pubkey, replaces the .app, and
|
||||
// relaunches. No manual "open the DMG" step needed.
|
||||
if (IS_MACOS) {
|
||||
setDlState('downloading');
|
||||
setDlProgress({ bytes: 0, total: 0 });
|
||||
setDlError('');
|
||||
try {
|
||||
const { check } = await import('@tauri-apps/plugin-updater');
|
||||
const update = await check();
|
||||
if (!update) {
|
||||
setDlError(t('common.updaterErrorMsg'));
|
||||
setDlState('error');
|
||||
return;
|
||||
}
|
||||
let downloaded = 0;
|
||||
let total = 0;
|
||||
await update.downloadAndInstall(event => {
|
||||
if (event.event === 'Started') {
|
||||
total = event.data.contentLength ?? 0;
|
||||
setDlProgress({ bytes: 0, total });
|
||||
} else if (event.event === 'Progress') {
|
||||
downloaded += event.data.chunkLength;
|
||||
setDlProgress({ bytes: downloaded, total });
|
||||
} else if (event.event === 'Finished') {
|
||||
setDlState('done');
|
||||
}
|
||||
});
|
||||
// downloadAndInstall replaces the .app and relaunches automatically on macOS.
|
||||
} catch (e) {
|
||||
setDlError(String(e));
|
||||
setDlState('error');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!asset) return;
|
||||
setDlState('downloading');
|
||||
setDlProgress({ bytes: 0, total: asset.size });
|
||||
|
||||
Reference in New Issue
Block a user