mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cloud storage: use preference member instead of hard coded strings
This creates the basis to allow other backends to be used with the cloud storage infrastructure. So far this should all just transparently continue to work. A user would have to manually add the cloud_base_url entry to the CloudStorage section in their config file in order to use a different backend server. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
617b105458
commit
c593dea119
6 changed files with 12 additions and 13 deletions
|
@ -946,9 +946,9 @@ CloudStorageAuthenticate::CloudStorageAuthenticate(QObject *parent) : QObject(pa
|
|||
userAgent = getUserAgent();
|
||||
}
|
||||
|
||||
#define CLOUDURL "https://cloud.subsurface-divelog.org/"
|
||||
#define CLOUDBACKENDSTORAGE CLOUDURL "storage"
|
||||
#define CLOUDBACKENDVERIFY CLOUDURL "verify"
|
||||
#define CLOUDURL QString(prefs.cloud_base_url)
|
||||
#define CLOUDBACKENDSTORAGE CLOUDURL + "/storage"
|
||||
#define CLOUDBACKENDVERIFY CLOUDURL + "/verify"
|
||||
|
||||
QNetworkReply* CloudStorageAuthenticate::authenticate(QString email, QString password, QString pin)
|
||||
{
|
||||
|
@ -1013,7 +1013,7 @@ CheckCloudConnection::CheckCloudConnection(QObject *parent)
|
|||
|
||||
}
|
||||
|
||||
#define TEAPOT "https://cloud.subsurface-divelog.org/make-latte?number-of-shots=3"
|
||||
#define TEAPOT "/make-latte?number-of-shots=3"
|
||||
#define HTTP_I_AM_A_TEAPOT 418
|
||||
#define MILK "Linus does not like non-fat milk"
|
||||
bool CheckCloudConnection::checkServer()
|
||||
|
@ -1024,7 +1024,7 @@ bool CheckCloudConnection::checkServer()
|
|||
QNetworkRequest request;
|
||||
request.setRawHeader("Accept", "text/plain");
|
||||
request.setRawHeader("User-Agent", getUserAgent().toUtf8());
|
||||
request.setUrl(QString(TEAPOT));
|
||||
request.setUrl(QString(prefs.cloud_base_url) + TEAPOT);
|
||||
QNetworkAccessManager *mgr = new QNetworkAccessManager();
|
||||
QNetworkReply *reply = mgr->get(request);
|
||||
connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue