From 61c67035132855078ffbc9895b0e7c9ec58a6611 Mon Sep 17 00:00:00 2001 From: Jure <44338+hoornet@users.noreply.github.com> Date: Sat, 16 May 2026 13:43:38 +0200 Subject: [PATCH] =?UTF-8?q?Bump=20to=20v0.12.15=20=E2=80=94=20install-awar?= =?UTF-8?q?e=20update=20banner=20(Arch/deb/rpm=20get=20manual=20update=20g?= =?UTF-8?q?uidance)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 10 +++++++++ PKGBUILD | 2 +- package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/src/lib.rs | 39 +++++++++++++++++++++++++++++++++ src-tauri/tauri.conf.json | 2 +- src/App.tsx | 41 +++++++++++++++++++++++++++-------- src/hooks/useUpdater.ts | 18 +++++++++++++++ 9 files changed, 104 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6794605..762bcc1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,6 +69,16 @@ jobs: > **Windows note:** The installer is not yet code-signed. Windows SmartScreen will show an "Unknown publisher" warning — click "More info → Run anyway" to install. + ### v0.12.15 — Honest update banner on Linux + + The "Update & restart" banner now adapts to how Vega was installed. On a package-manager install — the AUR `vega-nostr-git` package, or a `.deb`/`.rpm` — the in-app updater can't replace a root-owned binary under `/usr`, so the button did nothing. The banner now detects the install kind and shows the right path: + + - **Arch (AUR install):** shows the update command inline with a "Copy command" button — `yay -S vega-nostr-git`. + - **Debian / Fedora (.deb / .rpm):** a "View release" button opens the GitHub release page for a manual download. + - **Windows, macOS, AppImage, portable builds:** unchanged — one-click "Update & restart" still works. + + The new-version notification itself always worked everywhere; only the install action needed to become install-method-aware. + ### v0.12.14 — Fix macOS auto-updater macOS users on Apple Silicon now get in-app update notifications. Since before v0.12.9, the macOS build shipped a `.dmg` for manual download but never produced the `.app.tar.gz` updater artifact — so `latest.json` carried no macOS entry and the in-app updater stayed silent on Macs. The `app` bundle target was missing from the build config; that's the target that generates the updater archive and its signature. Linux and Windows auto-update were unaffected throughout. diff --git a/PKGBUILD b/PKGBUILD index c86c1eb..9c19eee 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: hoornet pkgname=vega-nostr -pkgver=0.12.14 +pkgver=0.12.15 pkgrel=1 pkgdesc="Cross-platform Nostr desktop client with Lightning integration" arch=('x86_64') diff --git a/package.json b/package.json index 6bca117..0a487d0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vega", "private": true, - "version": "0.12.14", + "version": "0.12.15", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 6433554..0ba523b 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -5429,7 +5429,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vega" -version = "0.12.14" +version = "0.12.15" dependencies = [ "futures-util", "hex", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2d85967..82b0caf 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vega" -version = "0.12.14" +version = "0.12.15" description = "Cross-platform Nostr desktop client with Lightning integration" authors = ["hoornet"] edition = "2021" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 0eb0add..cf925a2 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -407,6 +407,44 @@ fn relay_get_stats(state: tauri::State) -> Result serde_json::Value { + #[cfg(any(target_os = "windows", target_os = "macos"))] + { + serde_json::json!({ "can_self_update": true, "kind": "updater" }) + } + #[cfg(target_os = "linux")] + { + // AppImage is self-contained and user-writable — updater works. + if std::env::var("APPIMAGE").is_ok() { + return serde_json::json!({ "can_self_update": true, "kind": "appimage" }); + } + let exe = std::env::current_exe() + .map(|p| p.to_string_lossy().into_owned()) + .unwrap_or_default(); + if exe.starts_with("/usr/") || exe.starts_with("/opt/") { + // Heuristic: pacman present ⇒ almost certainly the AUR package. + let is_arch = std::path::Path::new("/usr/bin/pacman").exists(); + return serde_json::json!({ + "can_self_update": false, + "kind": if is_arch { "pacman" } else { "deb-rpm" } + }); + } + // Ran from home dir / extracted tarball — let the updater try. + serde_json::json!({ "can_self_update": true, "kind": "portable" }) + } +} + // ── App entry ──────────────────────────────────────────────────────────────── #[cfg_attr(mobile, tauri::mobile_entry_point)] @@ -532,6 +570,7 @@ pub fn run() { db_load_articles, relay_get_port, relay_get_stats, + install_info, ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 90768f2..e3125bf 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Vega", - "version": "0.12.14", + "version": "0.12.15", "identifier": "com.hoornet.vega", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/App.tsx b/src/App.tsx index 0a29a85..ef123fd 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -34,22 +34,45 @@ import { useUpdater } from "./hooks/useUpdater"; import { useKeyboardShortcuts } from "./hooks/useKeyboardShortcuts"; function UpdateBanner() { - const { available, version, installing, error, install, dismiss } = useUpdater(); + const { available, version, installing, error, canSelfUpdate, kind, install, dismiss } = useUpdater(); + const [copied, setCopied] = useState(false); if (!available) return null; + + const aurCmd = "yay -S vega-nostr-git"; + return (
- Vega {version} is available.{" "} + Vega {version} is available. + {!canSelfUpdate && kind === "pacman" && ( + <> Update with {aurCmd} + )} {error && {error}}
- + {canSelfUpdate ? ( + + ) : kind === "pacman" ? ( + + ) : ( + + )}
diff --git a/src/hooks/useUpdater.ts b/src/hooks/useUpdater.ts index f83199d..80f7943 100644 --- a/src/hooks/useUpdater.ts +++ b/src/hooks/useUpdater.ts @@ -1,6 +1,12 @@ import { useEffect, useState } from "react"; import { check } from "@tauri-apps/plugin-updater"; import { relaunch } from "@tauri-apps/plugin-process"; +import { invoke } from "@tauri-apps/api/core"; + +interface InstallInfo { + can_self_update: boolean; + kind: string; +} interface UpdateState { available: boolean; @@ -8,6 +14,8 @@ interface UpdateState { body: string | null; installing: boolean; error: string | null; + canSelfUpdate: boolean; + kind: string; install: () => Promise; dismiss: () => void; } @@ -19,6 +27,14 @@ export function useUpdater(): UpdateState { const [installing, setInstalling] = useState(false); const [error, setError] = useState(null); const [dismissed, setDismissed] = useState(false); + // Optimistic default: assume the updater works until the backend says otherwise. + const [installInfo, setInstallInfo] = useState({ can_self_update: true, kind: "updater" }); + + useEffect(() => { + invoke("install_info") + .then(setInstallInfo) + .catch(() => { /* keep optimistic default */ }); + }, []); useEffect(() => { // Check for updates ~5 s after startup (non-blocking) @@ -58,6 +74,8 @@ export function useUpdater(): UpdateState { body, installing, error, + canSelfUpdate: installInfo.can_self_update, + kind: installInfo.kind, install, dismiss: () => setDismissed(true), };