include encrypted feedly tokenss

This commit is contained in:
Martin Rotter 2021-03-06 20:29:13 +01:00 committed by Martin Rotter
parent 56b2b296b9
commit 17ed2aa04a
5 changed files with 18 additions and 33 deletions

View File

@ -48,6 +48,8 @@ jobs:
GMAIL_CLIENT_SECRET: ${{ secrets.GMAIL_CLIENT_SECRET }}
INOREADER_CLIENT_ID: ${{ secrets.INOREADER_CLIENT_ID }}
INOREADER_CLIENT_SECRET: ${{ secrets.INOREADER_CLIENT_SECRET }}
FEEDLY_CLIENT_ID: ${{ secrets.FEEDLY_CLIENT_ID }}
FEEDLY_CLIENT_SECRET: ${{ secrets.FEEDLY_CLIENT_SECRET }}
- name: Release development binaries
uses: softprops/action-gh-release@v1

View File

@ -4,9 +4,9 @@
#include "3rd-party/boolinq/boolinq.h"
#include "3rd-party/boolinq/boolinq.h"
#include "database/databasequeries.h"
#include "exceptions/networkexception.h"
#include "miscellaneous/application.h"
#include "database/databasequeries.h"
#include "network-web/networkfactory.h"
#include "network-web/webfactory.h"
#include "services/abstract/category.h"
@ -28,8 +28,8 @@ FeedlyNetwork::FeedlyNetwork(QObject* parent)
#if defined(FEEDLY_OFFICIAL_SUPPORT)
m_oauth(new OAuth2Service(QSL(FEEDLY_API_URL_BASE) + FEEDLY_API_URL_AUTH,
QSL(FEEDLY_API_URL_BASE) + FEEDLY_API_URL_TOKEN,
FEEDLY_CLIENT_ID,
FEEDLY_CLIENT_ID,
TextFactory::decrypt(FEEDLY_CLIENT_ID, OAUTH_DECRYPTION_KEY),
TextFactory::decrypt(FEEDLY_CLIENT_SECRET, OAUTH_DECRYPTION_KEY),
FEEDLY_API_SCOPE, this)),
#endif
m_username(QString()),

View File

@ -2,11 +2,11 @@
#include "services/feedly/feedlyserviceroot.h"
#include "database/databasequeries.h"
#include "definitions/definitions.h"
#include "exceptions/applicationexception.h"
#include "exceptions/networkexception.h"
#include "miscellaneous/application.h"
#include "database/databasequeries.h"
#include "miscellaneous/iconfactory.h"
#include "miscellaneous/mutex.h"
#include "miscellaneous/textfactory.h"
@ -105,8 +105,16 @@ void FeedlyServiceRoot::start(bool freshly_activated) {
updateTitle();
if (getSubTreeFeeds().isEmpty()) {
syncIn();
m_network->oauth()->login([this]() {
syncIn();
});
}
#if defined(FEEDLY_OFFICIAL_SUPPORT)
else {
m_network->oauth()->login();
}
#endif
}
QString FeedlyServiceRoot::code() const {

View File

@ -19,13 +19,7 @@
FeedlyAccountDetails::FeedlyAccountDetails(QWidget* parent) : QWidget(parent) {
#if defined(FEEDLY_OFFICIAL_SUPPORT)
m_oauth = new OAuth2Service(QSL(FEEDLY_API_URL_BASE) + FEEDLY_API_URL_AUTH,
QSL(FEEDLY_API_URL_BASE) + FEEDLY_API_URL_TOKEN,
FEEDLY_CLIENT_ID,
FEEDLY_CLIENT_SECRET,
FEEDLY_API_SCOPE, this);
m_oauth->setRedirectUrl(QString(OAUTH_REDIRECT_URI) + QL1C(':') + QString::number(FEEDLY_API_REDIRECT_URI_PORT));
m_oauth = nullptr;
#endif
m_ui.setupUi(this);

View File

@ -27,20 +27,7 @@ void FormEditFeedlyAccount::apply() {
FormAccountDetails::apply();
#if defined(FEEDLY_OFFICIAL_SUPPORT)
if (!m_creatingNew) {
// We transfer refresh token to avoid the need to login once more,
// then we delete testing OAuth service.
account<FeedlyServiceRoot>()->network()->oauth()->setAccessToken(m_details->m_oauth->accessToken());
account<FeedlyServiceRoot>()->network()->oauth()->setRefreshToken(m_details->m_oauth->refreshToken());
account<FeedlyServiceRoot>()->network()->oauth()->setTokensExpireIn(m_details->m_oauth->tokensExpireIn());
m_details->m_oauth->logout(true);
m_details->m_oauth->deleteLater();
// Force live OAuth object to re-start it's redirection handler.
account<FeedlyServiceRoot>()->network()->oauth()->setRedirectUrl(QString(OAUTH_REDIRECT_URI) +
QL1C(':') +
QString::number(FEEDLY_API_REDIRECT_URI_PORT));
}
account<FeedlyServiceRoot>()->network()->oauth()->logout(false);
#endif
account<FeedlyServiceRoot>()->network()->setUsername(m_details->m_ui.m_txtUsername->lineEdit()->text());
@ -53,7 +40,7 @@ void FormEditFeedlyAccount::apply() {
if (!m_creatingNew) {
account<FeedlyServiceRoot>()->completelyRemoveAllData();
account<FeedlyServiceRoot>()->syncIn();
account<FeedlyServiceRoot>()->start(true);
}
}
@ -61,12 +48,6 @@ void FormEditFeedlyAccount::loadAccountData() {
FormAccountDetails::loadAccountData();
#if defined(FEEDLY_OFFICIAL_SUPPORT)
if (m_details->m_oauth != nullptr) {
// We will use live OAuth service for testing.
m_details->m_oauth->logout(true);
m_details->m_oauth->deleteLater();
}
m_details->m_oauth = account<FeedlyServiceRoot>()->network()->oauth();
m_details->hookNetwork();
#endif