diff options
author | 2021-04-05 02:11:25 +0530 | |
---|---|---|
committer | 2021-04-05 02:11:25 +0530 | |
commit | 9ea334d08f42f3c362e86499dc3c0ed658bb428c (patch) | |
tree | 85eb15c519bcff8a5e3c4f8406f068b7c412b789 /src/requestinterceptor.h | |
parent | e79b447b31ad9ab1ed42fd232f8789fad38d780b (diff) | |
download | whatsie-9ea334d08f42f3c362e86499dc3c0ed658bb428c.tar.gz whatsie-9ea334d08f42f3c362e86499dc3c0ed658bb428c.zip |
src init
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 |