Signed automatic updates from GitHub Releases

- Atmosphere checks the repo's latest release and offers new versions with their notes
- Updates are signed; installed copies refuse anything not signed with the project key
- Installer, macOS and AppImage builds update themselves; portable and deb/rpm link to the download
- Release workflow builds, signs and publishes every platform with latest.json on a version tag
- Check-for-updates row and automatic check setting in Settings
- Release guide in docs/releasing.md
This commit is contained in:
Christian
2026-11-18 21:25:50 -05:00
parent a5c6c2503b
commit 7f518eecc7
14 changed files with 562 additions and 12 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ jobs:
run: cargo install tauri-cli --version "^2" --locked
- name: Build installers
run: cargo tauri build
shell: bash
run: cargo tauri build --config '{"bundle":{"createUpdaterArtifacts":false}}'
- name: Portable executable
if: runner.os == 'Windows'
+92
View File
@@ -0,0 +1,92 @@
# atmosphere · release.yml · On a version tag, builds and signs every platform and publishes a GitHub Release with latest.json for in-app updates.
name: release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
check:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.v.outputs.version }}
notes: ${{ steps.v.outputs.notes }}
steps:
- uses: actions/checkout@v4
- id: v
name: Tag matches the app version
run: |
version=$(jq -r .version tauri.conf.json)
cargo_version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
tag="${GITHUB_REF_NAME#v}"
if [ "$version" != "$tag" ] || [ "$cargo_version" != "$tag" ]; then
echo "::error::Tag v$tag doesn't match tauri.conf.json ($version) and Cargo.toml ($cargo_version)."
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
{
echo "notes<<ATMO_NOTES_END"
sed '/^<!--/d' RELEASE_NOTES.md
echo "ATMO_NOTES_END"
} >> "$GITHUB_OUTPUT"
publish:
needs: check
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
name: windows-x64
- os: macos-latest
name: macos-arm64
- os: macos-13
name: macos-x64
- os: ubuntu-22.04
name: linux-x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Linux system libraries
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Tests
run: cargo test --locked
- name: Install Tauri CLI
run: cargo install tauri-cli --version "^2" --locked
- name: Build, sign and publish
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ""
with:
tauriScript: cargo tauri
tagName: v__VERSION__
releaseName: Atmosphere __VERSION__
releaseBody: ${{ needs.check.outputs.notes }}
releaseDraft: false
prerelease: false
includeUpdaterJson: true
- name: Portable executable
if: runner.os == 'Windows'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cp target/release/atmosphere.exe "Atmosphere_${{ needs.check.outputs.version }}_x64-portable.exe"
gh release upload "$GITHUB_REF_NAME" "Atmosphere_${{ needs.check.outputs.version }}_x64-portable.exe" --clobber
Generated
+256 -8
View File
@@ -260,6 +260,7 @@ dependencies = [
"tauri-plugin-clipboard-manager",
"tauri-plugin-dialog",
"tauri-plugin-opener",
"tauri-plugin-updater",
"tokio",
"trash",
"url",
@@ -706,6 +707,16 @@ dependencies = [
"version_check",
]
[[package]]
name = "core-foundation"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "core-foundation"
version = "0.10.1"
@@ -729,7 +740,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97"
dependencies = [
"bitflags 2.13.2",
"core-foundation",
"core-foundation 0.10.1",
"core-graphics-types",
"foreign-types",
"libc",
@@ -742,7 +753,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
dependencies = [
"bitflags 2.13.2",
"core-foundation",
"core-foundation 0.10.1",
"libc",
]
@@ -1929,9 +1940,11 @@ dependencies = [
"percent-encoding",
"pin-project-lite",
"socket2",
"system-configuration",
"tokio",
"tower-service",
"tracing",
"windows-registry",
]
[[package]]
@@ -2304,6 +2317,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.21",
"walkdir",
"windows-link",
]
[[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"
@@ -2577,6 +2620,12 @@ version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1"
[[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"
@@ -2913,6 +2962,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"
@@ -2996,6 +3057,12 @@ dependencies = [
"libc",
]
[[package]]
name = "openssl-probe"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1"
[[package]]
name = "option-ext"
version = "0.2.0"
@@ -3022,6 +3089,20 @@ dependencies = [
"windows-sys 0.61.2",
]
[[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.21",
]
[[package]]
name = "pango"
version = "0.18.3"
@@ -3629,15 +3710,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",
@@ -3731,6 +3817,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",
]
[[package]]
name = "rustls-pki-types"
version = "1.16.0"
@@ -3741,6 +3839,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",
"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.17"
@@ -3773,6 +3898,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"
@@ -3830,6 +3964,29 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "security-framework"
version = "3.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [
"bitflags 2.13.2",
"core-foundation 0.10.1",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "selectors"
version = "0.38.0"
@@ -4111,6 +4268,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.4"
@@ -4322,6 +4495,27 @@ dependencies = [
"syn 3.0.10",
]
[[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"
@@ -4343,7 +4537,7 @@ checksum = "d5777b06fe6435126ae8d816eba269e050e1e10d302cf5461e9c49eccabc3548"
dependencies = [
"bitflags 2.13.2",
"block2",
"core-foundation",
"core-foundation 0.10.1",
"core-graphics",
"crossbeam-channel",
"dbus",
@@ -4353,7 +4547,7 @@ dependencies = [
"gdkwayland-sys",
"gdkx11-sys",
"gtk",
"jni",
"jni 0.21.1",
"libc",
"log",
"ndk",
@@ -4421,7 +4615,7 @@ dependencies = [
"heck 0.5.0",
"http",
"image",
"jni",
"jni 0.21.1",
"libc",
"log",
"mime",
@@ -4614,6 +4808,40 @@ dependencies = [
"zbus",
]
[[package]]
name = "tauri-plugin-updater"
version = "2.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d957abbcb3f9f6c76d22a3a0f012f30880640d0bccb5634d2b12a9937e4c872b"
dependencies = [
"base64 0.23.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.21",
"time",
"tokio",
"url",
"windows-sys 0.61.2",
"zip",
]
[[package]]
name = "tauri-runtime"
version = "2.12.4"
@@ -4624,7 +4852,7 @@ dependencies = [
"dpi",
"gtk",
"http",
"jni",
"jni 0.21.1",
"objc2",
"objc2-ui-kit",
"objc2-web-kit",
@@ -4647,7 +4875,7 @@ checksum = "b8c14a025255cc9816d401635035075b09b6cc9973b7b8fd7b8fcb8753f30f92"
dependencies = [
"gtk",
"http",
"jni",
"jni 0.21.1",
"log",
"objc2",
"objc2-app-kit",
@@ -5532,6 +5760,15 @@ dependencies = [
"system-deps",
]
[[package]]
name = "webpki-root-certs"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "293198dcebfb821155b5092ab94b5a82ff180eddd7241df3bd6e66a4ffd1a585"
dependencies = [
"rustls-pki-types",
]
[[package]]
name = "webpki-roots"
version = "1.0.12"
@@ -5711,6 +5948,17 @@ dependencies = [
"windows-link",
]
[[package]]
name = "windows-registry"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
dependencies = [
"windows-link",
"windows-result",
"windows-strings",
]
[[package]]
name = "windows-result"
version = "0.4.1"
@@ -5971,7 +6219,7 @@ dependencies = [
"gtk",
"http",
"javascriptcore-rs",
"jni",
"jni 0.21.1",
"libc",
"ndk",
"objc2",
+1
View File
@@ -38,6 +38,7 @@ tauri = { version = "2", features = ["image-png"] }
tauri-plugin-clipboard-manager = "2"
tauri-plugin-dialog = "2"
tauri-plugin-opener = "2"
tauri-plugin-updater = "2"
tokio = { version = "1.54.1", features = ["full"] }
trash = "5.4.0"
url = "2.5.8"
+3 -1
View File
@@ -123,12 +123,13 @@ It's built for media you **own or have the rights to keep**, such as your own up
- **Portable:** `atmosphere.exe` runs from any folder. Put an empty file named `portable` next to it, and all data stays beside it.
- **Tidy:** temp files and stalled partial downloads are cleared automatically on launch, whenever downloads finish, and on exit. **Settings → Storage** shows what Atmosphere keeps and lets you clean it up.
- **Back up and restore** your settings, stats, liked songs and artist photos as a single `.zip` from **Settings → Storage**.
- **Automatic updates:** Atmosphere checks this repo's releases and offers each new version with its notes. Updates are signed and verified before they install. You can turn checking off in Settings.
- **Clean uninstall:** the Windows uninstaller keeps your data by default. If you choose to delete it, you're offered a backup first. Your music files are never touched.
## Get started
### Download
Grab a build from the [Actions](../../actions) tab, under the latest run's artifacts:
Grab the latest version from [Releases](../../releases/latest). Installed copies keep themselves up to date.
| Platform | Files |
| --- | --- |
@@ -202,6 +203,7 @@ Atmosphere is for media you own or are allowed to keep.
| `src/direct.rs` | Checks and reads direct audio and video file links |
| `src/backup.rs` | Backup and restore of settings, stats and liked songs |
| `src/api.rs` | The opt-in local API for other apps ([guide](docs/api.md)) |
| `src/updates.rs` | Signed in-app updates from GitHub Releases ([releasing](docs/releasing.md)) |
| `src/tagging.rs` | Writes tags, cover art and lyrics into files |
| `ui/` | The interface in plain HTML, CSS and JS (no build step) |
| `branding/`, `tools/` | The logo, wordmark lockups and installer art, all generated from code |
+6
View File
@@ -0,0 +1,6 @@
<!-- atmosphere · RELEASE_NOTES.md · What's new in the next release; shown on GitHub and in the app's update dialog -->
The first public release of Atmosphere.
- A fast music library and player with folder playlists (including folders you already have), synced lyrics, stats and a mini player.
- Save audio and video you have the rights to keep from SoundCloud, YouTube, Bandcamp, direct file links and 1,000+ other sites, with honest quality choices and full tagging.
- Backups, a clean uninstaller, an opt-in local API for other apps, and automatic signed updates.
+5
View File
@@ -14,6 +14,7 @@ mod media;
mod settings;
mod storage;
mod tagging;
mod updates;
use base64::Engine as _;
use downloader::{Downloader, JobRequest, SaveOptions};
@@ -442,6 +443,7 @@ fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_clipboard_manager::init())
.register_asynchronous_uri_scheme_protocol("atmo", |ctx, request, responder| {
@@ -463,6 +465,9 @@ fn main() {
})
.invoke_handler(tauri::generate_handler![
signin_check,
updates::app_version,
updates::update_check,
updates::update_install,
api_status,
api_new_token,
api_publish,
+4 -1
View File
@@ -61,6 +61,7 @@ pub struct Settings {
pub cookies_browser: String,
pub cookies_file: String,
pub api_enabled: bool,
pub check_updates: bool,
pub api_port: u16,
pub api_read: bool,
pub api_control: bool,
@@ -106,6 +107,7 @@ impl Default for Settings {
cookies_browser: String::new(),
cookies_file: String::new(),
api_enabled: false,
check_updates: true,
api_port: 47823,
api_read: true,
api_control: true,
@@ -149,6 +151,7 @@ pub struct SettingsPatch {
pub cookies_browser: Option<String>,
pub cookies_file: Option<String>,
pub api_enabled: Option<bool>,
pub check_updates: Option<bool>,
pub api_port: Option<u16>,
pub api_read: Option<bool>,
pub api_control: Option<bool>,
@@ -201,7 +204,7 @@ impl Settings {
($($f:ident),*) => { $( if let Some(v) = p.$f { self.$f = v; } )* };
}
set!(save_as, embed_metadata, collection_folders, number_tracks, skip_downloaded, sponsorblock, embed_subtitles, embed_chapters, watch_clipboard);
set!(api_enabled, api_read, api_control, api_links);
set!(api_enabled, api_read, api_control, api_links, check_updates);
if let Some(p) = p.api_port.filter(|p| *p >= 1024) {
self.api_port = p;
}
+81
View File
@@ -0,0 +1,81 @@
// atmosphere · updates.rs · Checks GitHub Releases for signed updates and installs them, or links to the download where self-update isn't possible
use crate::{err, AppState, CmdResult};
use serde::Serialize;
use tauri::{AppHandle, Emitter, State};
use tauri_plugin_updater::UpdaterExt;
pub const RELEASES: &str = "https://github.com/pvrzz/atmosphere/releases/latest";
const PROGRESS_EVENT: &str = "atmosphere://update";
#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct UpdateInfo {
version: String,
current: String,
notes: Option<String>,
date: Option<String>,
can_install: bool,
page: String,
}
pub fn can_self_update() -> bool {
if crate::engine::portable_root().is_some() {
return false;
}
if cfg!(target_os = "linux") {
return std::env::var_os("APPIMAGE").is_some();
}
true
}
#[tauri::command]
pub fn app_version(app: AppHandle) -> serde_json::Value {
serde_json::json!({ "version": app.package_info().version.to_string(), "canSelfUpdate": can_self_update(), "page": RELEASES })
}
#[tauri::command]
pub async fn update_check(app: AppHandle) -> CmdResult<Option<UpdateInfo>> {
let updater = app.updater().map_err(|e| e.to_string())?;
let found = match updater.check().await {
Ok(found) => found,
Err(tauri_plugin_updater::Error::ReleaseNotFound) => None,
Err(e) => return Err(format!("Couldn't reach GitHub to check for updates ({e})")),
};
Ok(found.map(|u| UpdateInfo {
version: u.version.clone(),
current: u.current_version.clone(),
notes: u.body.clone().filter(|b| !b.trim().is_empty()),
date: u.date.map(|d| d.to_string()),
can_install: can_self_update(),
page: RELEASES.into(),
}))
}
#[tauri::command]
pub async fn update_install(app: AppHandle, state: State<'_, AppState>) -> CmdResult<()> {
if !can_self_update() {
return Err("This copy of Atmosphere can't update itself. Download the new version instead.".into());
}
let update = app
.updater()
.map_err(|e| e.to_string())?
.check()
.await
.map_err(|e| format!("Couldn't check for updates ({e})"))?
.ok_or("Atmosphere is already up to date.")?;
state.dl.cancel_all();
let mut received: u64 = 0;
let progress = app.clone();
update
.download_and_install(
move |chunk, total| {
received += chunk as u64;
let _ = progress.emit(PROGRESS_EVENT, serde_json::json!({ "received": received, "total": total }));
},
|| {},
)
.await
.map_err(|e| err(anyhow::anyhow!("The update couldn't be installed ({e})")))?;
crate::storage::wipe_temp();
app.restart();
}
+12
View File
@@ -64,6 +64,18 @@
"webviewInstallMode": {
"type": "downloadBootstrapper"
}
},
"createUpdaterArtifacts": true
},
"plugins": {
"updater": {
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEE0NzUxREY1OTc5QTJGRjQKUldUMEw1cVg5UjExcEk0dUM2WFlyWURKMkpOZnVZcWZ3eDdiazVoZWdlcEJnbEVpVC9ZWmxMU2wK",
"endpoints": [
"https://github.com/pvrzz/atmosphere/releases/latest/download/latest.json"
],
"windows": {
"installMode": "passive"
}
}
}
}
+1
View File
@@ -157,6 +157,7 @@ async function init() {
bindBackup();
bindMini();
bindConnect();
bindUpdates();
bindStats();
await listen("atmosphere://job", (e) => onJob(e.payload));
await listen("atmosphere://probe", (e) => onProbe(e.payload));
+4
View File
@@ -52,6 +52,7 @@
<div class="sidebar-foot">
<button class="nav-item" data-nav="settings"><span class="i" data-icon="settings"></span><span>Settings</span></button>
<button class="update-chip" id="updateChip" hidden></button>
<button class="engine-state" id="engineState" data-nav="settings" data-anchor="engine"></button>
</div>
</aside>
@@ -258,6 +259,8 @@
<h2 id="set-app">App</h2>
<div class="group">
<div class="setting"><div><strong>Updates</strong><span id="updateInfo">Atmosphere</span></div><button class="btn" id="updateBtn" type="button"><span class="label">Check for updates</span><span class="spin" aria-hidden="true"></span></button></div>
<label class="setting"><div><strong>Check for updates automatically</strong><span>When Atmosphere opens, it asks its GitHub releases page whether there's a newer version. Every update is signed and checked before it installs.</span></div><input type="checkbox" class="switch" data-key="checkUpdates" /></label>
<div class="setting">
<div><strong>Appearance</strong><span>Follows Windows unless you choose.</span></div>
<div class="seg" data-seg="theme"><button type="button" data-value="system">System</button><button type="button" data-value="light">Light</button><button type="button" data-value="dark">Dark</button></div>
@@ -375,5 +378,6 @@
<script src="stats.js"></script>
<script src="miniplayer.js"></script>
<script src="connect.js"></script>
<script src="updates.js"></script>
</body>
</html>
+8
View File
@@ -969,3 +969,11 @@ body.mini-mode > *:not(#mini):not(.toasts):not(.modal-wrap):not(script) { displa
.api-scope.dim { opacity: 0.55; }
#apiDocs { color: var(--accent); font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
#apiDocs:hover { text-decoration-color: currentColor; }
/* updates */
.update-chip { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; margin-bottom: 6px; border-radius: var(--r-ctl); background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; font-size: 12.5px; text-align: left; transition: background-color 120ms var(--ease); }
.update-chip:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.update-chip .i svg { width: 16px; height: 16px; }
.update-notes { max-height: 220px; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: 10px; background: var(--surface-2, var(--surface)); border: 1px solid var(--hairline); color: var(--text-2); }
.update-bar { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; margin: var(--s3) 0 var(--s2); }
.update-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 160ms linear; }
+86
View File
@@ -0,0 +1,86 @@
// atmosphere · updates.js · Update chip, what's-new dialog and install progress for signed GitHub releases
const Upd = { info: null, app: null, busy: false };
async function checkUpdates(manual = false) {
const btn = $("#updateBtn");
if (manual && btn) {
btn.classList.add("loading");
btn.disabled = true;
}
try {
Upd.info = await invoke("update_check");
renderUpdate();
if (manual) {
if (Upd.info) openUpdate();
else toast("You're on the latest version.", "ok");
}
} catch (e) {
if (manual) toast(errText(e), "err");
} finally {
if (manual && btn) {
btn.disabled = false;
btn.classList.remove("loading");
}
}
}
function renderUpdate() {
const chip = $("#updateChip");
const info = $("#updateInfo");
if (chip) {
chip.hidden = !Upd.info;
if (Upd.info) chip.replaceChildren(icon("sparkles"), h("span", {}, `Update to ${Upd.info.version}`));
}
if (info && Upd.app) {
info.textContent = Upd.info
? `Atmosphere ${Upd.app.version}. Version ${Upd.info.version} is available.`
: `Atmosphere ${Upd.app.version}${Upd.app.canSelfUpdate ? "" : ". This copy updates by downloading the new version."}`;
}
}
async function openUpdate() {
const u = Upd.info;
if (!u || Upd.busy) return;
const notes = (u.notes || "").trim();
const body = h("div", { class: "stack" },
h("p", { class: "muted" }, `You have ${u.current}.${u.date ? ` Released ${new Intl.DateTimeFormat(undefined, { dateStyle: "long" }).format(new Date(u.date.replace(" ", "T").replace(/ .*$/, "")))}.` : ""}`),
notes ? h("div", { class: "update-notes" }, notes) : null,
u.canInstall ? h("p", { class: "muted small" }, "Atmosphere restarts to finish. Downloads in progress stop, and your library, settings and stats stay as they are.") : h("p", { class: "muted small" }, "This copy can't replace itself, so the new version opens on GitHub for you to download."));
const go = await modal(`Atmosphere ${u.version} is here`, body, [{ label: "Later", value: false }, { label: u.canInstall ? "Update and restart" : "Download", value: true, primary: true }]);
if (!go) return;
if (!u.canInstall) return invoke("open_link", { url: u.page }).catch((e) => toast(errText(e), "err"));
installUpdate();
}
async function installUpdate() {
Upd.busy = true;
Player.flushListen?.();
const bar = h("div", { class: "update-bar" }, h("span", { class: "update-fill" }));
const label = h("p", { class: "muted small" }, "Downloading…");
const wrap = h("div", { class: "modal-wrap" }, h("div", { class: "modal", role: "dialog", "aria-modal": "true", "aria-label": "Updating Atmosphere" }, h("h2", {}, `Updating to ${Upd.info.version}`), bar, label));
document.body.append(wrap);
const off = await listen("atmosphere://update", (e) => {
const { received, total } = e.payload || {};
if (total) {
bar.firstChild.style.width = `${Math.min(100, (received / total) * 100).toFixed(1)}%`;
label.textContent = `${(received / 1048576).toFixed(1)} of ${(total / 1048576).toFixed(1)} MB`;
if (received >= total) label.textContent = "Installing… Atmosphere will restart.";
} else label.textContent = `${(received / 1048576).toFixed(1)} MB`;
});
try {
await invoke("update_install");
} catch (e) {
off();
wrap.remove();
Upd.busy = false;
toast(errText(e), "err");
}
}
async function bindUpdates() {
Upd.app = await invoke("app_version").catch(() => null);
renderUpdate();
$("#updateBtn")?.addEventListener("click", () => (Upd.info ? openUpdate() : checkUpdates(true)));
$("#updateChip")?.addEventListener("click", openUpdate);
if (state.settings?.checkUpdates !== false) setTimeout(() => checkUpdates(false), 5000);
}