This commit is contained in:
jarek committed 2026-04-03 11:51:42 +02:00
1 parent e9a9f0ca25
commit 0bb10cabb9
42 files changed
+7147 -239

No files matched your search

@@ -499,7 +499,7 @@
// Hostname pattern (allows letters, numbers, hyphens, dots)
// Must start with letter/number, can contain dots for subdomains
const hostnamePattern = /^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*$/;
const hostnamePattern = /^[a-zA-Z0-9]([a-zA-Z0-9_-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9_-]*[a-zA-Z0-9])?)*$/;
return hostnamePattern.test(host);
}
@@ -40,6 +40,30 @@
let eventPollInterval = $derived($appSettings.eventPollInterval);
let metricsCollectionInterval = $derived($appSettings.metricsCollectionInterval);
let clearingCache = $state(false);
async function clearScannerCache() {
clearingCache = true;
try {
const res = await fetch('/api/settings/scanner/cache', { method: 'DELETE' });
const data = await res.json();
if (res.ok && data.success) {
const total = (data.removedVolumes?.length || 0) + (data.removedDirs?.length || 0);
if (total > 0) {
toast.success(`Scanner cache cleared (${total} items removed)`);
} else {
toast.info('Scanner cache was already empty');
}
} else {
toast.error(data.error || 'Failed to clear scanner cache');
}
} catch {
toast.error('Failed to clear scanner cache');
} finally {
clearingCache = false;
}
}
const dateFormatOptions: { value: DateFormat; label: string; example: string }[] = [
{ value: 'DD.MM.YYYY', label: 'DD.MM.YYYY', example: '31.12.2024' },
{ value: 'DD/MM/YYYY', label: 'DD/MM/YYYY', example: '31/12/2024' },
@@ -455,6 +479,26 @@
/>
<p class="text-xs text-muted-foreground">Use <code class="bg-muted px-1 rounded">{'{image}'}</code> as placeholder for the image name</p>
</div>
<div class="pt-2 border-t">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium">Scanner cache</p>
<p class="text-xs text-muted-foreground">Remove cached vulnerability databases to free disk space. Next scan will re-download fresh data (~200MB).</p>
</div>
<Button
variant="outline"
size="sm"
disabled={clearingCache || !$canAccess('settings', 'edit')}
onclick={clearScannerCache}
>
{#if clearingCache}
Clearing...
{:else}
Clear cache
{/if}
</Button>
</div>
</div>
</Card.Content>
</Card.Root>
@@ -220,7 +220,7 @@
</div>
{/if}
<div class="flex gap-2 pt-2 flex-wrap">
<div class="flex items-center gap-2 pt-2 flex-wrap">
<Button
variant="outline"
size="sm"