feat: Added ability to hide BitTorrent client in peers list (#1890)

* feat: Added ability to hide peer torrent client

* Update displaying_torrent.php

* Update functions.php

* Update register.php

* Updated
This commit is contained in:
Roman Kelesidis 2025-05-04 10:38:38 +03:00 committed by GitHub
commit f5d65b8911
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 39 additions and 22 deletions

40
composer.lock generated
View file

@ -3145,16 +3145,16 @@
},
{
"name": "symfony/mailer",
"version": "v6.4.18",
"version": "v6.4.21",
"source": {
"type": "git",
"url": "https://github.com/symfony/mailer.git",
"reference": "e93a6ae2767d7f7578c2b7961d9d8e27580b2b11"
"reference": "ada2809ccd4ec27aba9fc344e3efdaec624c6438"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mailer/zipball/e93a6ae2767d7f7578c2b7961d9d8e27580b2b11",
"reference": "e93a6ae2767d7f7578c2b7961d9d8e27580b2b11",
"url": "https://api.github.com/repos/symfony/mailer/zipball/ada2809ccd4ec27aba9fc344e3efdaec624c6438",
"reference": "ada2809ccd4ec27aba9fc344e3efdaec624c6438",
"shasum": ""
},
"require": {
@ -3205,7 +3205,7 @@
"description": "Helps sending emails",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/mailer/tree/v6.4.18"
"source": "https://github.com/symfony/mailer/tree/v6.4.21"
},
"funding": [
{
@ -3221,20 +3221,20 @@
"type": "tidelift"
}
],
"time": "2025-01-24T15:27:15+00:00"
"time": "2025-04-26T23:47:35+00:00"
},
{
"name": "symfony/mime",
"version": "v6.4.19",
"version": "v6.4.21",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "ac537b6c55ccc2c749f3c979edfa9ec14aaed4f3"
"reference": "fec8aa5231f3904754955fad33c2db50594d22d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/ac537b6c55ccc2c749f3c979edfa9ec14aaed4f3",
"reference": "ac537b6c55ccc2c749f3c979edfa9ec14aaed4f3",
"url": "https://api.github.com/repos/symfony/mime/zipball/fec8aa5231f3904754955fad33c2db50594d22d1",
"reference": "fec8aa5231f3904754955fad33c2db50594d22d1",
"shasum": ""
},
"require": {
@ -3290,7 +3290,7 @@
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v6.4.19"
"source": "https://github.com/symfony/mime/tree/v6.4.21"
},
"funding": [
{
@ -3306,7 +3306,7 @@
"type": "tidelift"
}
],
"time": "2025-02-17T21:23:52+00:00"
"time": "2025-04-27T13:27:38+00:00"
},
{
"name": "symfony/polyfill",
@ -3648,16 +3648,16 @@
"packages-dev": [
{
"name": "symfony/var-dumper",
"version": "v6.4.18",
"version": "v6.4.21",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "4ad10cf8b020e77ba665305bb7804389884b4837"
"reference": "22560f80c0c5cd58cc0bcaf73455ffd81eb380d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/4ad10cf8b020e77ba665305bb7804389884b4837",
"reference": "4ad10cf8b020e77ba665305bb7804389884b4837",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/22560f80c0c5cd58cc0bcaf73455ffd81eb380d5",
"reference": "22560f80c0c5cd58cc0bcaf73455ffd81eb380d5",
"shasum": ""
},
"require": {
@ -3713,7 +3713,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v6.4.18"
"source": "https://github.com/symfony/var-dumper/tree/v6.4.21"
},
"funding": [
{
@ -3729,7 +3729,7 @@
"type": "tidelift"
}
],
"time": "2025-01-17T11:26:11+00:00"
"time": "2025-04-09T07:34:50+00:00"
}
],
"aliases": [],
@ -3743,6 +3743,6 @@
"platform": {
"php": ">=8.1"
},
"platform-dev": [],
"plugin-api-version": "2.3.0"
"platform-dev": {},
"plugin-api-version": "2.6.0"
}

View file

@ -301,7 +301,7 @@ if ($tor_reged && $tor_info) {
$sql = "SELECT
tr.user_id, tr.ip, tr.ipv6, tr.port, tr.peer_id, tr.uploaded, tr.downloaded, tr.remain,
tr.seeder, tr.releaser, tr.speed_up, tr.speed_down, tr.update_time,
tr.complete_percent, u.username, u.user_rank
tr.complete_percent, u.username, u.user_rank, u.user_opt
FROM " . BB_BT_TRACKER . " tr
LEFT JOIN " . BB_USERS . " u ON u.user_id = tr.user_id
WHERE tr.topic_id = $tor_id
@ -455,10 +455,17 @@ if ($tor_reged && $tor_info) {
$row_bgr = ($change_peers_bgr_over) ? " class=\"$bgr_class\" onmouseover=\"this.className='$bgr_class_over';\" onmouseout=\"this.className='$bgr_class';\"" : '';
$tr[$x]++;
$peerTorrentClient = $lang['UNKNOWN'];
if (IS_AM || $peer['user_id'] == $userdata['user_id'] || !bf($peer['user_opt'], 'user_opt', 'user_hide_torrent_client')) {
if (isset($peer['peer_id'])) {
$peerTorrentClient = get_user_torrent_client($peer['peer_id']);
}
}
$template->assign_block_vars("$x_full.$x_row", [
'ROW_BGR' => $row_bgr,
'NAME' => ($peer['update_time']) ? $name : "<s>$name</s>",
'PEER_ID' => isset($peer['peer_id']) ? get_user_torrent_client($peer['peer_id']) : $lang['UNKNOWN'],
'PEER_ID' => $peerTorrentClient,
'COUNTRY' => render_flag(infoByIP((!empty($peer['ipv6']) ? $peer['ipv6'] : $peer['ip']), $peer['port'])['countryCode'], false),
'COMPL_PRC' => $compl_perc,
'UP_TOTAL' => ($max_up_id[$x] == $pid) ? "<b>$up_tot</b>" : $up_tot,

View file

@ -197,6 +197,7 @@ $bf['user_opt'] = [
'dis_post_edit' => 13, // [PROHIBITIONS] Block editing own posts / topics
'user_dls' => 14, // [SETTINGS] Hide list of "Current downloads" in my profile
'user_retracker' => 15, // [SETTINGS] Add my retracker into downloaded torrent files
'user_hide_torrent_client' => 16 // [SETTINGS] Option to hide user's torrent client in peer list
];
function bit2dec($bit_num)

View file

@ -365,6 +365,7 @@ foreach ($profile_fields as $field => $can_edit) {
'user_dls' => $reg_mode ? false : true,
'user_callseed' => $reg_mode ? true : true,
'user_retracker' => $reg_mode ? true : true,
'user_hide_torrent_client' => $reg_mode ? true : true,
];
foreach ($update_user_opt as $opt => $can_change_opt) {

View file

@ -1879,6 +1879,7 @@ $lang['DL_ULR'] = 'ULR';
$lang['DL_STOPPED'] = 'stopped';
$lang['DL_UPD'] = 'upd: ';
$lang['DL_INFO'] = 'shows data <i><b>only for the current session</b></i>';
$lang['HIDE_PEER_TORRENT_CLIENT'] = 'Hide my BitTorrent client name in peer list';
// Post PIN
$lang['POST_PIN'] = 'Pin first post';

View file

@ -319,6 +319,13 @@
<label><input type="radio" name="user_callseed" value="0" <!-- IF not USER_CALLSEED -->checked<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
<tr>
<td class="prof-title">{L_HIDE_PEER_TORRENT_CLIENT}:</td>
<td>
<label><input type="radio" name="user_hide_torrent_client" value="1" <!-- IF USER_HIDE_TORRENT_CLIENT -->checked<!-- ENDIF --> />{L_YES}</label>&nbsp;&nbsp;
<label><input type="radio" name="user_hide_torrent_client" value="0" <!-- IF not USER_HIDE_TORRENT_CLIENT -->checked<!-- ENDIF --> />{L_NO}</label>
</td>
</tr>
<tr>
<th colspan="2">{L_AVATAR_PANEL}</th>
</tr>