mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Magnet link tweaks (#1035)
This commit is contained in:
parent
47d07e183c
commit
018dd69177
6 changed files with 13 additions and 7 deletions
|
@ -1861,20 +1861,23 @@ function create_magnet(string $infohash, string $infohash_v2, string $auth_key,
|
|||
return false;
|
||||
}
|
||||
|
||||
$v1_support = !empty($infohash);
|
||||
$v2_support = !empty($infohash_v2);
|
||||
|
||||
$magnet = 'magnet:?';
|
||||
|
||||
if (!empty($infohash)) {
|
||||
if ($v1_support) {
|
||||
$magnet .= 'xt=urn:btih:' . bin2hex($infohash);
|
||||
}
|
||||
|
||||
if (!empty($infohash_v2)) {
|
||||
if (!empty($infohash)) {
|
||||
if ($v2_support) {
|
||||
if ($v1_support) {
|
||||
$magnet .= '&';
|
||||
}
|
||||
$magnet .= 'xt=urn:btmh:1220' . bin2hex($infohash_v2);
|
||||
}
|
||||
|
||||
return '<a title="' . $lang['MAGNET'] . '" href="' . $magnet . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$auth_key") . '&dn=' . urlencode($name) . '"><img src="' . $images['icon_magnet'] . '" width="12" height="12" border="0" /></a>';
|
||||
return '<a title="' . ($v2_support ? $lang['MAGNET_v2'] : $lang['MAGNET']) . '" href="' . $magnet . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . "?{$bb_cfg['passkey_key']}=$auth_key") . '&dn=' . urlencode($name) . '"><img src="' . ($v2_support ? $images['icon_magnet_v2'] : $images['icon_magnet']) . '" width="12" height="12" border="0" /></a>';
|
||||
}
|
||||
|
||||
function set_die_append_msg($forum_id = null, $topic_id = null, $group_id = null)
|
||||
|
|
|
@ -1084,6 +1084,7 @@ $lang['SEEDING'] = 'Seed';
|
|||
$lang['LEECHING'] = 'Leech';
|
||||
$lang['IS_REGISTERED'] = 'Registered';
|
||||
$lang['MAGNET'] = 'Magnet-link';
|
||||
$lang['MAGNET_v2'] = 'Magnet-link (BitTorrent v2 supported)';
|
||||
|
||||
//torrent status mod
|
||||
$lang['TOR_STATUS'] = 'Status';
|
||||
|
|
|
@ -389,7 +389,8 @@ class Torrent
|
|||
|
||||
if (isset($info['length'])) {
|
||||
$totallen = (float)$info['length'];
|
||||
} elseif (isset($bt_v1, $info['files']) && \is_array($info['files'])) {
|
||||
}
|
||||
elseif (isset($bt_v1, $info['files']) && \is_array($info['files'])) {
|
||||
foreach ($info['files'] as $fn => $f) {
|
||||
// Exclude padding files
|
||||
if (($f['attr'] ?? null) !== 'p') {
|
||||
|
|
|
@ -42,7 +42,7 @@ class TorrentFileList
|
|||
public function get_filelist()
|
||||
{
|
||||
global $html;
|
||||
if (($this->tor_decoded['info']['meta version'] ?? null) == 2) {
|
||||
if (($this->tor_decoded['info']['meta version'] ?? 1) === 2) {
|
||||
if (is_array($this->tor_decoded['info']['file tree'] ?? null)) {
|
||||
return $this->fileTreeList($this->tor_decoded['info']['file tree']); //v2
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class TorrentFileList
|
|||
continue;
|
||||
}
|
||||
// Exclude padding files
|
||||
if (($f['attr'] ?? null) === 'p') {
|
||||
if (isset($f['attr']) && $f['attr'] === 'p') {
|
||||
continue;
|
||||
}
|
||||
array_deep($f['path'], 'clean_tor_dirname');
|
||||
|
|
BIN
styles/images/magnet_v2.png
Normal file
BIN
styles/images/magnet_v2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -72,6 +72,7 @@ $images['folder_dl_hot_new'] = $_main . 'folder_dl_hot_new.gif';
|
|||
$images['icon_clip'] = $_img . 'icon_clip.gif';
|
||||
$images['icon_dn'] = $_img . 'icon_dn.gif';
|
||||
$images['icon_magnet'] = $_img . 'magnet.png';
|
||||
$images['icon_magnet_v2'] = $_img . 'magnet_v2.png';
|
||||
|
||||
// posting_icons
|
||||
$images['post_new'] = $_lang . 'post.gif';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue