/* * This file is part of smolbote. It's copyrighted by the contributors recorded * in the version control history of the file, available from its original * location: https://neueland.iserlohn-fortress.net/smolbote.hg * * SPDX-License-Identifier: GPL-3.0 */ #ifndef SMOLBOTE_URLREQUESTINTERCEPTOR_H #define SMOLBOTE_URLREQUESTINTERCEPTOR_H #include #include #include #include #include "web/urlfilter/filterrule.h" typedef std::pair Header; class Configuration; class UrlRequestInterceptor : public QWebEngineUrlRequestInterceptor { Q_OBJECT public: struct HostRule { bool isBlocking; }; explicit UrlRequestInterceptor(const std::unique_ptr &config, QObject *parent = nullptr); ~UrlRequestInterceptor() = default; void interceptRequest(QWebEngineUrlRequestInfo &info) override; private: QHash rules; std::vector filters; std::vector
m_headers; }; QHash parse(const QString &filename); inline std::vector parseAdBlockList(const QString &filename); #endif // SMOLBOTE_URLREQUESTINTERCEPTOR_H