[Core] Include more information about the OS in the user agent
authorHannah von Reth <hannah.vonreth@owncloud.com>
Fri, 10 Jan 2020 15:41:01 +0000 (16:41 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:05 +0000 (10:59 +0100)
src/common/utility.cpp

index e7ed681c52a34edf2f699fe8c77c061a2668eb7c..9e4f13ce8a59844ebe250f6234a72c6a9523ac0e 100644 (file)
@@ -170,24 +170,20 @@ static QLatin1String platform()
 #elif defined(Q_OS_SOLARIS)
     return QLatin1String("Solaris");
 #else
-    return QLatin1String("Unknown OS");
+    return QSysInfo::productType();
 #endif
 }
 
 QByteArray Utility::userAgentString()
 {
-    QString re = QString::fromLatin1("Mozilla/5.0 (%1) mirall/%2")
-                     .arg(platform(), QLatin1String(MIRALL_VERSION_STRING));
-
-    QLatin1String appName(APPLICATION_SHORTNAME);
-
-    // this constant "ownCloud" is defined in the default OEM theming
-    // that is used for the standard client. If it is changed there,
-    // it needs to be adjusted here.
-    if (appName != QLatin1String("ownCloud")) {
-        re += QString(" (%1)").arg(appName);
-    }
-    return re.toLatin1();
+    return QStringLiteral("Mozilla/5.0 (%1) mirall/%2 (%3, %4-%5 ClientArchitecture: %6 OsArchitecture: %7)")
+                     .arg(platform(),
+                         QLatin1String(MIRALL_VERSION_STRING),
+                         qApp->applicationName(),
+                         QSysInfo::productType(),
+                         QSysInfo::kernelVersion(),
+                         QSysInfo::buildCpuArchitecture(),
+                         QSysInfo::currentCpuArchitecture()).toLatin1();
 }
 
 QByteArray Utility::friendlyUserAgentString()