BitTorrent v2 support 🐸 (#866)

* BitTorrent v2 support

* Update TorrentFileList.php

* BitTorrent v2 support

Added support for BitTorrent v2 file hash displaying, magnet links

* Updated

* Updated

* Update changes.txt

* Update Torrent.php

* Update Torrent.php

* Updated

* Added support in announcer

* Update announce.php

* Update scrape.php

* Update scrape.php

* Update scrape.php

* Changed the condition for single files

* Update scrape.php

* Update displaying_torrent.php

* Update displaying_torrent.php

* Update displaying_torrent.php

---------

Co-authored-by: Roman Kelesidis <roman25052006.kelesh@gmail.com>
This commit is contained in:
Constantine Kovalensky 2023-08-27 15:33:38 +04:00 committed by GitHub
commit fadce7a297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 104 additions and 27 deletions

View file

@ -1760,11 +1760,12 @@ function decode_text_match($txt)
* Create magnet link
*
* @param string $infohash
* @param string $infohash_v2
* @param string|bool $auth_key
*
* @return string
*/
function create_magnet($infohash, $auth_key): string
function create_magnet(string $infohash, string $infohash_v2, $auth_key): string
{
global $bb_cfg, $images;
@ -1778,7 +1779,7 @@ function create_magnet($infohash, $auth_key): string
return false;
}
return '<a href="magnet:?xt=urn:btih:' . bin2hex($infohash) . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$auth_key") . '"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>';
return '<a href="magnet:?xt=urn:btih:' . bin2hex($infohash) . (!empty($infohash_v2) ? '&xt=urn:btmh:1220' . bin2hex($infohash_v2) : '') . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$auth_key") . '"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>';
}
function set_die_append_msg($forum_id = null, $topic_id = null, $group_id = null)