From edb514bf2d62c3a1d24b0ce6b84204907b9a1d52 Mon Sep 17 00:00:00 2001 From: Chris Josten Date: Sat, 26 Sep 2020 04:13:21 +0200 Subject: [PATCH] BUMP VERSION 0.1.0 --- harbour-sailfin.pro | 3 +++ src/jellyfinapiclient.cpp | 12 +++--------- src/jellyfinapiclient.h | 1 + 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/harbour-sailfin.pro b/harbour-sailfin.pro index 64788fb..182a3db 100644 --- a/harbour-sailfin.pro +++ b/harbour-sailfin.pro @@ -16,6 +16,9 @@ QT += multimedia CONFIG += sailfishapp c++11 +# Help, something keeps eating my quotes and backslashes +DEFINES += "SAILFIN_VERSION=\"\\\"0.1.0\\\"\"" + SOURCES += \ src/credentialmanager.cpp \ src/harbour-sailfin.cpp \ diff --git a/src/jellyfinapiclient.cpp b/src/jellyfinapiclient.cpp index 82b25e3..09cfaaf 100644 --- a/src/jellyfinapiclient.cpp +++ b/src/jellyfinapiclient.cpp @@ -1,8 +1,5 @@ #include "jellyfinapiclient.h" -#define STR2(x) #x -#define STR(x) STR2(x) - namespace Jellyfin { ApiClient::ApiClient(QObject *parent) : QObject(parent) { @@ -21,18 +18,18 @@ ApiClient::ApiClient(QObject *parent) void ApiClient::addBaseRequestHeaders(QNetworkRequest &request, const QString &path, const QUrlQuery ¶ms) { addTokenHeader(request); request.setRawHeader("Accept", "application/json;"); // profile=\"CamelCase\""); - request.setHeader(QNetworkRequest::UserAgentHeader, QString("Sailfin/%1").arg(STR(SAILFIN_VERSION))); + request.setHeader(QNetworkRequest::UserAgentHeader, QString("Sailfin/%1").arg(m_version)); QString url = this->m_baseUrl + path; if (!params.isEmpty()) url += "?" + params.toString(); request.setUrl(url); } void ApiClient::addTokenHeader(QNetworkRequest &request) { - QString authentication = "MediaBrowser "; + QString authentication = "MediaBrowser "; authentication += "Client=\"Sailfin\""; authentication += ", Device=\"" + m_deviceName + "\""; authentication += ", DeviceId=\"" + m_deviceId + "\""; - authentication += ", Version=\"" + QString(STR(SAILFIN_VERSION)) + "\""; + authentication += ", Version=\"" + QString(m_version) + "\""; if (m_authenticated) { authentication += ", token=\"" + m_token + "\""; } @@ -254,6 +251,3 @@ void ApiClient::defaultNetworkErrorHandler(QNetworkReply::NetworkError error) { rep->deleteLater(); } } - -#undef STR -#undef STR2 diff --git a/src/jellyfinapiclient.h b/src/jellyfinapiclient.h index 6f20aef..c4a4637 100644 --- a/src/jellyfinapiclient.h +++ b/src/jellyfinapiclient.h @@ -161,6 +161,7 @@ protected: private: QNetworkAccessManager m_naManager; + const char *m_version = SAILFIN_VERSION; /* * State information */