mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
Fix magnet link passkey creation for new users (#122)
https://github.com/torrentpier/torrentpier/pull/461
This commit is contained in:
parent
f845d1230a
commit
c011d71b89
@ -10,6 +10,7 @@
|
||||
- Torrent file content sort fix [\#119](https://github.com/torrentpier/torrentpier-lts/pull/119) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Fix release template editor [\#120](https://github.com/torrentpier/torrentpier-lts/pull/120) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Fix some notices in admin panel reported by BugSnag [\#121](https://github.com/torrentpier/torrentpier-lts/pull/121) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Fix magnet link passkey creation for new users [\#122](https://github.com/torrentpier/torrentpier-lts/pull/122) ([belomaxorka](https://github.com/belomaxorka))
|
||||
|
||||
## [v2.1.5-2023.03](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.03) (2023-04-04)
|
||||
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.03...main)
|
||||
|
@ -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'], $userdata['session_logged_in']);
|
||||
$tor_magnet = create_magnet($tor_info['info_hash'], $passkey['auth_key']);
|
||||
|
||||
// ratio limits
|
||||
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];
|
||||
|
@ -72,8 +72,8 @@ $domain_name = 'torrentpier.com'; // enter here your primary domain name of your
|
||||
$domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $domain_name;
|
||||
|
||||
// Version info
|
||||
$bb_cfg['tp_version'] = '2.1.5-2023.03';
|
||||
$bb_cfg['tp_release_date'] = '04-04-2023';
|
||||
$bb_cfg['tp_version'] = '2.1.5-2023.04';
|
||||
$bb_cfg['tp_release_date'] = '04-05-2023';
|
||||
$bb_cfg['tp_release_state'] = 'LTS';
|
||||
$bb_cfg['tp_zf_version'] = '2.4.13';
|
||||
|
||||
|
@ -2560,11 +2560,29 @@ function pad_with_space ($str)
|
||||
return ($str) ? " $str " : $str;
|
||||
}
|
||||
|
||||
function create_magnet ($infohash, $auth_key, $logged_in)
|
||||
function create_magnet ($infohash, $auth_key)
|
||||
{
|
||||
global $bb_cfg, $_GET, $userdata, $images;
|
||||
global $bb_cfg, $images, $lang, $userdata;
|
||||
|
||||
$passkey_url = ((!$logged_in || isset($_GET['no_passkey'])) && $bb_cfg['bt_tor_browse_only_reg']) ? '' : "?{$bb_cfg['passkey_key']}=$auth_key";
|
||||
if (IS_GUEST && $bb_cfg['bt_tor_browse_only_reg'])
|
||||
{
|
||||
$passkey = '';
|
||||
}
|
||||
elseif (empty($auth_key))
|
||||
{
|
||||
require(INC_DIR .'functions_torrent.php');
|
||||
if (!$passkey = generate_passkey($userdata['user_id'], true))
|
||||
{
|
||||
bb_die($lang['PASSKEY_ERR_EMPTY']);
|
||||
}
|
||||
$auth_key = $passkey;
|
||||
}
|
||||
else
|
||||
{
|
||||
$passkey = $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>';
|
||||
}
|
||||
|
||||
|
@ -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'], $userdata['session_logged_in']);
|
||||
$tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key']);
|
||||
$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';
|
||||
|
@ -512,7 +512,7 @@ foreach ($topic_rowset as $topic)
|
||||
|
||||
if (isset($topic['tor_size']))
|
||||
{
|
||||
$tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key'], $userdata['session_logged_in']);
|
||||
$tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key']);
|
||||
|
||||
$template->assign_block_vars('t.tor', array(
|
||||
'SEEDERS' => (int) $topic['seeders'],
|
||||
|
Loading…
Reference in New Issue
Block a user