Work on network connectivity.
This commit is contained in:
parent
bbc81a8e2a
commit
0a8332a3de
4 changed files with 36 additions and 5 deletions
|
@ -19,6 +19,10 @@
|
||||||
#ifndef INOREADER_DEFINITIONS_H
|
#ifndef INOREADER_DEFINITIONS_H
|
||||||
#define INOREADER_DEFINITIONS_H
|
#define INOREADER_DEFINITIONS_H
|
||||||
|
|
||||||
#define INOREADER_API_VERSION "0"
|
#define INOREADER_OAUTH_PORT "8080"
|
||||||
|
#define INOREADER_OAUTH_TOKEN_URL "https://www.inoreader.com/oauth2/token"
|
||||||
|
#define INOREADER_OAUTH_AUTH_URL "https://www.inoreader.com/oauth2/auth"
|
||||||
|
#define INOREADER_OAUTH_CLI_ID "1000000604"
|
||||||
|
#define INOREADER_OAUTH_CLI_KEY "gsStoZ3aAoQJCgQxoFSuXkWI7Sly87yK"
|
||||||
|
|
||||||
#endif // INOREADER_DEFINITIONS_H
|
#endif // INOREADER_DEFINITIONS_H
|
||||||
|
|
|
@ -49,7 +49,7 @@ QString InoreaderEntryPoint::code() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString InoreaderEntryPoint::description() const {
|
QString InoreaderEntryPoint::description() const {
|
||||||
return QObject::tr("This is integration of Inoreader. This plugin implements API, version %1.").arg(INOREADER_API_VERSION);
|
return QObject::tr("This is integration of Inoreader.");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString InoreaderEntryPoint::version() const {
|
QString InoreaderEntryPoint::version() const {
|
||||||
|
|
|
@ -18,7 +18,30 @@
|
||||||
|
|
||||||
#include "services/inoreader/network/inoreadernetworkfactory.h"
|
#include "services/inoreader/network/inoreadernetworkfactory.h"
|
||||||
|
|
||||||
InoreaderNetworkFactory::InoreaderNetworkFactory(QObject* parent) : QObject(parent) {}
|
#include "network-web/silentnetworkaccessmanager.h"
|
||||||
|
#include "services/inoreader/definitions.h"
|
||||||
|
|
||||||
|
#include <QOAuthHttpServerReplyHandler>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
|
InoreaderNetworkFactory::InoreaderNetworkFactory(QObject* parent) : QObject(parent) {
|
||||||
|
initializeOauth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InoreaderNetworkFactory::initializeOauth() {
|
||||||
|
auto oauth_reply_handler = new QOAuthHttpServerReplyHandler(INOREADER_OAUTH_PORT, this);
|
||||||
|
|
||||||
|
// Full redirect URL is thus "http://localhost.8080/".
|
||||||
|
oauth_reply_handler->setCallbackPath(QSL(""));
|
||||||
|
|
||||||
|
m_oauth2.setAccessTokenUrl(QUrl(INOREADER_OAUTH_TOKEN_URL));
|
||||||
|
m_oauth2.setAuthorizationUrl(QUrl(INOREADER_OAUTH_AUTH_URL));
|
||||||
|
m_oauth2.setClientIdentifier(INOREADER_OAUTH_CLI_ID);
|
||||||
|
m_oauth2.setClientIdentifierSharedKey(INOREADER_OAUTH_CLI_KEY);
|
||||||
|
m_oauth2.setContentType(QAbstractOAuth::ContentType::Json);
|
||||||
|
m_oauth2.setNetworkAccessManager(new SilentNetworkAccessManager(this));
|
||||||
|
m_oauth2.setReplyHandler(oauth_reply_handler);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QOAuth2AuthorizationCodeFlow* oauth2 = new QOAuth2AuthorizationCodeFlow("1000000604",
|
QOAuth2AuthorizationCodeFlow* oauth2 = new QOAuth2AuthorizationCodeFlow("1000000604",
|
||||||
|
|
|
@ -21,15 +21,19 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#include <QOAuth2AuthorizationCodeFlow>
|
||||||
|
|
||||||
class InoreaderNetworkFactory : public QObject {
|
class InoreaderNetworkFactory : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit InoreaderNetworkFactory(QObject* parent = nullptr);
|
explicit InoreaderNetworkFactory(QObject* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
private:
|
||||||
|
void initializeOauth();
|
||||||
|
|
||||||
public slots:
|
private:
|
||||||
|
QOAuth2AuthorizationCodeFlow m_oauth2;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INOREADERNETWORKFACTORY_H
|
#endif // INOREADERNETWORKFACTORY_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue