aboutsummaryrefslogtreecommitdiff
path: root/src/browser.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-05-31 21:53:52 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-05-31 21:53:52 +0300
commit737d688e5b173ef5155db3e4fc9e8debf9b33a11 (patch)
tree3fe6cd4aade797fc0c3b18d458834befd43a91cf /src/browser.cpp
parentstaging: smolblok (diff)
downloadsmolbote-737d688e5b173ef5155db3e4fc9e8debf9b33a11.tar.xz
enable smolblokstaging-smolblok
Build both HostlistFilter and AdblockFitler plugins by default.
Diffstat (limited to 'src/browser.cpp')
-rw-r--r--src/browser.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/browser.cpp b/src/browser.cpp
index ff948e4..a04f87d 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -19,7 +19,6 @@
#include "smolbote/plugininterface.hpp"
#include "subwindow/subwindow.h"
#include "util.h"
-#include "webengine/urlinterceptor.h"
#include "webengine/webprofile.h"
#include "webengine/webprofilemanager.h"
#include "webengine/webview.h"
@@ -70,6 +69,14 @@ Browser::Browser(int &argc, char *argv[], bool allowSecondary)
}
}
+ // content filter - register format plugins
+ if(const auto hostlist_plugin = conf.value<QString>("smolblok.plugins.hostlist")) {
+ content_filter.registerFormatPlugin("hostlist", hostlist_plugin.value());
+ }
+ if(const auto adblock_plugin = conf.value<QString>("smolblok.plugins.adblock")) {
+ content_filter.registerFormatPlugin("adblock", adblock_plugin.value());
+ }
+
// load profiles
{
const auto profiles = Util::files(conf.value<QString>("profile.path").value(), { "*.profile" });
@@ -92,6 +99,7 @@ Browser::Browser(int &argc, char *argv[], bool allowSecondary)
// downloads
m_downloads = std::make_unique<DownloadsWidget>(conf.value<QString>("downloads.path").value());
m_profileManager->walk([this](const QString &, WebProfile *profile, QSettings *) {
+ profile->setUrlRequestInterceptor(content_filter.interceptor());
connect(profile, &QWebEngineProfile::downloadRequested, m_downloads.get(), &DownloadsWidget::addDownload);
});