From 8c126cdf7e5cda1937017b2ea3545d09d7978fbc Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 17 Jul 2026 17:08:26 +0200 Subject: [PATCH 1/2] update regex --- .../src/client/network/update/client/release_channel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/client/network/update/client/release_channel.cpp b/cockatrice/src/client/network/update/client/release_channel.cpp index beba05c7d..af802a3d2 100644 --- a/cockatrice/src/client/network/update/client/release_channel.cpp +++ b/cockatrice/src/client/network/update/client/release_channel.cpp @@ -60,13 +60,14 @@ std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &f } return false; }(); - static const QRegularExpression macIntelRegex(R"(macOS(\d+)_Intel\.[^.]+$)", + static const QRegularExpression macIntelRegex(R"(-macOS(\d+)_Intel\.[^.]+$)", QRegularExpression::CaseInsensitiveOption); - static const QRegularExpression macArmRegex(R"(macOS(\d+)\.[^.]+$)", QRegularExpression::CaseInsensitiveOption); + static const QRegularExpression macArmRegex(R"(-macOS(\d+)\.[^.]+$)", QRegularExpression::CaseInsensitiveOption); regex = isIntel ? &macIntelRegex : &macArmRegex; #elif defined(Q_OS_WIN) - static const QRegularExpression winRegex(R"(Win(?:dows)?(\d+)\.[^.]+$)", QRegularExpression::CaseInsensitiveOption); + static const QRegularExpression winRegex(R"(-(?:Win|Windows)(\d+)\.[^.]+$)", + QRegularExpression::CaseInsensitiveOption); regex = &winRegex; #else // if the OS doesn't fit one of the above #defines, then it will never match From 66d81e6f14364e854b808045d9cdd81009dd4c07 Mon Sep 17 00:00:00 2001 From: tooomm Date: Fri, 17 Jul 2026 18:08:01 +0200 Subject: [PATCH 2/2] improve/add comments --- .../src/client/network/update/client/release_channel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/client/network/update/client/release_channel.cpp b/cockatrice/src/client/network/update/client/release_channel.cpp index af802a3d2..35fe85fff 100644 --- a/cockatrice/src/client/network/update/client/release_channel.cpp +++ b/cockatrice/src/client/network/update/client/release_channel.cpp @@ -44,7 +44,7 @@ void ReleaseChannel::checkForUpdates() connect(response, &QNetworkReply::finished, this, &ReleaseChannel::releaseListFinished); } -// Different release channel checking functions for different operating systems +// Find compatible assets for host platform (Linux is not supported by in-client updater) std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &fileName) { const QRegularExpression *regex = nullptr; @@ -75,6 +75,7 @@ std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &f return std::nullopt; #endif + // Any asset targeting an OS version smaller or equal to the current host works const int systemVersion = QSysInfo::productVersion().split('.').first().toInt(); auto match = regex->match(fileName); if (!match.hasMatch()) { @@ -87,6 +88,7 @@ std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &f return targetVersion; } +// Pick newest targeted version (highest number) amongst all compatible ones QString ReleaseChannel::findBestDownloadUrl(const QVariantList &assets) { QString bestUrl;