mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Merge pull request #7990 from Piccirello/subnet-whitelist-refactor
Refactor ip subnet whitelist
This commit is contained in:
commit
0a45fc9ffe
5 changed files with 22 additions and 23 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <QCryptographicHash>
|
||||
#include <QDir>
|
||||
#include <QLocale>
|
||||
#include <QMutableListIterator>
|
||||
#include <QPair>
|
||||
#include <QSettings>
|
||||
|
||||
|
@ -487,13 +488,17 @@ QList<Utils::Net::Subnet> Preferences::getWebUiAuthSubnetWhitelist() const
|
|||
return subnets;
|
||||
}
|
||||
|
||||
void Preferences::setWebUiAuthSubnetWhitelist(const QList<Utils::Net::Subnet> &subnets)
|
||||
void Preferences::setWebUiAuthSubnetWhitelist(QStringList subnets)
|
||||
{
|
||||
QStringList subnetsStringList;
|
||||
for (const Utils::Net::Subnet &subnet : subnets)
|
||||
subnetsStringList.append(Utils::Net::subnetToString(subnet));
|
||||
QMutableListIterator<QString> i(subnets);
|
||||
while (i.hasNext()) {
|
||||
bool ok = false;
|
||||
const Utils::Net::Subnet subnet = Utils::Net::parseSubnet(i.next().trimmed(), &ok);
|
||||
if (!ok)
|
||||
i.remove();
|
||||
}
|
||||
|
||||
setValue("Preferences/WebUI/AuthSubnetWhitelist", subnetsStringList);
|
||||
setValue("Preferences/WebUI/AuthSubnetWhitelist", subnets);
|
||||
}
|
||||
|
||||
QString Preferences::getServerDomains() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue