Check for updates while open, one-click update notice, and a release script

- Rechecks every few hours while Atmosphere is open, and when it regains focus
- A notice announces each new version once, with Update and restart and What's new
- scripts/release.ps1 bumps the version everywhere, commits and tags, and can push
This commit is contained in:
Christian
2026-11-20 00:37:37 -05:00
parent dc8e489c90
commit 08fce65f52
4 changed files with 44 additions and 4 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ 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.
- **Automatic updates:** Atmosphere checks this repo's releases when it opens and every few hours while it's open. When there's a new version, a notice shows what's new with **Update and restart**: one click downloads it, verifies its signature, installs it and reopens Atmosphere where you left off. 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
+1 -1
View File
@@ -277,7 +277,7 @@
<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>
<label class="setting"><div><strong>Check for updates automatically</strong><span>When Atmosphere opens, and every few hours while it's open, it asks its GitHub releases page whether there's a newer version. You choose when to install, and every update is signed and checked first.</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>
+11
View File
@@ -1204,3 +1204,14 @@ body.mini-mode > *:not(#mini):not(.toasts):not(.modal-wrap):not(script) { displa
.pick-logo { display: grid; gap: 6px; padding: var(--s3); border-radius: var(--r-ctl); border: 1px solid var(--border); background: repeating-conic-gradient(rgba(127, 127, 127, 0.14) 0 25%, transparent 0 50%) 0 0 / 14px 14px; color: var(--text-2); font-size: 12px; text-align: center; cursor: pointer; }
.pick-logo img { width: 100%; height: 56px; object-fit: contain; }
.pick-logo.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
/* update notice */
.update-notice { position: fixed; right: var(--s5); bottom: 100px; z-index: 95; width: min(380px, calc(100vw - 32px)); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s2) var(--s3); align-items: start; padding: var(--s4); border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); animation: menuIn 200ms var(--ease); }
.update-notice.out { opacity: 0; transform: translateY(6px); transition: opacity 180ms var(--ease), transform 180ms var(--ease); }
.un-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.un-text { display: grid; gap: 2px; min-width: 0; }
.un-text strong { font-size: 13.5px; }
.un-text span { color: var(--text-2); font-size: 12.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.un-actions { grid-column: 2 / 4; display: flex; gap: var(--s2); flex-wrap: wrap; }
.un-close { grid-column: 3; grid-row: 1; margin: -6px -6px 0 0; }
@media (prefers-reduced-motion: reduce) { .update-notice { animation: none; } .update-notice.out { transition: none; } }
+31 -2
View File
@@ -1,5 +1,6 @@
// atmosphere · updates.js · Update chip, what's-new dialog and install progress for signed GitHub releases
const Upd = { info: null, app: null, busy: false };
const Upd = { info: null, app: null, busy: false, checkedAt: 0 };
const UPDATE_EVERY = 6 * 3600 * 1000;
async function checkUpdates(manual = false) {
const btn = $("#updateBtn");
@@ -8,8 +9,10 @@ async function checkUpdates(manual = false) {
btn.disabled = true;
}
try {
Upd.checkedAt = Date.now();
Upd.info = await invoke("update_check");
renderUpdate();
if (!manual) updateNotice();
if (manual) {
if (Upd.info) openUpdate();
else toast("You're on the latest version.", "ok");
@@ -38,6 +41,29 @@ function renderUpdate() {
}
}
function noticedVersion() {
try { return localStorage.getItem("atmo.updateNoticed"); } catch { return null; }
}
function updateNotice() {
const u = Upd.info;
if (!u || Upd.busy || $("#updateNotice") || noticedVersion() === u.version || (typeof Mini !== "undefined" && Mini.on)) return;
try { localStorage.setItem("atmo.updateNoticed", u.version); } catch {}
const first = (u.notes || "").split("\n").map((l) => l.replace(/^[-*#\s]+/, "").trim()).find(Boolean);
const close = () => {
el.classList.add("out");
setTimeout(() => el.remove(), 200);
};
const el = h("div", { class: "update-notice", id: "updateNotice", role: "status" },
h("span", { class: "un-icon" }, icon("sparkles")),
h("div", { class: "un-text" }, h("strong", {}, `Atmosphere ${u.version} is out`), h("span", {}, first || "A new version is ready to install.")),
h("div", { class: "un-actions" },
h("button", { class: "btn small primary", type: "button", onclick: () => { close(); if (u.canInstall) installUpdate(); else invoke("open_link", { url: u.page }).catch(() => {}); } }, u.canInstall ? "Update and restart" : "Download"),
h("button", { class: "btn small", type: "button", onclick: () => { close(); openUpdate(); } }, "What's new")),
h("button", { class: "icon-btn un-close", type: "button", "aria-label": "Not now", title: "Not now. It stays in the sidebar.", onclick: close }, icon("x")));
document.body.append(el);
}
async function openUpdate() {
const u = Upd.info;
if (!u || Upd.busy) return;
@@ -82,5 +108,8 @@ async function bindUpdates() {
renderUpdate();
$("#updateBtn")?.addEventListener("click", () => (Upd.info ? openUpdate() : checkUpdates(true)));
$("#updateChip")?.addEventListener("click", openUpdate);
if (state.settings?.checkUpdates !== false) setTimeout(() => checkUpdates(false), 5000);
const auto = () => state.settings?.checkUpdates !== false && !Upd.busy;
if (auto()) setTimeout(() => checkUpdates(false), 5000);
setInterval(() => { if (auto() && Date.now() - Upd.checkedAt >= UPDATE_EVERY) checkUpdates(false); }, 15 * 60 * 1000);
window.addEventListener("focus", () => { if (auto() && Upd.checkedAt && Date.now() - Upd.checkedAt >= UPDATE_EVERY) checkUpdates(false); });
}