mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Cloud storage: modify protocol for checking cloud connectivity
In order to allow the backend to match account in multi user mode, it needs to know if the requests are coming from the same instance of Subsurface. Since I had to change the backend to add the ability to retrieve a location service userid I added this capability at the same time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d9ded26b86
commit
d70f85ce35
6 changed files with 20 additions and 18 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "updatemanager.h"
|
||||
#include "helpers.h"
|
||||
#include "qthelper.h"
|
||||
#include <QtNetwork>
|
||||
#include <QMessageBox>
|
||||
#include <QUuid>
|
||||
|
@ -60,22 +61,6 @@ void UpdateManager::checkForUpdates(bool automatic)
|
|||
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()
|
||||
{
|
||||
bool haveNewVersion = false;
|
||||
|
|
|
@ -11,7 +11,6 @@ class UpdateManager : public QObject {
|
|||
public:
|
||||
explicit UpdateManager(QObject *parent = 0);
|
||||
void checkForUpdates(bool automatic = false);
|
||||
static QString getUUID();
|
||||
|
||||
public
|
||||
slots:
|
||||
|
|
|
@ -31,7 +31,7 @@ UserSurvey::UserSurvey(QWidget *parent) : QDialog(parent),
|
|||
os.append(QString("&osCpuArch=%1").arg(osArch));
|
||||
}
|
||||
os.append(QString("&uiLang=%1").arg(uiLanguage(NULL)));
|
||||
os.append(QString("&uuid=%1").arg(UpdateManager::getUUID()));
|
||||
os.append(QString("&uuid=%1").arg(getUUID()));
|
||||
ui->system->setPlainText(getVersion());
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue