#include "nam.h" #include void SlxRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info) { const QUrl url = info.requestUrl(); bool ok = true; if (url.isLocalFile()) { ok = true; } else if (url.scheme() == QLatin1String("qrc") || url.scheme() == QLatin1String("data")) { ok = true; } else if (url.host().isEmpty()) { ok = true; } else if (!url.isValid()) { ok = false; } else { auto str = url.toDisplayString(QUrl::NormalizePathSegments); if (_white.isValid() && _white.match(str).hasMatch()) { ok = true; } else if (_black.isValid() && _black.match(str).hasMatch()) { ok = false; } else { ok = true; } } if (!ok) { info.block(true); emit urlBlocked(url); } else if (!QUrl::fromUserInput(url.toString()).isValid()) { emit unsupportedScheme(url); } }