blob: 95f2d488934c1edd8da8347bc781e64611cbf3ce (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
|