Feat: Quarantäne-Verlauf leeren Button (RSpamd historyreset)

main v1.1.431
boban 2026-04-27 06:11:41 +02:00
parent be3502f197
commit 0beb12569b
2 changed files with 32 additions and 0 deletions

View File

@ -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(); }

View File

@ -20,6 +20,16 @@
<option value="50">50 / Seite</option>
<option value="100">100 / Seite</option>
</select>
@if($counts['all'] > 0)
<button wire:click="clearHistory"
wire:confirm="Gesamten RSpamd-Verlauf löschen?"
class="mw-btn-del" title="Verlauf leeren">
<svg width="13" height="13" viewBox="0 0 14 14" fill="none">
<path d="M2 3.5h10M5.5 3.5V2.5h3v1M6 6v4M8 6v4M3 3.5l.7 8h6.6l.7-8" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Verlauf leeren
</button>
@endif
</div>
</div>