mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-18 10:40:48 -04:00
feat(updater): Improved Updater System w/ Automation & SCM Logic Changes
Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
@@ -9,14 +9,12 @@
|
|||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
namespace Updater {
|
namespace Updater {
|
||||||
|
|
||||||
// Declarations for helper functions
|
// Declarations for helper functions to satisfy -Werror=missing-declarations
|
||||||
QString FormatDateTimeString(const std::string& iso_string);
|
|
||||||
std::string ExtractCommitHash(const std::string& version_string);
|
std::string ExtractCommitHash(const std::string& version_string);
|
||||||
QByteArray GetFileChecksum(const std::filesystem::path& file_path);
|
QByteArray GetFileChecksum(const std::filesystem::path& file_path);
|
||||||
|
|
||||||
@@ -28,8 +26,6 @@ struct DownloadOption {
|
|||||||
struct UpdateInfo {
|
struct UpdateInfo {
|
||||||
std::string version;
|
std::string version;
|
||||||
std::vector<DownloadOption> download_options;
|
std::vector<DownloadOption> download_options;
|
||||||
std::string checksum_url;
|
|
||||||
std::string expected_checksum;
|
|
||||||
std::string changelog;
|
std::string changelog;
|
||||||
std::string release_date;
|
std::string release_date;
|
||||||
bool is_newer_version = false;
|
bool is_newer_version = false;
|
||||||
@@ -44,18 +40,18 @@ public:
|
|||||||
explicit UpdaterService(QObject* parent = nullptr);
|
explicit UpdaterService(QObject* parent = nullptr);
|
||||||
~UpdaterService() override;
|
~UpdaterService() override;
|
||||||
|
|
||||||
void CheckForUpdates();
|
void CheckForUpdates(const QString& override_channel = QString());
|
||||||
void DownloadAndInstallUpdate(const std::string& download_url);
|
void DownloadAndInstallUpdate(const std::string& download_url);
|
||||||
void CancelUpdate();
|
void CancelUpdate();
|
||||||
std::string GetCurrentVersion() const;
|
std::string GetCurrentVersion(const QString& channel = QString()) const;
|
||||||
bool IsUpdateInProgress() const;
|
bool IsUpdateInProgress() const;
|
||||||
|
|
||||||
static bool HasStagedUpdate(const std::filesystem::path& app_directory);
|
static bool HasStagedUpdate(const std::filesystem::path& app_directory);
|
||||||
static bool ApplyStagedUpdate(const std::filesystem::path& app_directory);
|
static bool ApplyStagedUpdate(const std::filesystem::path& app_directory);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool LaunchUpdateHelper();
|
bool LaunchUpdateHelper();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void UpdateCheckCompleted(bool has_update, const UpdateInfo& update_info);
|
void UpdateCheckCompleted(bool has_update, const UpdateInfo& update_info);
|
||||||
@@ -71,24 +67,16 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeSSL();
|
void InitializeSSL();
|
||||||
void ConfigureSSLForRequest(QNetworkRequest& request);
|
|
||||||
void ParseUpdateResponse(const QByteArray& response, const QString& channel);
|
void ParseUpdateResponse(const QByteArray& response, const QString& channel);
|
||||||
bool CompareVersions(const std::string& current, const std::string& latest) const;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool ExtractArchive(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path);
|
bool ExtractArchive(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path);
|
||||||
#ifndef CITRON_ENABLE_LIBARCHIVE
|
|
||||||
bool ExtractArchiveWindows(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path);
|
|
||||||
#endif
|
|
||||||
bool InstallUpdate(const std::filesystem::path& update_path);
|
bool InstallUpdate(const std::filesystem::path& update_path);
|
||||||
bool CreateBackup();
|
bool CreateBackup();
|
||||||
bool RestoreBackup();
|
bool RestoreBackup();
|
||||||
bool CreateUpdateHelperScript(const std::filesystem::path& staging_path);
|
bool CreateUpdateHelperScript(const std::filesystem::path& staging_path);
|
||||||
#endif
|
#endif
|
||||||
bool CleanupFiles();
|
bool CleanupFiles();
|
||||||
std::filesystem::path GetTempDirectory() const;
|
|
||||||
std::filesystem::path GetApplicationDirectory() const;
|
|
||||||
std::filesystem::path GetBackupDirectory() const;
|
|
||||||
bool EnsureDirectoryExists(const std::filesystem::path& path) const;
|
bool EnsureDirectoryExists(const std::filesystem::path& path) const;
|
||||||
|
|
||||||
std::unique_ptr<QNetworkAccessManager> network_manager;
|
std::unique_ptr<QNetworkAccessManager> network_manager;
|
||||||
|
|||||||
Reference in New Issue
Block a user