diff --git a/README.md b/README.md index ec69a63..20ea35c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/ui/index.html b/ui/index.html index 1e9e11f..12a2466 100644 --- a/ui/index.html +++ b/ui/index.html @@ -277,7 +277,7 @@

App

UpdatesAtmosphere
- +
AppearanceFollows Windows unless you choose.
diff --git a/ui/styles.css b/ui/styles.css index cfb904a..8975111 100644 --- a/ui/styles.css +++ b/ui/styles.css @@ -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; } } diff --git a/ui/updates.js b/ui/updates.js index c1ea96f..bc51a1c 100644 --- a/ui/updates.js +++ b/ui/updates.js @@ -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); }); }