mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
torrent bought user cache use hash + err() use warning message sometime
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.4');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-06-05');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-06-08');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -61,17 +61,35 @@ function benc_resp_raw($x) {
|
||||
else
|
||||
echo $x;
|
||||
}
|
||||
function err($msg, $userid = 0, $torrentid = 0)
|
||||
function err($msg)
|
||||
{
|
||||
benc_resp(['failure reason' => $msg]);
|
||||
if (isset($GLOBALS['rep_dict'])) {
|
||||
$d = $GLOBALS['rep_dict'];
|
||||
} else {
|
||||
$torrent = $GLOBALS['torrent'] ?? [];
|
||||
$d = [
|
||||
"interval" => (int)\App\Repositories\TrackerRepository::MIN_ANNOUNCE_WAIT_SECOND,
|
||||
"min interval" => (int)\App\Repositories\TrackerRepository::MIN_ANNOUNCE_WAIT_SECOND,
|
||||
"complete" => intval($torrent['seeders'] ?? 0),
|
||||
"incomplete" => intval($torrent['leechers'] ?? 0),
|
||||
"peers" => [],
|
||||
];
|
||||
if (!empty($_REQUEST['compact'])) {
|
||||
$d['peers'] = ''; // Change `peers` from array to string
|
||||
$d['peers6'] = ''; // If peer use IPv6 address , we should add packed string in `peers6`
|
||||
}
|
||||
}
|
||||
if (!empty($_REQUEST['event'])) {
|
||||
//keep fail response, next request keep event param
|
||||
$d['failure reason'] = $msg;
|
||||
} else {
|
||||
//avoid retry frequent
|
||||
$d['warning message'] = $msg;
|
||||
}
|
||||
benc_resp($d);
|
||||
exit();
|
||||
}
|
||||
|
||||
function warn($msg)
|
||||
{
|
||||
benc_resp(['warning message' => $msg]);
|
||||
exit();
|
||||
}
|
||||
function check_cheater($userid, $torrentid, $uploaded, $downloaded, $anctime, $seeders=0, $leechers=0){
|
||||
global $cheaterdet_security,$nodetect_security, $CURUSER;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user