From 953402c605d59aa4af4247034423fbe46299f411 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 12 Oct 2024 22:46:13 +0700 Subject: [PATCH] Updated --- bt/announce.php | 6 ++++-- library/config.php | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bt/announce.php b/bt/announce.php index 5110ff6fc..ed70c1ec7 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -67,8 +67,10 @@ if (strlen($peer_id) !== 20) { // Check for client ban if ($bb_cfg['client_ban']['enabled']) { foreach ($bb_cfg['client_ban']['clients'] as $clientId => $reason) { - if (str_starts_with($peer_id, $clientId)) { - msg_die(empty($reason) ? 'Your BitTorrent client has been banned!' : $reason); + if (($bb_cfg['client_ban']['only_allow_mode'] && !str_starts_with($peer_id, $clientId)) + || str_starts_with($peer_id, $clientId) + ) { + msg_die((empty($reason) || $bb_cfg['client_ban']['only_allow_mode']) ? 'Your BitTorrent client has been banned!' : $reason); } } } diff --git a/library/config.php b/library/config.php index 8b1fc394e..8a45b75de 100644 --- a/library/config.php +++ b/library/config.php @@ -100,7 +100,8 @@ $bb_cfg['verify_reported_ip'] = true; // Verify IP reported by client against $_ $bb_cfg['allow_internal_ip'] = false; // Allow internal IP (10.xx.. etc.) $bb_cfg['client_ban'] = [ 'enabled' => false, - // Clients to be blocked, for example, peer id '-UT' will block all uTorrent clients, '-UT2' will block builds starting with 2 (default: false) + 'only_allow_mode' => false, + // Clients to be blocked / allowed (in "only allow mode"), for example, peer id '-UT' will block all uTorrent clients, '-UT2' will block builds starting with 2 (default: false) // The second argument is being shown in the torrent client as a failure message // Handy client list: https://github.com/transmission/transmission/blob/f85c3b6f8db95d5363f6ec38eee603f146c6adb6/libtransmission/clients.cc#L504 'clients' => [