diff options
Diffstat (limited to 'src/webengine/filter.h')
-rw-r--r-- | src/webengine/filter.h | 45 |
1 files changed, 45 insertions, 0 deletions
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 <QByteArray> +#include <QVector> +#include <optional> + +class Configuration; +class Filter : public QObject +{ + Q_OBJECT +public: + struct HostRule { + bool isBlocking; + }; + + explicit Filter(const std::unique_ptr<Configuration> &config, QObject *parent = nullptr); + ~Filter() override = default; + + const QHash<QString, HostRule> hostlist() const + { + return qAsConst(m_hostlist); + } + std::optional<HostRule> hostlistRule(const QString &url) const; + + const QMap<QByteArray, QByteArray> headers() const + { + return qAsConst(m_headers); + } + +private: + QHash<QString, HostRule> m_hostlist; + QMap<QByteArray, QByteArray> m_headers; +}; + +#endif // SMOLBOTE_FILTER_H |