diff options
Diffstat (limited to '')
-rw-r--r-- | src/m_ver_check/BKTUSVersionCheckTask.cpp | 3 | ||||
-rw-r--r-- | src/m_ver_check/GitHubVersionCheckTask.cpp | 37 | ||||
-rw-r--r-- | src/m_ver_check/GitHubVersionCheckTask.h | 7 | ||||
-rw-r--r-- | src/m_ver_check/SoftwareVersion.cpp | 12 | ||||
-rw-r--r-- | src/m_ver_check/SoftwareVersion.h | 9 | ||||
-rw-r--r-- | src/m_ver_check/UpdateTab.cpp | 16 | ||||
-rw-r--r-- | src/m_ver_check/Utils.cpp | 6 |
7 files changed, 0 insertions, 90 deletions
diff --git a/src/m_ver_check/BKTUSVersionCheckTask.cpp b/src/m_ver_check/BKTUSVersionCheckTask.cpp index 4de695b..782531f 100644 --- a/src/m_ver_check/BKTUSVersionCheckTask.cpp +++ b/src/m_ver_check/BKTUSVersionCheckTask.cpp @@ -228,9 +228,6 @@ void BKTUSVersionCheckTask::slot_parse_current_tag_info(QNetworkReply* reply) { FLOG_DEBUG("got tag info from bktus: %1, %2, %3", title_text, id_text, published_text); - - const auto& sha = id_text; - meta_.remote_commit_hash_by_tag = sha.trimmed(); meta_.current_version_publish_in_remote = true; } diff --git a/src/m_ver_check/GitHubVersionCheckTask.cpp b/src/m_ver_check/GitHubVersionCheckTask.cpp index 35c6ca0..7492f40 100644 --- a/src/m_ver_check/GitHubVersionCheckTask.cpp +++ b/src/m_ver_check/GitHubVersionCheckTask.cpp @@ -60,7 +60,6 @@ auto GitHubVersionCheckTask::Run() -> int { QList<QUrl> urls = { {base_url + "/releases/latest"}, {base_url + "/releases/tags/" + current_version_}, - {base_url + "/git/ref/tags/" + current_version_}, {base_url + "/commits/" + meta_.local_commit_hash}, }; @@ -93,9 +92,6 @@ void GitHubVersionCheckTask::slot_parse_reply(QNetworkReply* reply) { slot_parse_current_version_info(reply); break; case 2: - slot_parse_current_tag_info(reply); - break; - case 3: slot_parse_current_commit_info(reply); break; default: @@ -166,42 +162,12 @@ void GitHubVersionCheckTask::slot_parse_current_version_info( meta_.current_version_publish_in_remote = true; } -void GitHubVersionCheckTask::slot_parse_current_tag_info(QNetworkReply* reply) { - if (reply == nullptr || reply->error() != QNetworkReply::NoError) { - meta_.current_version_publish_in_remote = false; - return; - } - - meta_.current_version_publish_in_remote = true; - auto reply_bytes = reply->readAll(); - auto current_reply_json = QJsonDocument::fromJson(reply_bytes); - - if (!current_reply_json.isObject()) { - FLOG_WARN("cannot parse data from github: %1", reply_bytes); - return; - } - - auto object = current_reply_json["object"].toObject(); - if (object["type"].toString() != "tag" && - object["type"].toString() != "commit") { - FLOG_WARN("remote tag: %1 is not a ref: %2", meta_.current_version, - object["type"].toString()); - return; - } - - auto sha = object["sha"].toString(); - meta_.remote_commit_hash_by_tag = sha.trimmed(); - FLOG_DEBUG("got remote commit hash: %1", meta_.remote_commit_hash_by_tag); -} - void GitHubVersionCheckTask::slot_parse_current_commit_info( QNetworkReply* reply) { if (reply == nullptr || reply->error() != QNetworkReply::NoError) { - meta_.current_version_publish_in_remote = false; return; } - meta_.current_version_publish_in_remote = true; auto reply_bytes = reply->readAll(); auto current_reply_json = QJsonDocument::fromJson(reply_bytes); @@ -211,8 +177,5 @@ void GitHubVersionCheckTask::slot_parse_current_commit_info( } auto sha = current_reply_json["sha"].toString(); - FLOG_DEBUG("got remote commit hash from github: %1", - meta_.remote_commit_hash_by_tag); - meta_.current_commit_hash_publish_in_remote = sha == meta_.local_commit_hash; } diff --git a/src/m_ver_check/GitHubVersionCheckTask.h b/src/m_ver_check/GitHubVersionCheckTask.h index ebe8192..615a5e8 100644 --- a/src/m_ver_check/GitHubVersionCheckTask.h +++ b/src/m_ver_check/GitHubVersionCheckTask.h @@ -91,13 +91,6 @@ class GitHubVersionCheckTask : public QObject { * * @param reply */ - void slot_parse_current_tag_info(QNetworkReply* reply); - - /** - * @brief - * - * @param reply - */ void slot_parse_current_commit_info(QNetworkReply* reply); private: diff --git a/src/m_ver_check/SoftwareVersion.cpp b/src/m_ver_check/SoftwareVersion.cpp index b868af1..38c268f 100644 --- a/src/m_ver_check/SoftwareVersion.cpp +++ b/src/m_ver_check/SoftwareVersion.cpp @@ -36,8 +36,6 @@ #include <QJsonObject> #include <QString> -#include "GFModuleCommonUtils.hpp" - auto SoftwareVersion::NeedUpgrade() const -> bool { return !latest_version.isEmpty() && GFCompareSoftwareVersion(GFModuleStrDup(current_version.toUtf8()), @@ -52,14 +50,6 @@ auto SoftwareVersion::CurrentVersionReleased() const -> bool { return !latest_version.isEmpty() && current_version_publish_in_remote; } -auto SoftwareVersion::GitCommitHashMismatch() const -> bool { - if (remote_commit_hash_by_tag.isEmpty()) return false; - - FLOG_DEBUG("remote commit hash: %1, local commit hash: %2", - remote_commit_hash_by_tag, local_commit_hash); - return remote_commit_hash_by_tag.trimmed() != local_commit_hash.trimmed(); -} - auto SoftwareVersion::ToJson() const -> QJsonObject { QJsonObject obj; obj["api"] = api; @@ -70,7 +60,6 @@ auto SoftwareVersion::ToJson() const -> QJsonObject { current_commit_hash_publish_in_remote; obj["publish_date"] = publish_date; obj["release_note"] = release_note; - obj["remote_commit_hash_by_tag"] = remote_commit_hash_by_tag; obj["local_commit_hash"] = local_commit_hash; obj["timestamp"] = timestamp.toSecsSinceEpoch(); return obj; @@ -86,7 +75,6 @@ void SoftwareVersion::FromJson(const QJsonObject& obj) { obj.value("current_commit_hash_publish_in_remote").toBool(); publish_date = obj.value("publish_date").toString(); release_note = obj.value("release_note").toString(); - remote_commit_hash_by_tag = obj.value("remote_commit_hash_by_tag").toString(); local_commit_hash = obj.value("local_commit_hash").toString(); timestamp = QDateTime::fromSecsSinceEpoch(obj.value("timestamp").toInt()); } diff --git a/src/m_ver_check/SoftwareVersion.h b/src/m_ver_check/SoftwareVersion.h index 59db3fa..6267554 100644 --- a/src/m_ver_check/SoftwareVersion.h +++ b/src/m_ver_check/SoftwareVersion.h @@ -46,7 +46,6 @@ struct SoftwareVersion { QString publish_date; ///< QString release_note; ///< - QString remote_commit_hash_by_tag; QString local_commit_hash; QDateTime timestamp; @@ -83,14 +82,6 @@ struct SoftwareVersion { * @return true * @return false */ - [[nodiscard]] auto GitCommitHashMismatch() const -> bool; - - /** - * @brief - * - * @return true - * @return false - */ [[nodiscard]] auto CurrentVersionReleased() const -> bool; /** diff --git a/src/m_ver_check/UpdateTab.cpp b/src/m_ver_check/UpdateTab.cpp index b28ccf3..9295f6d 100644 --- a/src/m_ver_check/UpdateTab.cpp +++ b/src/m_ver_check/UpdateTab.cpp @@ -134,9 +134,6 @@ void UpdateTab::slot_show_version_status() { GFModuleRetrieveRTValueOrDefaultBool( GFGetModuleID(), DUP("version.current_version_publish_in_remote"), 0); - auto is_git_commit_hash_mismatch = GFModuleRetrieveRTValueOrDefaultBool( - GFGetModuleID(), DUP("version.git_commit_hash_mismatch"), 0); - auto is_current_commit_hash_publish_in_remote = GFModuleRetrieveRTValueOrDefaultBool( GFGetModuleID(), DUP("version.current_commit_hash_publish_in_remote"), @@ -181,19 +178,6 @@ void UpdateTab::slot_show_version_status() { "</center>"); upgrade_label_->show(); upgrade_info_box_->show(); - } else if (is_git_commit_hash_mismatch != 0 && GFIsCheckReleaseCommitHash()) { - upgrade_label_->setText( - "<center>" + - tr("The current version's commit hash does not match the official " - "release. This may indicate a modified or unofficial build.") + - "</center><center>" + tr("Click") + - " <a " - "href=\"https://www.gpgfrontend.bktus.com/overview/downloads/\">" + - tr("here") + "</a> " + - tr("to verify your installation or download the official version.") + - "</center>"); - upgrade_label_->show(); - upgrade_info_box_->show(); } else if (is_current_commit_hash_publish_in_remote == 0) { upgrade_label_->setText( "<center>" + diff --git a/src/m_ver_check/Utils.cpp b/src/m_ver_check/Utils.cpp index 8ca1baa..6d260cf 100644 --- a/src/m_ver_check/Utils.cpp +++ b/src/m_ver_check/Utils.cpp @@ -41,9 +41,6 @@ void FillGrtWithVersionInfo(const SoftwareVersion& version) { GFModuleUpsertRTValue(GFGetModuleID(), GFModuleStrDup("version.latest_version"), GFModuleStrDup(version.latest_version.toUtf8())); - GFModuleUpsertRTValue( - GFGetModuleID(), GFModuleStrDup("version.remote_commit_hash_by_tag"), - GFModuleStrDup(version.remote_commit_hash_by_tag.toUtf8())); GFModuleUpsertRTValue(GFGetModuleID(), GFModuleStrDup("version.local_commit_hash"), GFModuleStrDup(version.local_commit_hash.toUtf8())); @@ -62,9 +59,6 @@ void FillGrtWithVersionInfo(const SoftwareVersion& version) { GFModuleUpsertRTValueBool(GFGetModuleID(), GFModuleStrDup("version.current_version_released"), version.CurrentVersionReleased() ? 1 : 0); - GFModuleUpsertRTValueBool(GFGetModuleID(), - GFModuleStrDup("version.git_commit_hash_mismatch"), - version.GitCommitHashMismatch() ? 1 : 0); GFModuleUpsertRTValue(GFGetModuleID(), GFModuleStrDup("version.release_note"), GFModuleStrDup(version.release_note.toUtf8())); |