Passkey rework 🔫 (#839)

* WIP: Passkey rework 🔫

* Update tracker.php

* Update Torrent.php

* Update Torrent.php

* Update displaying_torrent.php

* Update viewforum.php

* Update Torrent.php

* Update functions.php

* Update functions.php

* Updated

* Update config.php

* Update functions.php

* Update usercp_viewprofile.tpl

* Update usercp_viewprofile.tpl

* Updated

* Updated

* Update usercp_viewprofile.tpl

* Update usercp_viewprofile.tpl

* Update displaying_torrent.php
This commit is contained in:
Roman Kelesidis 2023-07-23 23:55:57 +07:00 committed by GitHub
commit 9ba9ca2b61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 88 additions and 52 deletions

View file

@ -13,6 +13,21 @@ if (!defined('BB_ROOT')) {
global $bb_cfg, $t_data, $poster_id, $is_auth, $dl_link_css, $dl_status_css, $lang, $images;
$bt_user_id = $userdata['user_id'];
$bt_topic_id = $t_data['topic_id'];
$user_passkey = \TorrentPier\Legacy\Torrent::getPasskey($bt_user_id);
if (!$user_passkey) {
$template->assign_block_vars('postrow.attach.tor_reged', array());
$template->assign_vars(array(
'TOR_BLOCKED' => true,
'TOR_BLOCKED_MSG' => $lang['PASSKEY_ALERT_INFO'],
));
return;
}
$change_peers_bgr_over = true;
$bgr_class_1 = 'row1';
$bgr_class_2 = 'row2';
@ -58,8 +73,6 @@ if ($bb_cfg['bt_allow_spmode_change']) {
}
}
$bt_topic_id = $t_data['topic_id'];
$bt_user_id = $userdata['user_id'];
$attach_id = $attachments['_' . $post_id][$i]['attach_id'];
$tracker_status = $attachments['_' . $post_id][$i]['tracker_status'];
$download_count = $attachments['_' . $post_id][$i]['download_count'];
@ -142,8 +155,7 @@ if ($tor_reged && $tor_info) {
$tor_type = $tor_info['tor_type'];
// 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'], $user_passkey);
// ratio limits
$min_ratio_dl = $bb_cfg['bt_min_ratio_allow_dl_tor'];