Minor improvements (#238)

* Minor improvements

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-09-13 17:14:27 +07:00 committed by GitHub
parent e8699a0708
commit 20f9ccc489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 28 deletions

View File

@ -6,7 +6,7 @@
**Merged pull requests:**
- Release v2.1.5-2023.09 🎉
- Minor improvements [\#235](https://github.com/torrentpier/torrentpier-lts/pull/235), [\#236](https://github.com/torrentpier/torrentpier-lts/pull/236), [\#237](https://github.com/torrentpier/torrentpier-lts/pull/237) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#235](https://github.com/torrentpier/torrentpier-lts/pull/235), [\#236](https://github.com/torrentpier/torrentpier-lts/pull/236), [\#237](https://github.com/torrentpier/torrentpier-lts/pull/237), [\#238](https://github.com/torrentpier/torrentpier-lts/pull/238) ([belomaxorka](https://github.com/belomaxorka))
## [v2.1.5-2023.08](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.08) (2023-09-04)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.07...v2.1.5-2023.08)

View File

@ -19,10 +19,6 @@ if (isset($_GET['event']) && $_GET['event'] === 'completed')
$announce_interval = $bb_cfg['announce_interval'];
$passkey_key = $bb_cfg['passkey_key'];
$max_left_val = 536870912000; // 500 GB
$max_up_down_val = 5497558138880; // 5 TB
$max_up_add_val = 85899345920; // 80 GB
$max_down_add_val = 85899345920; // 80 GB
// Recover info_hash
if (isset($_GET['?info_hash']) && !isset($_GET['info_hash']))
@ -37,7 +33,7 @@ if (strpos($_SERVER['REQUEST_URI'], 'scrape') !== false)
}
if (!isset($_GET[$passkey_key]) || !is_string($_GET[$passkey_key]) || strlen($_GET[$passkey_key]) != BT_AUTH_KEY_LENGTH)
{
msg_die('Please LOG IN and REDOWNLOAD this torrent (passkey not found)');
msg_die('Please LOG IN and RE-DOWNLOAD this torrent (passkey not found)');
}
// Input var names
@ -74,33 +70,37 @@ $passkey = isset($$passkey_key) ? $$passkey_key : null;
// Verify request
// Required params (info_hash, peer_id, port, uploaded, downloaded, left, passkey)
if (!isset($info_hash) || strlen($info_hash) != 20)
if (!isset($info_hash))
{
msg_die('Invalid info_hash');
msg_die('info_hash was not provided');
}
if (strlen($info_hash) != 20)
{
msg_die('Invalid info_hash: ' . bin2hex($info_hash));
}
if (!isset($peer_id) || strlen($peer_id) != 20)
{
msg_die('Invalid peer_id');
msg_die('Invalid peer_id: ' . bin2hex($peer_id));
}
if (!isset($port) || $port < 0 || $port > 0xFFFF)
{
msg_die('Invalid port');
msg_die('Invalid port: ' . $port);
}
if (!isset($uploaded) || $uploaded < 0 || $uploaded > $max_up_down_val || $uploaded == 1844674407370)
if (!isset($uploaded) || $uploaded < 0)
{
msg_die('Invalid uploaded value');
msg_die('Invalid uploaded value: ' . $uploaded);
}
if (!isset($downloaded) || $downloaded < 0 || $downloaded > $max_up_down_val || $downloaded == 1844674407370)
if (!isset($downloaded) || $downloaded < 0)
{
msg_die('Invalid downloaded value');
msg_die('Invalid downloaded value: ' . $downloaded);
}
if (!isset($left) || $left < 0 || $left > $max_left_val)
if (!isset($left) || $left < 0)
{
msg_die('Invalid left value');
msg_die('Invalid left value: ' . $left);
}
if (!verify_id($passkey, BT_AUTH_KEY_LENGTH))
{
msg_die('Invalid passkey');
msg_die('Invalid passkey: ' . $passkey);
}
// IP
@ -243,7 +243,7 @@ else
}
if (empty($row['user_id']))
{
msg_die('Please LOG IN and REDOWNLOAD this torrent (user not found)');
msg_die('Please LOG IN and RE-DOWNLOAD this torrent (user not found)');
}
$user_id = $row['user_id'];

View File

@ -12,9 +12,13 @@ if (isset($_GET['?info_hash']) && !isset($_GET['info_hash']))
$_GET['info_hash'] = $_GET['?info_hash'];
}
if (!isset($_GET['info_hash']) || strlen($_GET['info_hash']) != 20)
if (!isset($_GET['info_hash']))
{
msg_die('Invalid info_hash');
msg_die('info_hash was not provided');
}
if (strlen($_GET['info_hash']) != 20)
{
msg_die('Invalid info_hash: ' . bin2hex($_GET['info_hash']));
}
$info_hash = $_GET['info_hash'];
@ -54,4 +58,4 @@ $output['files'][$info_hash] = array(
echo bencode($output);
tracker_exit();
exit;
exit;

View File

@ -154,7 +154,7 @@ if ($tor_reged && $tor_info)
// Magnet link
$passkey = DB()->fetch_row("SELECT auth_key FROM ". BB_BT_USERS ." WHERE user_id = ". (int) $bt_user_id ." LIMIT 1");
$tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key']);
$tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key'], wbr($t_data['topic_title']));
// ratio limits
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];

View File

@ -61,7 +61,7 @@ $bb_cfg['cache']['memcache'] = array(
$bb_cfg['cache']['redis'] = array(
'host' => '127.0.0.1',
'port' => 6379,
'pconnect' => true,
'pconnect' => PHP_ZTS ? false : true,
'con_required' => true,
);

View File

@ -2574,7 +2574,7 @@ function pad_with_space ($str)
return ($str) ? " $str " : $str;
}
function create_magnet ($infohash, $auth_key)
function create_magnet ($infohash, $auth_key, $name)
{
global $bb_cfg, $images, $lang, $userdata;
@ -2597,7 +2597,7 @@ function create_magnet ($infohash, $auth_key)
}
$passkey_url = $passkey ? "?{$bb_cfg['passkey_key']}=$auth_key" : '';
return '<a href="magnet:?xt=urn:btih:'. bin2hex($infohash) .'&tr='. urlencode($bb_cfg['bt_announce_url'] . $passkey_url) .'"><img src="'. $images['icon_magnet'] .'" width="12" height="12" border="0" /></a>';
return '<a href="magnet:?xt=urn:btih:' . bin2hex($infohash) . '&tr=' . urlencode($bb_cfg['bt_announce_url'] . $passkey_url) . '&dn=' . urlencode($name) . '"><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)

View File

@ -787,7 +787,7 @@ if ($allowed_forums)
$s_last = $tor['seeder_last_seen'];
$att_id = $tor['attach_id'];
$size = $tor['size'];
$tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key']);
$tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key'], wbr($tor['topic_title']));
$compl = $tor['complete_count'];
$dl_sp = ($dl) ? humn_size($dl, 0, 'KB') .'/s' : '0 KB/s';
$ul_sp = ($ul) ? humn_size($ul, 0, 'KB') .'/s' : '0 KB/s';
@ -993,4 +993,4 @@ $template->assign_vars(array(
'TR_POSTER_URL' => "$tracker_url?$poster_id_key=",
));
print_page('tracker.tpl');
print_page('tracker.tpl');

View File

@ -512,7 +512,7 @@ foreach ($topic_rowset as $topic)
if (isset($topic['tor_size']))
{
$tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key']);
$tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key'], wbr($topic['topic_title']));
$template->assign_block_vars('t.tor', array(
'SEEDERS' => (int) $topic['seeders'],