mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-23 09:59:39 -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 <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <QString>
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
namespace Updater {
|
||||
|
||||
// Declarations for helper functions
|
||||
QString FormatDateTimeString(const std::string& iso_string);
|
||||
// Declarations for helper functions to satisfy -Werror=missing-declarations
|
||||
std::string ExtractCommitHash(const std::string& version_string);
|
||||
QByteArray GetFileChecksum(const std::filesystem::path& file_path);
|
||||
|
||||
@@ -28,8 +26,6 @@ struct DownloadOption {
|
||||
struct UpdateInfo {
|
||||
std::string version;
|
||||
std::vector<DownloadOption> download_options;
|
||||
std::string checksum_url;
|
||||
std::string expected_checksum;
|
||||
std::string changelog;
|
||||
std::string release_date;
|
||||
bool is_newer_version = false;
|
||||
@@ -44,18 +40,18 @@ public:
|
||||
explicit UpdaterService(QObject* parent = nullptr);
|
||||
~UpdaterService() override;
|
||||
|
||||
void CheckForUpdates();
|
||||
void CheckForUpdates(const QString& override_channel = QString());
|
||||
void DownloadAndInstallUpdate(const std::string& download_url);
|
||||
void CancelUpdate();
|
||||
std::string GetCurrentVersion() const;
|
||||
std::string GetCurrentVersion(const QString& channel = QString()) const;
|
||||
bool IsUpdateInProgress() const;
|
||||
|
||||
static bool HasStagedUpdate(const std::filesystem::path& app_directory);
|
||||
static bool ApplyStagedUpdate(const std::filesystem::path& app_directory);
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
bool LaunchUpdateHelper();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void UpdateCheckCompleted(bool has_update, const UpdateInfo& update_info);
|
||||
@@ -71,24 +67,16 @@ private slots:
|
||||
|
||||
private:
|
||||
void InitializeSSL();
|
||||
void ConfigureSSLForRequest(QNetworkRequest& request);
|
||||
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);
|
||||
#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 CreateBackup();
|
||||
bool RestoreBackup();
|
||||
bool CreateUpdateHelperScript(const std::filesystem::path& staging_path);
|
||||
#endif
|
||||
#endif
|
||||
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;
|
||||
|
||||
std::unique_ptr<QNetworkAccessManager> network_manager;
|
||||
|
||||
Reference in New Issue
Block a user