- interface gtkmm-4 : véhicules, ajout par VIN, mises à jour, dossier, téléchargement avec reprise et arrêt, choix de la clé, confirmation, écriture avec progression, fin avec guide d'installation ; travail dans un thread, résultats renvoyés via Glib::Dispatcher - préférences : dossier de téléchargement, langue (système par défaut), recherche automatique de nouvelle version d'OpenPU - recherche de nouvelle version (releases GitHub, format tags Gitea accepté) avec ouverture de la page dans le navigateur ; openpu-cli app-update - versions : project(VERSION) + git describe régénéré à chaque build, openpu-cli --version, À propos, User-Agent, CHANGELOG, tools/release.sh (étiquette annotée, push vers tous les remotes, release GitHub) - traductions gettext : textes anglais, fr.po complet (96 chaînes), extracteur de secours sans xgettext - core : module job (téléchargement licence/fw/carte), liens des guides PDF, ordre des véhicules conservé (ordered_json) - licence MIT (LICENSE, en-têtes SPDX) ; dépôt principal sur GitHub - validé dans WSLg : parcours complet jusqu'à l'écriture d'une clé loop (FAT32 propre, fichiers téléchargés supprimés) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
// SPDX-License-Identifier: MIT
|
|
#pragma once
|
|
|
|
#include "openpu/http.hpp"
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace openpu {
|
|
|
|
/// MAJOR.MINOR.PATCH, ordered numerically.
|
|
struct SemVer {
|
|
unsigned major = 0;
|
|
unsigned minor = 0;
|
|
unsigned patch = 0;
|
|
|
|
/// Accepts "1.2.3" and "v1.2.3"; build metadata ("+3.gabc") is ignored. Pre-releases are rejected.
|
|
static std::optional<SemVer> parse(std::string_view text);
|
|
std::string toString() const;
|
|
|
|
friend bool operator<(const SemVer& a, const SemVer& b)
|
|
{
|
|
if (a.major != b.major)
|
|
return a.major < b.major;
|
|
if (a.minor != b.minor)
|
|
return a.minor < b.minor;
|
|
return a.patch < b.patch;
|
|
}
|
|
friend bool operator==(const SemVer& a, const SemVer& b)
|
|
{
|
|
return a.major == b.major && a.minor == b.minor && a.patch == b.patch;
|
|
}
|
|
};
|
|
|
|
/// Where new OpenPU versions are published: the GitHub releases of the project.
|
|
/// A Gitea/GitHub `/tags` list is understood too (OPENPU_RELEASES_URL may point to one).
|
|
struct AppUpdateConfig {
|
|
std::string releasesUrl = "https://api.github.com/repos/yann64/openpu/releases";
|
|
/// Page opened in the browser when the answer gives none; "{tag}" is replaced by the tag name.
|
|
std::string pageUrl = "https://github.com/yann64/openpu/releases/tag/{tag}";
|
|
|
|
/// Defaults overridden by OPENPU_RELEASES_URL and OPENPU_RELEASE_PAGE_URL when set.
|
|
static AppUpdateConfig fromEnvironment();
|
|
};
|
|
|
|
struct AppRelease {
|
|
SemVer version;
|
|
std::string tag;
|
|
std::string pageUrl;
|
|
std::string notes; ///< release notes (or annotated tag message)
|
|
};
|
|
|
|
/// Highest vX.Y.Z release of a GitHub/Gitea `/releases` list (drafts and pre-releases skipped) or
|
|
/// of a `/tags` list (nullopt if none). Throws ParseError.
|
|
std::optional<AppRelease> latestRelease(std::string_view json, const AppUpdateConfig& config);
|
|
|
|
/// Newest published release if it is newer than `currentVersion`, nullopt when up to date.
|
|
/// Throws NetworkError, or std::runtime_error for an unexpected answer.
|
|
std::optional<AppRelease> checkForNewerRelease(Transport& transport, const AppUpdateConfig& config,
|
|
std::string_view currentVersion);
|
|
|
|
} // namespace openpu
|