aboutsummaryrefslogtreecommitdiff
path: root/src/webengine/webprofile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine/webprofile.cpp')
-rw-r--r--src/webengine/webprofile.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/webengine/webprofile.cpp b/src/webengine/webprofile.cpp
index f0368c9..719ab34 100644
--- a/src/webengine/webprofile.cpp
+++ b/src/webengine/webprofile.cpp
@@ -7,11 +7,12 @@
*/
#include "webprofile.h"
+#include "urlinterceptor.h"
#include <QFileInfo>
#include <QSettings>
#include <QWebEngineCookieStore>
#include <QWebEngineSettings>
-#include "urlinterceptor.h"
+#include <spdlog/spdlog.h>
static WebProfile *s_profile = nullptr;
@@ -47,7 +48,7 @@ WebProfile *WebProfile::load(const QString &id, QSettings *settings, bool isOffT
{
WebProfile *profile = nullptr;
- if(isOffTheRecord || settings->value("otr", isOffTheRecord).toBool()) {
+ if(settings->value("otr", isOffTheRecord).toBool()) {
profile = new WebProfile(id, nullptr);
} else {
profile = new WebProfile(id, id, nullptr);
@@ -89,7 +90,8 @@ WebProfile *WebProfile::load(const QString &id, QSettings *settings, bool isOffT
{
// headers
settings->beginGroup("headers");
- for(const QString &key : settings->childKeys()) {
+ const auto keys = settings->childKeys();
+ for(const QString &key : keys) {
profile->setHttpHeader(key.toLatin1(), settings->value(key).toString().toLatin1());
}
settings->endGroup();
@@ -110,11 +112,14 @@ WebProfile::WebProfile(const QString &id, QObject *parent)
{
QWebEngineProfile::setUrlRequestInterceptor(new UrlRequestInterceptor(this));
connect(this->cookieStore(), &QWebEngineCookieStore::cookieAdded, this, [this](const QNetworkCookie &cookie) {
+ spdlog::debug("[{}]: +cookie {}", qUtf8Printable(m_name), qUtf8Printable(cookie.name()));
m_cookies.append(cookie);
});
connect(this->cookieStore(), &QWebEngineCookieStore::cookieRemoved, this, [this](const QNetworkCookie &cookie) {
- m_cookies.removeAll(cookie);
+ spdlog::debug("[{}]: -cookie {}", qUtf8Printable(m_name), qUtf8Printable(cookie.name()));
+ m_cookies.removeOne(cookie);
});
+ cookieStore()->loadAllCookies();
}
// default constructor
@@ -124,9 +129,12 @@ WebProfile::WebProfile(const QString &id, const QString &storageName, QObject *p
{
QWebEngineProfile::setUrlRequestInterceptor(new UrlRequestInterceptor(this));
connect(this->cookieStore(), &QWebEngineCookieStore::cookieAdded, this, [this](const QNetworkCookie &cookie) {
+ spdlog::debug("[{}]: +cookie {}", qUtf8Printable(m_name), qUtf8Printable(cookie.name()));
m_cookies.append(cookie);
});
connect(this->cookieStore(), &QWebEngineCookieStore::cookieRemoved, this, [this](const QNetworkCookie &cookie) {
- m_cookies.removeAll(cookie);
+ spdlog::debug("[{}]: -cookie {}", qUtf8Printable(m_name), qUtf8Printable(cookie.name()));
+ m_cookies.removeOne(cookie);
});
+ cookieStore()->loadAllCookies();
}