2022-01-08 06:51:24 +00:00
|
|
|
#include "globalbroadcaster.h"
|
|
|
|
#include <QGlobalStatic>
|
2022-05-16 14:10:12 +00:00
|
|
|
#include "utils.hh"
|
2022-01-08 06:51:24 +00:00
|
|
|
|
2022-04-23 08:15:23 +00:00
|
|
|
Q_GLOBAL_STATIC( GlobalBroadcaster, bdcaster )
|
|
|
|
GlobalBroadcaster::GlobalBroadcaster( QObject * parent ) : QObject( parent )
|
2022-01-08 06:51:24 +00:00
|
|
|
{
|
2022-07-16 01:13:33 +00:00
|
|
|
QStringList whiteUrlHosts = { "ajax.googleapis.com" };
|
|
|
|
|
|
|
|
for( auto host : whiteUrlHosts )
|
|
|
|
{
|
|
|
|
addWhitelist( host );
|
|
|
|
}
|
2022-01-08 06:51:24 +00:00
|
|
|
}
|
|
|
|
|
2022-04-23 08:15:23 +00:00
|
|
|
GlobalBroadcaster * GlobalBroadcaster::instance()
|
|
|
|
{
|
|
|
|
return bdcaster;
|
|
|
|
}
|
|
|
|
void GlobalBroadcaster::setPreference( Config::Preferences * p )
|
|
|
|
{
|
|
|
|
preference = p;
|
|
|
|
}
|
|
|
|
Config::Preferences * GlobalBroadcaster::getPreference()
|
|
|
|
{
|
|
|
|
return preference;
|
|
|
|
}
|
2022-01-08 06:51:24 +00:00
|
|
|
|
2022-06-08 00:19:23 +00:00
|
|
|
void GlobalBroadcaster::addWhitelist( QString url )
|
|
|
|
{
|
2022-10-15 05:58:24 +00:00
|
|
|
whitelist.insert( url );
|
|
|
|
auto baseUrl = Utils::Url::getHostBase( url );
|
|
|
|
whitelist.insert( baseUrl );
|
2022-06-07 13:22:37 +00:00
|
|
|
}
|
|
|
|
|
2022-06-08 00:19:23 +00:00
|
|
|
bool GlobalBroadcaster::existedInWhitelist( QString url )
|
|
|
|
{
|
2022-10-15 05:58:24 +00:00
|
|
|
return whitelist.contains(url);
|
2022-06-07 13:22:37 +00:00
|
|
|
}
|
2022-01-08 06:51:24 +00:00
|
|
|
// namespace global
|