diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-18 10:07:51 +0200 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-07-18 10:07:51 +0200 |
commit | f507a7a5557c7cca9570c684920e055c5251b08e (patch) | |
tree | 0fad83fc99053006b375608e2a2d04388776ad89 /src/webengine | |
parent | AdBlockTest: loading subscription (diff) | |
download | smolbote-f507a7a5557c7cca9570c684920e055c5251b08e.tar.xz |
AdBlockRule: move matching logic to FilterRule
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/urlinterceptor.cpp | 21 | ||||
-rw-r--r-- | src/webengine/urlinterceptor.h | 4 |
2 files changed, 0 insertions, 25 deletions
diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp index 1b44c47..a66ab57 100644 --- a/src/webengine/urlinterceptor.cpp +++ b/src/webengine/urlinterceptor.cpp @@ -39,24 +39,7 @@ UrlRequestInterceptor::UrlRequestInterceptor(const std::unique_ptr<Configuration } } - QFile rules(config->value<QString>("filter.json-path").value()); - if(rules.open(QIODevice::ReadOnly | QIODevice::Text)) { - auto doc = QJsonDocument::fromJson(rules.readAll()).object(); - Q_ASSERT(doc.value("domains").isArray()); - for(QJsonValue d : doc.value("domains").toArray()) { - domain.addDomain(d.toString()); - } - - Q_ASSERT(doc.value("rules").isArray()); - for(QJsonValue rule : doc.value("rules").toArray()) { - auto p = std::make_unique<FilterRule>(rule.toObject()); - parseJson(p, rule.toObject()); - domain.addRule(p); - } - - rules.close(); - } } @@ -72,10 +55,6 @@ void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) return; } - if(domain.hasMatch(info.requestUrl().host())) { - domain.process(info); - } - #ifdef QT_DEBUG // qDebug("request>>>"); // qDebug("firstParty url=%s", qUtf8Printable(info.firstPartyUrl().toString())); diff --git a/src/webengine/urlinterceptor.h b/src/webengine/urlinterceptor.h index 06a4b97..2f91e30 100644 --- a/src/webengine/urlinterceptor.h +++ b/src/webengine/urlinterceptor.h @@ -14,8 +14,6 @@ #include <QVector> #include <QByteArray> -#include "web/urlfilter/filterdomain.h" - typedef std::pair<std::string, std::string> Header; class Configuration; @@ -35,8 +33,6 @@ public: private: QHash<QString, HostRule> rules; std::vector<Header> m_headers; - - FilterDomain domain; }; QHash<QString, UrlRequestInterceptor::HostRule> parse(const QString &filename); |