diff options
Diffstat (limited to 'src/requestinterceptor.h')
-rw-r--r-- | src/requestinterceptor.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/requestinterceptor.h b/src/requestinterceptor.h new file mode 100644 index 0000000..95f2d48 --- /dev/null +++ b/src/requestinterceptor.h @@ -0,0 +1,41 @@ +#ifndef REQUESTINTERCEPTOR_H +#define REQUESTINTERCEPTOR_H +#include <QWebEnginePage> +#include <QDebug> +#include <QObject> +#include <QWebEngineView> +#include <QApplication> +#include <QWebEngineUrlRequestInfo> +#include <QWebEngineUrlRequestInterceptor> +#include <QSettings> + +class RequestInterceptor : public QWebEngineUrlRequestInterceptor +{ + Q_OBJECT + +signals: + void blocked(QString adUrl); +private: + QSettings m_settings; + +public: + RequestInterceptor(QObject *parent = nullptr) : QWebEngineUrlRequestInterceptor(parent) + { + } + + void interceptRequest(QWebEngineUrlRequestInfo &info) + { + QString reqUrlStr = info.requestUrl().toString(); + +// if(reqUrlStr.contains("mms-type=video")|| reqUrlStr.contains("stream/video?key")){ +// if(m_settings.value("disableVideos",false).toBool()){ +// info.block(true); +// qDebug()<<"INTERCEPTOR: Blocked video - "<<reqUrlStr; +// } +// }else{ +// qDebug()<<"INTERCEPTOR:"<<reqUrlStr; +// } + qDebug()<<"INTERCEPTOR:"<<reqUrlStr; + } +}; +#endif // REQUESTINTERCEPTOR_H |