mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add unique but random UUID to server queries
With this we can easily eliminate duplicates from our user statistics. The UUID is completely random and there is no way to link it back to a specific user. By deleting the settings a user can force a new UUID. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ed9a060d76
commit
0f967063c0
3 changed files with 22 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
#include "usersurvey.h"
|
#include "usersurvey.h"
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QUuid>
|
||||||
#include "subsurfacewebservices.h"
|
#include "subsurfacewebservices.h"
|
||||||
#include "ssrf-version.h"
|
#include "ssrf-version.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
@ -47,7 +48,8 @@ void UpdateManager::checkForUpdates(bool automatic)
|
||||||
#endif
|
#endif
|
||||||
isAutomaticCheck = automatic;
|
isAutomaticCheck = automatic;
|
||||||
QString version = CANONICAL_VERSION_STRING;
|
QString version = CANONICAL_VERSION_STRING;
|
||||||
QString url = QString("http://subsurface-divelog.org/updatecheck.html?os=%1&version=%2").arg(os, version);
|
QString uuidString = getUUID();
|
||||||
|
QString url = QString("http://subsurface-divelog.org/updatecheck.html?os=%1&version=%2&uuid=%3").arg(os, version, uuidString);
|
||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
request.setUrl(url);
|
request.setUrl(url);
|
||||||
request.setRawHeader("Accept", "text/xml");
|
request.setRawHeader("Accept", "text/xml");
|
||||||
|
@ -56,6 +58,22 @@ void UpdateManager::checkForUpdates(bool automatic)
|
||||||
connect(SubsurfaceWebServices::manager()->get(request), SIGNAL(finished()), this, SLOT(requestReceived()), Qt::UniqueConnection);
|
connect(SubsurfaceWebServices::manager()->get(request), SIGNAL(finished()), this, SLOT(requestReceived()), Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString UpdateManager::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;
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateManager::requestReceived()
|
void UpdateManager::requestReceived()
|
||||||
{
|
{
|
||||||
bool haveNewVersion = false;
|
bool haveNewVersion = false;
|
||||||
|
|
|
@ -11,6 +11,7 @@ class UpdateManager : public QObject {
|
||||||
public:
|
public:
|
||||||
explicit UpdateManager(QObject *parent = 0);
|
explicit UpdateManager(QObject *parent = 0);
|
||||||
void checkForUpdates(bool automatic = false);
|
void checkForUpdates(bool automatic = false);
|
||||||
|
static QString getUUID();
|
||||||
|
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "ui_usersurvey.h"
|
#include "ui_usersurvey.h"
|
||||||
#include "ssrf-version.h"
|
#include "ssrf-version.h"
|
||||||
#include "subsurfacewebservices.h"
|
#include "subsurfacewebservices.h"
|
||||||
|
#include "updatemanager.h"
|
||||||
|
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "subsurfacesysinfo.h"
|
#include "subsurfacesysinfo.h"
|
||||||
|
@ -30,6 +31,7 @@ UserSurvey::UserSurvey(QWidget *parent) : QDialog(parent),
|
||||||
os.append(QString("&osCpuArch=%1").arg(osArch));
|
os.append(QString("&osCpuArch=%1").arg(osArch));
|
||||||
}
|
}
|
||||||
os.append(QString("&uiLang=%1").arg(uiLanguage(NULL)));
|
os.append(QString("&uiLang=%1").arg(uiLanguage(NULL)));
|
||||||
|
os.append(QString("&uuid=%1").arg(UpdateManager::getUUID()));
|
||||||
ui->system->setPlainText(getVersion());
|
ui->system->setPlainText(getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue