mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 04:52:18 +08:00
admin user add link + upload over speed msg
This commit is contained in:
@@ -464,7 +464,7 @@ class HitAndRunRepository extends BaseRepository
|
||||
|
||||
private function getCanPardonStatus(): array
|
||||
{
|
||||
return [HitAndRun::STATUS_INSPECTING, HitAndRun::STATUS_UNREACHED];
|
||||
return HitAndRun::CAN_PARDON_STATUS;
|
||||
}
|
||||
|
||||
public function renderOnUploadPage($value, $searchBoxId): string
|
||||
|
||||
@@ -593,7 +593,7 @@ class TrackerRepository extends BaseRepository
|
||||
$notSeedBoxMaxSpeedMbps = Setting::get('seed_box.not_seed_box_max_speed');
|
||||
do_log("upSpeedMbps: $upSpeedMbps, notSeedBoxMaxSpeedMbps: $notSeedBoxMaxSpeedMbps");
|
||||
if ($upSpeedMbps > $notSeedBoxMaxSpeedMbps) {
|
||||
(new \App\Repositories\UserRepository())->updateDownloadPrivileges(null, $user, 'no');
|
||||
(new \App\Repositories\UserRepository())->updateDownloadPrivileges(null, $user, 'no', 'upload_over_speed');
|
||||
do_log("user: {$user->id} downloading privileges have been disabled! (over speed)", 'error');
|
||||
throw new TrackerException("Your downloading privileges have been disabled! (over speed)");
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class UserRepository extends BaseRepository
|
||||
}
|
||||
|
||||
|
||||
public function updateDownloadPrivileges($operator, $user, $status)
|
||||
public function updateDownloadPrivileges($operator, $user, $status, $disableReasonKey = null)
|
||||
{
|
||||
if (!in_array($status, ['yes', 'no'])) {
|
||||
throw new \InvalidArgumentException("Invalid status: $status");
|
||||
@@ -345,8 +345,12 @@ class UserRepository extends BaseRepository
|
||||
if ($status == 'no') {
|
||||
$update = ['downloadpos' => 'no'];
|
||||
$modComment = date('Y-m-d') . " - Download disable by " . $operatorUsername;
|
||||
$message['subject'] = nexus_trans('message.download_disable.subject', [], $targetUser->locale);
|
||||
$message['msg'] = nexus_trans('message.download_disable.body', ['operator' => $operatorUsername], $targetUser->locale);
|
||||
$msgTransPrefix = "message.download_disable";
|
||||
if ($disableReasonKey !== null) {
|
||||
$msgTransPrefix .= "_$disableReasonKey";
|
||||
}
|
||||
$message['subject'] = nexus_trans("$msgTransPrefix.subject", [], $targetUser->locale);
|
||||
$message['msg'] = nexus_trans("$msgTransPrefix.body", ['operator' => $operatorUsername], $targetUser->locale);
|
||||
} else {
|
||||
$update = ['downloadpos' => 'yes'];
|
||||
$modComment = date('Y-m-d') . " - Download enable by " . $operatorUsername;
|
||||
|
||||
Reference in New Issue
Block a user