mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
Detect if IP is SeedBox
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Filament\Resources\System\SeedBoxRecordResource\Pages;
|
||||
|
||||
use App\Exceptions\SeedBoxYesException;
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Forms;
|
||||
|
||||
class ListSeedBoxRecords extends PageList
|
||||
{
|
||||
@@ -15,6 +16,24 @@ class ListSeedBoxRecords extends PageList
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
Actions\Action::make('check')
|
||||
->label(__('admin.resources.seed_box_record.check_modal_btn'))
|
||||
->form([
|
||||
Forms\Components\TextInput::make('ip')->required()->label('IP'),
|
||||
Forms\Components\TextInput::make('uid')->required()->label('UID'),
|
||||
])
|
||||
->modalHeading(__('admin.resources.seed_box_record.check_modal_header'))
|
||||
->action(function ($data) {
|
||||
try {
|
||||
isIPSeedBox($data['ip'], $data['uid'], true, true);
|
||||
$this->notify('success', nexus_trans("seed-box.is_seed_box_no"));
|
||||
} catch (SeedBoxYesException $exception) {
|
||||
$this->notify('danger', nexus_trans("seed-box.is_seed_box_yes", ['id' => $exception->getId()]));
|
||||
} catch (\Throwable $throwable) {
|
||||
do_log($throwable->getMessage() . $throwable->getTraceAsString(), "error");
|
||||
$this->notify('danger', $throwable->getMessage());
|
||||
}
|
||||
})
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user