mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 13:32:41 +08:00
add is_seed_box to peers
This commit is contained in:
@@ -138,12 +138,20 @@ class SeedBoxRepository extends BaseRepository
|
||||
}
|
||||
foreach (Arr::wrap($ipArr) as $ip) {
|
||||
if ((isIPV4($ip) || isIPV6($ip)) && $enableSeedBox && isIPSeedBox($ip, $uid)) {
|
||||
return '<img src="pic/misc/seed-box.png" style="vertical-align: bottom; height: 16px; margin-left: 4px" title="SeedBox" />';
|
||||
return $this->getSeedBoxIcon();
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getSeedBoxIcon($isSeedBox = true): string
|
||||
{
|
||||
if (!$isSeedBox) {
|
||||
return '';
|
||||
}
|
||||
return '<img src="pic/misc/seed-box.png" style="vertical-align: bottom; height: 16px; margin-left: 4px" title="SeedBox" />';
|
||||
}
|
||||
|
||||
private function clearCache()
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -841,11 +841,16 @@ class TrackerRepository extends BaseRepository
|
||||
'agent' => $queries['user_agent'],
|
||||
'connectable' => $this->getConnectable($queries['ip'], $queries['port'], $queries['user_agent'])
|
||||
];
|
||||
$isSeedBox = false;
|
||||
if (!empty($queries['ipv4'])) {
|
||||
$update['ipv4'] = $queries['ipv4'];
|
||||
$isSeedBox = isIPSeedBox($queries['ipv4'], $peer->userid);
|
||||
}
|
||||
if (!empty($queries['ipv6'])) {
|
||||
$update['ipv6'] = $queries['ipv6'];
|
||||
if (!$isSeedBox) {
|
||||
$isSeedBox = isIPSeedBox($queries['ipv6'], $peer->userid);
|
||||
}
|
||||
}
|
||||
|
||||
if ($peer->exists) {
|
||||
@@ -865,6 +870,7 @@ class TrackerRepository extends BaseRepository
|
||||
$update['last_action'] = $nowStr;
|
||||
$update['uploaded'] = $queries['uploaded'];
|
||||
$update['downloaded'] = $queries['downloaded'];
|
||||
$update['is_seed_box'] = intval($isSeedBox);
|
||||
|
||||
$logData = json_encode(Arr::except($update, ['peer_id']));
|
||||
if ($peer->exists) {
|
||||
|
||||
Reference in New Issue
Block a user