mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Fixed announcer-list issue (#1129)
* Fixed announcer-list issue * Update CHANGELOG.md
This commit is contained in:
parent
8e0eb839a8
commit
e26e3b36c0
2 changed files with 26 additions and 5 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fixed announcer-list issue [\#1129](https://github.com/torrentpier/torrentpier/pull/1129) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Removed client column from bb_bt_tracker table [\#1128](https://github.com/torrentpier/torrentpier/pull/1128) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Removed one-time used variables [\#1120](https://github.com/torrentpier/torrentpier/pull/1120) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Don't create empty announce-list dict, if ann_urls are empty [\#1119](https://github.com/torrentpier/torrentpier/pull/1119) ([kovalensky](https://github.com/kovalensky))
|
||||
|
|
|
@ -547,9 +547,12 @@ class Torrent
|
|||
bb_die($lang['TORFILE_INVALID']);
|
||||
}
|
||||
|
||||
// Get tracker announcer
|
||||
$announce_url = $bb_cfg['ocelot']['enabled'] ? $bb_cfg['ocelot']['url'] . "$passkey_val/announce" : $bb_cfg['bt_announce_url'] . "?$passkey_key=$passkey_val";
|
||||
|
||||
// Replace original announce url with tracker default
|
||||
if ($bb_cfg['bt_replace_ann_url'] || !isset($tor['announce'])) {
|
||||
$tor['announce'] = $bb_cfg['ocelot']['enabled'] ? $bb_cfg['ocelot']['url'] . "$passkey_val/announce" : $bb_cfg['bt_announce_url'] . "?$passkey_key=$passkey_val";
|
||||
if ($bb_cfg['bt_replace_ann_url']) {
|
||||
$tor['announce'] = $announce_url;
|
||||
}
|
||||
|
||||
// Get additional announce urls
|
||||
|
@ -564,14 +567,31 @@ class Torrent
|
|||
// Delete all additional urls
|
||||
if ($bb_cfg['bt_del_addit_ann_urls'] || $bb_cfg['bt_disable_dht']) {
|
||||
unset($tor['announce-list']);
|
||||
} elseif (!empty($announce_urls_add)) {
|
||||
$tor['announce-list'] = array_merge($tor['announce-list'] ?? [], $announce_urls_add);
|
||||
} else {
|
||||
// Creating announce-list if not exist
|
||||
if (!isset($tor['announce-list']) || !is_array($tor['announce-list'])) {
|
||||
$tor['announce-list'] = [];
|
||||
}
|
||||
|
||||
// Adding tracker announcer to announce-list
|
||||
if ($bb_cfg['bt_replace_ann_url']) {
|
||||
// Adding tracker announcer as main announcer (At start)
|
||||
array_unshift($tor['announce-list'], [$announce_url]);
|
||||
} else {
|
||||
// Adding tracker announcer (At end)
|
||||
$tor['announce-list'] = array_merge($tor['announce-list'], [[$announce_url]]);
|
||||
}
|
||||
|
||||
// Adding additional announce urls (If present)
|
||||
if (!empty($announce_urls_add)) {
|
||||
$tor['announce-list'] = array_merge($tor['announce-list'], $announce_urls_add);
|
||||
}
|
||||
}
|
||||
|
||||
// Add retracker
|
||||
if (!empty($bb_cfg['tracker']['retracker_host']) && $bb_cfg['tracker']['retracker']) {
|
||||
if (bf($userdata['user_opt'], 'user_opt', 'user_retracker') || IS_GUEST) {
|
||||
$tor['announce-list'] = array_merge($tor['announce-list'] ?? [], [[$bb_cfg['tracker']['retracker_host']]]);
|
||||
$tor['announce-list'] = array_merge($tor['announce-list'], [[$bb_cfg['tracker']['retracker_host']]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue