mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
Add ability to add and ban a peer from the Web UI
This commit is contained in:
@@ -29,8 +29,13 @@
|
||||
#include "transfercontroller.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QVector>
|
||||
|
||||
#include "base/bittorrent/peeraddress.h"
|
||||
#include "base/bittorrent/peerinfo.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/global.h"
|
||||
#include "apierror.h"
|
||||
|
||||
const char KEY_TRANSFER_DLSPEED[] = "dl_info_speed";
|
||||
const char KEY_TRANSFER_DLDATA[] = "dl_info_data";
|
||||
@@ -111,3 +116,15 @@ void TransferController::speedLimitsModeAction()
|
||||
{
|
||||
setResult(QString::number(BitTorrent::Session::instance()->isAltGlobalSpeedLimitEnabled()));
|
||||
}
|
||||
|
||||
void TransferController::banPeersAction()
|
||||
{
|
||||
checkParams({"peers"});
|
||||
|
||||
const QStringList peers = params()["peers"].split('|');
|
||||
for (const QString &peer : peers) {
|
||||
const BitTorrent::PeerAddress addr = BitTorrent::PeerAddress::parse(peer.trimmed());
|
||||
if (!addr.ip.isNull())
|
||||
BitTorrent::Session::instance()->banIP(addr.ip.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user