fix(update): enable self-update for installed app via release tarball
release / release (push) Has been cancelled
tests / build-test (push) Has been cancelled

The update dialog offered a disabled button when running from an install prefix without a source checkout, and the version file lagged behind the release tag. Add a tarball download + rebuild + reinstall path to the same prefix (sudo only for system prefixes) and bump the version file to 1.3.1.
This commit is contained in:
BlackAngelTV committed 2026-09-10 20:08:08 +02:00
1 parent 4200f63b4f
commit 40a01b0060
4 files changed
+227 -55

No files matched your search

+24 -9
View File
@@ -9,9 +9,12 @@
// Checks the Gitea repository for new releases and tracks the last check
// state in a JSON file so the app only queries the API once per day.
// When the user accepts, the app updates itself by pulling + rebuilding
// the source repository in the background; the running binary stays
// untouched until the next launch.
// Self-update works in two modes:
// - source checkout present (dev): git pull + rebuild in place;
// - installed without the repo (~/.local/bin, /usr/...): download the
// release tarball, build it in /tmp and `cmake --install` to the same
// prefix the running binary was installed to (sudo when needed).
// The running binary stays untouched until the next launch.
class UpdateManager : public QObject {
Q_OBJECT
public:
@@ -38,16 +41,26 @@ public:
static bool isNewerVersion(const QString& remote, const QString& local);
// Path of the source repository, or empty when the app is installed
// without the repo (e.g. ~/.local/bin). Used for self-update.
// without the repo (e.g. ~/.local/bin).
QString repoPath() const;
// Whether the source repository is present so a self-update is possible.
// Download URL of the source tarball for the pending update (empty until
// a check completes), plus the human-readable release page.
QString tarballUrl() const;
QString releasePageUrl() const;
// Install prefix the running binary was installed to (e.g. ~/.local,
// /usr/local, /usr). Used to reinstall the fresh build at the same place.
QString installPrefix() const;
// Whether a self-update is possible. True when running from a source
// checkout, or when a tarball URL is known (installed mode).
bool canSelfUpdate() const;
// Pulls the latest code from the remote and rebuilds the app in the
// background. The current running binary is left untouched; the new
// version takes effect at the next launch. Emits selfUpdateFinished.
void performSelfUpdate();
// Rebuilds + reinstalls the app in the background. Pass the sudo password
// when the install prefix is not user-writable (empty = no sudo pipe,
// `sudo` will prompt on its own if needed). Emits selfUpdateFinished.
void performSelfUpdate(const QString& sudoPassword = QString());
signals:
// Emitted after a check completes. hasUpdate is true when a newer
@@ -69,5 +82,7 @@ private:
QString m_lastCheckDate; // ISO date of the last successful check
QString m_lastKnownRemoteVersion; // latest version seen on the server
QString m_latestVersion; // version of the pending update
QString m_tarballUrl; // source tarball for the pending update
QString m_releasePageUrl; // human-readable release page
QString m_repoPath; // source repo dir when found
};