aboutsummaryrefslogtreecommitdiff
path: root/src/webengine
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-07-18 10:07:51 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-07-18 10:07:51 +0200
commitf507a7a5557c7cca9570c684920e055c5251b08e (patch)
tree0fad83fc99053006b375608e2a2d04388776ad89 /src/webengine
parentAdBlockTest: loading subscription (diff)
downloadsmolbote-f507a7a5557c7cca9570c684920e055c5251b08e.tar.xz
AdBlockRule: move matching logic to FilterRule
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/urlinterceptor.cpp21
-rw-r--r--src/webengine/urlinterceptor.h4
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);