From c0f09ae12cf83789bd65153e4e6347858c266d7b Mon Sep 17 00:00:00 2001 From: Felix Weilbach Date: Tue, 16 Mar 2021 12:09:49 +0100 Subject: [PATCH] Don't check against product name if checking server version We should not rely on the product name because it is something the user can change in the theming options on the server. Fixes #3001 Signed-off-by: Felix Weilbach --- VERSION.cmake | 5 +++++ src/libsync/account.cpp | 5 +++-- src/libsync/networkjobs.cpp | 2 +- version.h.in | 4 ++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/VERSION.cmake b/VERSION.cmake index 1a3b7b05f3d4..ae96ec120518 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -4,6 +4,11 @@ set( MIRALL_VERSION_PATCH 81 ) set( MIRALL_VERSION_YEAR 2020 ) set( MIRALL_SOVERSION 0 ) +# Minimum supported server version according to https://docs.nextcloud.com/server/latest/admin_manual/release_schedule.html +set(NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MAJOR 19) +set(NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MINOR 0) +set(NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_PATCH 0) + if ( NOT DEFINED MIRALL_VERSION_SUFFIX ) set( MIRALL_VERSION_SUFFIX "git") #e.g. beta1, beta2, rc1 endif( NOT DEFINED MIRALL_VERSION_SUFFIX ) diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp index 5c5613e1370d..012d1336014e 100644 --- a/src/libsync/account.cpp +++ b/src/libsync/account.cpp @@ -21,6 +21,7 @@ #include "capabilities.h" #include "theme.h" #include "pushnotifications.h" +#include "version.h" #include "common/asserts.h" #include "clientsideencryption.h" @@ -531,8 +532,8 @@ bool Account::serverVersionUnsupported() const // not detected yet, assume it is fine. return false; } - // Older version which is not "end of life" according to https://docs.nextcloud.com/server/latest/admin_manual/release_schedule.html - return serverVersionInt() < makeServerVersion(18, 0, 0) || !serverVersion().endsWith("Nextcloud"); + return serverVersionInt() < makeServerVersion(NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MAJOR, + NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MINOR, NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_PATCH); } void Account::setServerVersion(const QString &version) diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index ecccff1ba7a5..f701e2dc1c94 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -454,7 +454,7 @@ void CheckServerJob::onTimedOut() QString CheckServerJob::version(const QJsonObject &info) { - return info.value(QLatin1String("version")).toString() + "-" + info.value(QLatin1String("productname")).toString(); + return info.value(QLatin1String("version")).toString(); } QString CheckServerJob::versionString(const QJsonObject &info) diff --git a/version.h.in b/version.h.in index e96ba1fe0565..c3a7975e5b8c 100644 --- a/version.h.in +++ b/version.h.in @@ -37,4 +37,8 @@ #define MIRALL_VERSION_STRING "@MIRALL_VERSION_STRING@" +constexpr int NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MAJOR = @NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MAJOR@; +constexpr int NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MINOR = @NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_MINOR@; +constexpr int NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_PATCH = @NEXTCLOUD_SERVER_VERSION_MIN_SUPPORTED_PATCH@; + #endif // VERSION_H