Don't check against product name if checking server version
authorFelix Weilbach <felix.weilbach@nextcloud.com>
Tue, 16 Mar 2021 11:09:49 +0000 (12:09 +0100)
committerFelix Weilbach (Rebase PR Action) <felix.weilbach@t-online.de>
Tue, 16 Mar 2021 14:30:56 +0000 (14:30 +0000)
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 <felix.weilbach@nextcloud.com>
VERSION.cmake
src/libsync/account.cpp
src/libsync/networkjobs.cpp
version.h.in

index 1a3b7b05f3d47a818a874fcbce5f2e8000a22967..ae96ec120518e0a15d546b85537381270fcf8a8c 100644 (file)
@@ -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 )
index 5c5613e1370d979b22c5ff6f87299d3a2e455cad..012d1336014e2a9e18e8dbcf77a0439d58041044 100644 (file)
@@ -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)
index ecccff1ba7a5aa80306386e73cde4eb339891d20..f701e2dc1c94d206c0fa80602cc59d9d285a49a2 100644 (file)
@@ -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)
index e96ba1fe0565a98e93cc6e9f826f09f1763ea5a3..c3a7975e5b8c70dd010678fa29126286922a5116 100644 (file)
@@ -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