Commit d7d7d7a5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

don't block resource when we open url page

parent 0d5680d8
Pipeline #56121 passed with stage
in 14 minutes and 36 seconds
......@@ -85,9 +85,9 @@ ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget *p
#ifdef HAVE_BLOCK_SUPPORT
mNetworkAccessManager = new WebEngineViewer::InterceptorManager(this, ac, this);
auto *externalReference = new WebEngineViewer::LoadExternalReferencesUrlInterceptor(this);
mExternalReference = new WebEngineViewer::LoadExternalReferencesUrlInterceptor(this);
// connect(externalReference, &MessageViewer::LoadExternalReferencesUrlInterceptor::urlBlocked, this, &MailWebEngineView::urlBlocked);
mNetworkAccessManager->addInterceptor(externalReference);
mNetworkAccessManager->addInterceptor(mExternalReference);
auto *blockTracking = new WebEngineViewer::BlockTrackingUrlInterceptor(this);
connect(blockTracking, &WebEngineViewer::BlockTrackingUrlInterceptor::trackingFound, this, &ArticleViewerWebEngine::trackingFound);
mNetworkAccessManager->addInterceptor(blockTracking);
......
......@@ -18,6 +18,7 @@ namespace WebEngineViewer
class WebHitTestResult;
class WebEngineAccessKey;
class InterceptorManager;
class LoadExternalReferencesUrlInterceptor;
}
namespace MessageViewer
{
......@@ -124,6 +125,7 @@ protected:
ArticleViewerWebEnginePage *mPageEngine = nullptr;
QList<QAction *> viewerPluginActionList(MessageViewer::ViewerPluginInterface::SpecificFeatureTypes features);
WebEngineViewer::InterceptorManager *mNetworkAccessManager = nullptr;
WebEngineViewer::LoadExternalReferencesUrlInterceptor *mExternalReference = nullptr;
private:
void openSafeUrl(const QUrl &url);
......
......@@ -21,6 +21,7 @@
#include <QWebEngineHistory>
#include <QWebEngineSettings>
#include <WebEngineViewer/InterceptorManager>
#include <WebEngineViewer/LoadExternalReferencesUrlInterceptor>
#include <WebEngineViewer/WebHitTest>
#include <WebEngineViewer/WebHitTestResult>
......@@ -29,6 +30,9 @@ using namespace Akregator;
AkrWebEngineViewer::AkrWebEngineViewer(KActionCollection *ac, QWidget *parent)
: ArticleViewerWebEngine(ac, parent)
{
if (mExternalReference) {
mExternalReference->setAllowExternalContent(true);
}
// TODO update settings when we change config
settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, Settings::enableJavascript());
settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment