aboutsummaryrefslogtreecommitdiff
path: root/src/browser.cpp
diff options
context:
space:
mode:
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);
});