From 2a5ea0269a1f9511c51d661a6c7d7bdc7d0176fa Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 7 Oct 2018 13:20:54 +0200 Subject: Expand HTTP header settings #4 - add doc/Usage/Filter.asciidoc to explain the usage of the filter headers - add HTTP headers to Profile (section "headers") - Use request interceptor to apply filter headers, then profile headers - add insert/delete actions to ProfileEditor --- src/webengine/filter.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/webengine/filter.h (limited to 'src/webengine/filter.h') diff --git a/src/webengine/filter.h b/src/webengine/filter.h new file mode 100644 index 0000000..3eac5ee --- /dev/null +++ b/src/webengine/filter.h @@ -0,0 +1,45 @@ +/* + * 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/gitea/aqua/smolbote + * + * SPDX-License-Identifier: GPL-3.0 + */ + +#ifndef SMOLBOTE_FILTER_H +#define SMOLBOTE_FILTER_H + +#include "urlfilter/filterrule.h" +#include +#include +#include + +class Configuration; +class Filter : public QObject +{ + Q_OBJECT +public: + struct HostRule { + bool isBlocking; + }; + + explicit Filter(const std::unique_ptr &config, QObject *parent = nullptr); + ~Filter() override = default; + + const QHash hostlist() const + { + return qAsConst(m_hostlist); + } + std::optional hostlistRule(const QString &url) const; + + const QMap headers() const + { + return qAsConst(m_headers); + } + +private: + QHash m_hostlist; + QMap m_headers; +}; + +#endif // SMOLBOTE_FILTER_H -- cgit v1.2.1