opt:add wikipedia url to whitelist.

This commit is contained in:
Xiao YiFang 2022-07-11 21:01:49 +08:00
parent e54b6e58d8
commit ceb4a00d2e

View file

@ -15,6 +15,7 @@
#include "utils.hh" #include "utils.hh"
#include <QRegularExpression> #include <QRegularExpression>
#include "globalbroadcaster.h"
namespace MediaWiki { namespace MediaWiki {
@ -125,6 +126,8 @@ MediaWikiWordSearchRequest::MediaWikiWordSearchRequest( wstring const & str,
GD_DPRINTF( "request begin\n" ); GD_DPRINTF( "request begin\n" );
QUrl reqUrl( url + "/api.php?action=query&list=allpages&aplimit=40&format=xml" ); QUrl reqUrl( url + "/api.php?action=query&list=allpages&aplimit=40&format=xml" );
GlobalBroadcaster::instance()->addWhitelist( reqUrl.host() );
Utils::Url::addQueryItem( reqUrl, "apfrom", gd::toQString( str ).replace( '+', "%2B" ) ); Utils::Url::addQueryItem( reqUrl, "apfrom", gd::toQString( str ).replace( '+', "%2B" ) );
netReply = mgr.get( QNetworkRequest( reqUrl ) ); netReply = mgr.get( QNetworkRequest( reqUrl ) );