summaryrefslogtreecommitdiffstats
path: root/subsurface-core
diff options
context:
space:
mode:
Diffstat (limited to 'subsurface-core')
-rw-r--r--subsurface-core/checkcloudconnection.cpp1
-rw-r--r--subsurface-core/qthelper.cpp16
-rw-r--r--subsurface-core/qthelper.h1
3 files changed, 18 insertions, 0 deletions
diff --git a/subsurface-core/checkcloudconnection.cpp b/subsurface-core/checkcloudconnection.cpp
index be2a2fa18..428c4cda6 100644
--- a/subsurface-core/checkcloudconnection.cpp
+++ b/subsurface-core/checkcloudconnection.cpp
@@ -28,6 +28,7 @@ bool CheckCloudConnection::checkServer()
QNetworkRequest request;
request.setRawHeader("Accept", "text/plain");
request.setRawHeader("User-Agent", getUserAgent().toUtf8());
+ request.setRawHeader("Client-Id", getUUID().toUtf8());
request.setUrl(QString(prefs.cloud_base_url) + TEAPOT);
QNetworkAccessManager *mgr = new QNetworkAccessManager();
reply = mgr->get(request);
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp
index ac1624aa3..23eb34e0f 100644
--- a/subsurface-core/qthelper.cpp
+++ b/subsurface-core/qthelper.cpp
@@ -1780,3 +1780,19 @@ void init_proxy()
}
QNetworkProxy::setApplicationProxy(proxy);
}
+
+QString getUUID()
+{
+ QString uuidString;
+ QSettings settings;
+ settings.beginGroup("UpdateManager");
+ if (settings.contains("UUID")) {
+ uuidString = settings.value("UUID").toString();
+ } else {
+ QUuid uuid = QUuid::createUuid();
+ uuidString = uuid.toString();
+ settings.setValue("UUID", uuidString);
+ }
+ uuidString.replace("{", "").replace("}", "");
+ return uuidString;
+}
diff --git a/subsurface-core/qthelper.h b/subsurface-core/qthelper.h
index 4345afae0..5b3e5bdee 100644
--- a/subsurface-core/qthelper.h
+++ b/subsurface-core/qthelper.h
@@ -142,5 +142,6 @@ void setCurrentAppState(QByteArray state);
extern "C" bool in_planner();
extern "C" void subsurface_mkdir(const char *dir);
void init_proxy();
+QString getUUID();
#endif // QTHELPER_H