From 17736a7d5d6b4b4ef09011c705a2b5d9f69ee636 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 18 Nov 2023 20:09:37 +0700 Subject: [PATCH] Improve code for retracker addition (#333) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cønstantine Kovalensky <45331093+kovalensky@users.noreply.github.com> --- library/includes/functions_torrent.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/library/includes/functions_torrent.php b/library/includes/functions_torrent.php index 179f85cb..83a469a2 100644 --- a/library/includes/functions_torrent.php +++ b/library/includes/functions_torrent.php @@ -512,22 +512,11 @@ function send_torrent_with_passkey ($filename) } // Add retracker - if (isset($tr_cfg['retracker']) && $tr_cfg['retracker']) + if (!empty($bb_cfg['tracker']['retracker_host']) && $bb_cfg['tracker']['retracker']) { if (bf($userdata['user_opt'], 'user_opt', 'user_retracker') || IS_GUEST) { - if (!isset($tor['announce-list'])) - { - $tor['announce-list'] = array( - array($announce), - $announce_urls_add, - array($tr_cfg['retracker_host']) - ); - } - else - { - $tor['announce-list'] = array_merge($tor['announce-list'], array(array($tr_cfg['retracker_host']))); - } + $tor['announce-list'] = array_merge((isset($tor['announce-list']) ? $tor['announce-list'] : array()), [$bb_cfg['tracker']['retracker_host']]); } }