diff --git a/app/Livewire/Ui/Nx/Mail/QuarantineList.php b/app/Livewire/Ui/Nx/Mail/QuarantineList.php index f827bfe..21c4fd3 100644 --- a/app/Livewire/Ui/Nx/Mail/QuarantineList.php +++ b/app/Livewire/Ui/Nx/Mail/QuarantineList.php @@ -29,6 +29,28 @@ class QuarantineList extends Component #[On('quarantine:updated')] public function refresh(): void {} + public function clearHistory(): void + { + $password = env('RSPAMD_PASSWORD', ''); + $opts = [ + 'http' => [ + 'method' => 'POST', + 'timeout' => 5, + 'ignore_errors' => true, + 'content' => '', + 'header' => "Content-Type: application/json\r\n" . + ($password !== '' ? "Password: {$password}\r\n" : ''), + ], + ]; + $ctx = stream_context_create($opts); + @file_get_contents('http://127.0.0.1:11334/historyreset', false, $ctx); + + $this->dispatch('toast', type: 'done', badge: 'Quarantäne', + title: 'Verlauf geleert', + text: 'RSpamd-History wurde zurückgesetzt.', + duration: 3000); + } + public function updatedFilter(): void { $this->resetPage(); } public function updatedSearch(): void { $this->resetPage(); } public function updatedPerPage(): void { $this->resetPage(); } diff --git a/resources/views/livewire/ui/nx/mail/quarantine-list.blade.php b/resources/views/livewire/ui/nx/mail/quarantine-list.blade.php index 076f595..a4afa65 100644 --- a/resources/views/livewire/ui/nx/mail/quarantine-list.blade.php +++ b/resources/views/livewire/ui/nx/mail/quarantine-list.blade.php @@ -20,6 +20,16 @@ + @if($counts['all'] > 0) + + @endif