working test for nb

This commit is contained in:
Martin Rotter 2022-02-18 13:16:29 +01:00
parent 6e8d4953e0
commit 4ab483d14a
3 changed files with 7 additions and 2 deletions

View File

@ -307,7 +307,8 @@ NetworkResult NetworkFactory::performNetworkOperation(const QString& url,
return result;
}
NetworkResult::NetworkResult() {}
NetworkResult::NetworkResult()
: m_networkError(QNetworkReply::NetworkError::NoError), m_contentType(QString()), m_cookies({}) {}
NetworkResult::NetworkResult(QNetworkReply::NetworkError err, const QString& ct, const QList<QNetworkCookie>& cook)
: m_networkError(err), m_contentType(ct), m_cookies(cook) {}

View File

@ -2,7 +2,8 @@
#define NEWSBLUR_DEFINITIONS_H
// Misc.
#define NEWSBLUR_DEFAULT_BATCH_SIZE 500
#define NEWSBLUR_DEFAULT_BATCH_SIZE 500
#define NEWSBLUS_AUTH_COOKIE "newsblur_sessionid"
// URLs.
#define NEWSBLUR_URL "https://newsblur.com"

View File

@ -57,6 +57,9 @@ LoginResult NewsBlurNetwork::login(const QNetworkProxy& proxy) {
res.decodeBaseResponse(doc);
res.m_userId = doc.object()["user_id"].toInt();
res.m_sessiodId = boolinq::from(network_result.m_cookies).firstOrDefault([](const QNetworkCookie& c) {
return c.name() == QSL(NEWSBLUS_AUTH_COOKIE);
}).value();
return res;
}