aboutsummaryrefslogtreecommitdiff
path: root/src/webengine
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/filter.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/webengine/filter.cpp b/src/webengine/filter.cpp
index 9db61cb..216c84c 100644
--- a/src/webengine/filter.cpp
+++ b/src/webengine/filter.cpp
@@ -7,13 +7,13 @@
*/
#include "filter.h"
+#include "configuration.h"
#include "urlinterceptor.h"
+#include "util.h"
#include <QDir>
#include <QJsonArray>
#include <QJsonDocument>
#include <QTextStream>
-#include "configuration.h"
-#include "util.h"
/*
inline std::vector<FilterRule> parseAdBlockList(const QString &filename)
@@ -36,7 +36,7 @@ inline std::vector<FilterRule> parseAdBlockList(const QString &filename)
return rules;
}*/
-Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject* parent)
+Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject *parent)
: QObject(parent)
{
// parse headers
@@ -68,15 +68,26 @@ Filter::Filter::Filter(const std::unique_ptr<Configuration> &config, QObject* pa
*/
}
-void Filter::filterRequest(QWebEngineUrlRequestInfo& info) const
+void Filter::filterRequest(QWebEngineUrlRequestInfo &info) const
{
auto matches = filters.match(info.firstPartyUrl().toString(), info.requestUrl().toString());
for(const auto &rule : matches) {
switch(rule->action()) {
- case FilterLeaf::Block:
- qDebug("block %s", qUtf8Printable(info.requestUrl().toString()));
- info.block(true);
- break;
+ case FilterLeaf::NotMatched:
+#ifdef QT_DEBUG
+ qDebug("Paradoxical match: request matched, but not matched.");
+ qDebug(" - %s", qUtf8Printable(info.requestUrl().toString()));
+#endif
+ break;
+ case FilterLeaf::Block:
+ //qDebug("block %s", qUtf8Printable(info.requestUrl().toString()));
+ info.block(true);
+ break;
+ case FilterLeaf::Allow:
+ info.block(false);
+ break;
+ //case FilterLeaf::Redirect:
+ // break;
}
}
}