| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/network-web/webengine/networkurlinterceptor.cpp`/ |
| 2 | |
| 3 | // |
| 4 | // Copyright (C) 2011-2017 by Martin Rotter <[email protected]> |
| 5 | // Copyright (C) 2010-2014 by David Rosca <[email protected]> |
| 6 | // |
| 7 | // RSS Guard is free software: you can redistribute it and/or modify |
| 8 | // it under the terms of the GNU General Public License as published by |
| 9 | // the Free Software Foundation, either version 3 of the License, or |
| 10 | // (at your option) any later version. |
| 11 | // |
| 12 | // RSS Guard is distributed in the hope that it will be useful, |
| 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | // GNU General Public License for more details. |
| 16 | // |
| 17 | // You should have received a copy of the GNU General Public License |
| 18 | // along with RSS Guard. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | #include "network-web/webengine/networkurlinterceptor.h"cxx . . $ `<file>/src/librssguard/network-web/webengine/networkurlinterceptor.h`/ |
| 21 | |
| 22 | #include "miscellaneous/application.h"cxx . . $ `<file>/src/librssguard/miscellaneous/application.h`/ |
| 23 | #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 24 | #include "network-web/webengine/urlinterceptor.h"cxx . . $ `<file>/src/librssguard/network-web/webengine/urlinterceptor.h`/ |
| 25 | |
| 26 | NetworkUrlInterceptorcxx . . $ NetworkUrlInterceptor#::NetworkUrlInterceptorcxx . . $ NetworkUrlInterceptor#NetworkUrlInterceptor(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent) |
| 27 | : QWebEngineUrlRequestInterceptorcxx . . $ QWebEngineUrlRequestInterceptor#(parent), m_sendDntcxx . . $ NetworkUrlInterceptor#m_sendDnt.(false) {} |
| 28 | |
| 29 | void NetworkUrlInterceptorcxx . . $ NetworkUrlInterceptor#::interceptRequestcxx . . $ NetworkUrlInterceptor#interceptRequest(d18ab7b3f646b68e).(QWebEngineUrlRequestInfocxx . . $ QWebEngineUrlRequestInfo#& info) { |
| 30 | if (m_sendDntcxx . . $ NetworkUrlInterceptor#m_sendDnt.) { |
| 31 | info.setHttpHeadercxx . . $ QWebEngineUrlRequestInfo#setHttpHeader(a34492a60dbd2bdc).(QByteArrayLiteralcxx . . $ `<external>/12685849885665122534/qbytearray.h:53:11`!("DNT"), QByteArrayLiteralcxx . . $ `<external>/12685849885665122534/qbytearray.h:53:11`!("1")); |
| 32 | } |
| 33 | |
| 34 | // NOTE: Here we can add custom headers for each webengine request, for example "User-Agent". |
| 35 | |
| 36 | for (UrlInterceptorcxx . . $ UrlInterceptor#* interceptor : stdcxx . . $ std/::as_constcxx . . $ std/as_const(1dc117cbefefc300).(m_interceptorscxx . . $ NetworkUrlInterceptor#m_interceptors.)) { |
| 37 | interceptor->interceptRequestcxx . . $ UrlInterceptor#interceptRequest(d18ab7b3f646b68e).(info); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | void NetworkUrlInterceptorcxx . . $ NetworkUrlInterceptor#::installUrlInterceptorcxx . . $ NetworkUrlInterceptor#installUrlInterceptor(449ab0fa279ef918).(UrlInterceptorcxx . . $ UrlInterceptor#* interceptor) { |
| 42 | if (!m_interceptorscxx . . $ NetworkUrlInterceptor#m_interceptors..containscxx . . $ QListSpecialMethodsBase#contains(7349e39e0b02d05c).(interceptor)) { |
| 43 | m_interceptorscxx . . $ NetworkUrlInterceptor#m_interceptors..appendcxx . . $ QList#append(200d2dc08238a4ed).(interceptor); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | void NetworkUrlInterceptorcxx . . $ NetworkUrlInterceptor#::removeUrlInterceptorcxx . . $ NetworkUrlInterceptor#removeUrlInterceptor(449ab0fa279ef918).(UrlInterceptorcxx . . $ UrlInterceptor#* interceptor) { |
| 48 | m_interceptorscxx . . $ NetworkUrlInterceptor#m_interceptors..removeOnecxx . . $ QList#removeOne(310757e808c34387).(interceptor); |
| 49 | } |
| 50 | |
| 51 | void NetworkUrlInterceptorcxx . . $ NetworkUrlInterceptor#::loadcxx . . $ NetworkUrlInterceptor#load(49f6e7a06ebc5aa8).() { |
| 52 | m_sendDntcxx . . $ NetworkUrlInterceptor#m_sendDnt. = qAppcxx . . $ `src/librssguard/miscellaneous/application.h:30:9`!->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(Network), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(Network::SendDNT)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 53 | } |