aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/webengine/filter.cpp35
1 files changed, 6 insertions, 29 deletions
diff --git a/src/webengine/filter.cpp b/src/webengine/filter.cpp
index 6941ac4..f1a38af 100644
--- a/src/webengine/filter.cpp
+++ b/src/webengine/filter.cpp
@@ -15,37 +15,20 @@
#include <QJsonDocument>
#include <QTextStream>
-/*
-inline std::vector<FilterRule> parseAdBlockList(const QString &filename)
-{
- std::vector<FilterRule> rules;
- QFile list(filename);
-
- if(list.open(QIODevice::ReadOnly | QIODevice::Text), true) {
- QTextStream l(&list);
- QString line;
- while(l.readLineInto(&line)) {
- AdBlockRule rule(line);
- if(rule.isEnabled()) {
- rules.emplace_back(std::move(rule));
- }
- }
- list.close();
- }
-
- return rules;
-}*/
-
Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject *parent)
: QObject(parent)
{
// parse headers
- if(const auto headers = config->value<QStringList>("filter.header"); headers) {
- for(const QString &header : headers.value()) {
+ if(config->exists("filter.header")) {
+ const auto headers = config->value<QStringList>("filter.header").value();
+ for(const QString header : headers) {
const auto list = header.split(QLatin1Literal(":"));
if(list.length() == 2)
m_headers.insert(list.at(0).toLatin1(), list.at(1).toLatin1());
}
+#ifdef QT_DEBUG
+ qDebug("Added %i custom http headers", m_headers.size());
+#endif
}
const QStringList hostfiles = Util::files(config->value<QString>("filter.hosts").value());
@@ -60,12 +43,6 @@ Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject *pa
f.close();
}
}
-
- /*
- auto filtersPath = config->value<QString>("filter.adblock");
- if(filtersPath)
- filters = parseAdBlockList(filtersPath.value());
- */
}
void Filter::filterRequest(QWebEngineUrlRequestInfo &info) const