diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/browser.cpp | 10 | ||||
-rw-r--r-- | src/browser.h | 4 |
2 files changed, 12 insertions, 2 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); }); diff --git a/src/browser.h b/src/browser.h index 0a0b201..69cf804 100644 --- a/src/browser.h +++ b/src/browser.h @@ -9,8 +9,9 @@ #ifndef SMOLBOTE_BROWSER_H #define SMOLBOTE_BROWSER_H -#include "webengine/webprofilemanager.h" +#include "smolblok.hpp" #include "smolbote/session.hpp" +#include "webengine/webprofilemanager.h" #include <QJsonObject> #include <QMenu> #include <QPluginLoader> @@ -79,6 +80,7 @@ private: std::shared_ptr<BookmarksWidget> m_bookmarks; std::unique_ptr<DownloadsWidget> m_downloads; std::unique_ptr<WebProfileManager<false>> m_profileManager{ nullptr }; + smolblok content_filter; QVector<MainWindow *> m_windows; QVector<PluginInfo *> m_plugins; |