Public Access
Issue #52: once a newer release is known, wait for a quiet moment, ask for 30 seconds, and install unless the answer is no. The caller says what busy and idle are. Host-tested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0162FokPdvY2KsS4NBfwyWPk
39 lines
1.7 KiB
C++
39 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "release_info.h"
|
|
#include "version_compare.h"
|
|
|
|
namespace roro::release {
|
|
|
|
// Where the project's releases are (Q164). A fork changes these, and its own signing key.
|
|
constexpr const char* kGiteaHost = "git.twis.la";
|
|
constexpr const char* kGiteaRepo = "twisla/roro9stack";
|
|
|
|
inline bool versionNewer(const std::string& a, const std::string& b) { return versionOlder(b, a); }
|
|
|
|
// Is `release` a newer one than what runs?
|
|
inline bool isNewer(const Release& release, const std::string& running) {
|
|
return release.usable() && versionNewer(release.tag, running);
|
|
}
|
|
|
|
// Should the background check say so (Q166, Q168)? Not for a version that failed on this device
|
|
// before (it rolled back), and not twice for the same one.
|
|
inline bool shouldAnnounce(const Release& latest, const std::string& running, const std::string& failed, const std::string& announced) {
|
|
return isNewer(latest, running) && latest.tag != failed && latest.tag != announced;
|
|
}
|
|
|
|
// Should the background check offer to install it by itself (issue #52)? Any newer release, each
|
|
// day it is still the newest; never a version that rolled back on this device.
|
|
inline bool shouldInstall(const Release& latest, const std::string& running, const std::string& failed) {
|
|
return isNewer(latest, running) && latest.tag != failed;
|
|
}
|
|
|
|
// Is `url` a download this device takes from the project's server, for this repository? Whatever
|
|
// the API says, the device only fetches from where it asked (a redirected or rewritten answer
|
|
// can't send it elsewhere).
|
|
bool trustedAssetUrl(const std::string& url, const std::string& host = kGiteaHost, const std::string& repo = kGiteaRepo);
|
|
|
|
} // namespace roro::release
|