feat(updater): in-app dragonxd updater + browse-all-releases

Add a full-node daemon updater (util/DaemonUpdater + daemon_download_dialog)
reachable from Settings -> NODE & SECURITY: downloads/verifies (SHA-256 +
enforced ed25519 signature) and atomically installs the latest dragonxd from
the project Gitea, with a "Restart daemon now" step. Add a shared "Browse all
releases..." picker (release_list_view) to both the miner and daemon updaters
so users can pin older/pre-release builds. Pure no-I/O cores
(daemon_updater_core / xmrig_updater_core) are unit-tested; sign-daemon-release.sh
signs release archives offline.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-27 21:27:13 -05:00
parent 2e8e214689
commit 4473e7e00a
19 changed files with 1848 additions and 108 deletions

View File

@@ -194,10 +194,70 @@ void XmrigUpdater::startInstall(const std::string& targetDir)
progress_.state = State::Downloading;
progress_.error.clear();
progress_.status_text = "Preparing…";
progress_.downloaded_bytes = 0; // clear any prior op's progress so the bar starts at 0%
progress_.total_bytes = 0;
progress_.percent = 0.0f;
}
worker_ = std::thread([this, targetDir] { runInstall(targetDir); worker_running_ = false; });
}
void XmrigUpdater::startListReleases()
{
if (worker_running_.exchange(true)) return;
cancel_requested_ = false;
if (worker_.joinable()) worker_.join();
{
std::lock_guard<std::mutex> lk(mutex_);
progress_.state = State::Listing;
progress_.error.clear();
progress_.status_text = "Loading releases…";
progress_.downloaded_bytes = 0; // clear any prior op's progress
progress_.total_bytes = 0;
progress_.percent = 0.0f;
}
worker_ = std::thread([this] { runListReleases(); worker_running_ = false; });
}
void XmrigUpdater::startInstallRelease(const std::string& targetDir, XmrigRelease release)
{
if (worker_running_.exchange(true)) return;
cancel_requested_ = false;
if (worker_.joinable()) worker_.join();
{
std::lock_guard<std::mutex> lk(mutex_);
progress_.state = State::Downloading;
progress_.error.clear();
progress_.status_text = "Preparing…";
progress_.downloaded_bytes = 0; // clear any prior op's progress so the bar starts at 0%
progress_.total_bytes = 0;
progress_.percent = 0.0f;
}
worker_ = std::thread([this, targetDir, release = std::move(release)] {
installResolved(targetDir, release);
worker_running_ = false;
});
}
std::vector<XmrigRelease> XmrigUpdater::getReleases() const
{
std::lock_guard<std::mutex> lk(mutex_);
return releases_;
}
void XmrigUpdater::runListReleases()
{
const std::string body = httpGet(kReleasesUrl);
if (body.empty()) { setProgress(State::Failed, "Could not reach the update server."); return; }
std::vector<XmrigRelease> list = parseXmrigReleaseList(body);
const bool empty = list.empty();
{
std::lock_guard<std::mutex> lk(mutex_);
releases_ = std::move(list);
}
if (empty) { setProgress(State::Failed, "No releases found."); return; }
setProgress(State::ReleaseList, "Select a version to install.");
}
void XmrigUpdater::runCheck(std::string installedTag)
{
const std::string body = httpGet(kApiUrl);
@@ -235,7 +295,11 @@ void XmrigUpdater::runInstall(std::string targetDir)
if (apiBody.empty()) { setProgress(State::Failed, "Could not reach the update server."); return; }
const XmrigRelease rel = parseXmrigRelease(apiBody);
if (!rel.ok) { setProgress(State::Failed, rel.error.empty() ? "Invalid release data." : rel.error); return; }
installResolved(targetDir, rel);
}
void XmrigUpdater::installResolved(const std::string& targetDir, const XmrigRelease& rel)
{
const std::string token = currentXmrigPlatformToken();
const int idx = selectXmrigAsset(rel, token);
if (idx < 0) {