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

+3 -3
View File
@@ -4,7 +4,7 @@ import {
checkScannerAvailability,
getScannerVersions,
checkScannerUpdates,
cleanupScannerVolumes,
cleanupScannerCache,
getGlobalScannerDefaults,
type ScannerType
} from '$lib/server/scanner';
@@ -195,8 +195,8 @@ export const DELETE: RequestHandler = async ({ url, cookies }) => {
}
}
// Also cleanup scanner database volumes
await cleanupScannerVolumes(parsedEnvId);
// Also cleanup scanner database cache (volumes + bind mount dirs)
await cleanupScannerCache(parsedEnvId);
return json({
success: true,
+40
View File
@@ -0,0 +1,40 @@
import { json, type RequestHandler } from '@sveltejs/kit';
import { cleanupScannerCache } from '$lib/server/scanner';
import { authorize } from '$lib/server/authorize';
import { getEnvironments } from '$lib/server/db';
export const DELETE: RequestHandler = async ({ cookies }) => {
const auth = await authorize(cookies);
if (auth.authEnabled && !await auth.can('settings', 'edit')) {
return json({ error: 'Permission denied' }, { status: 403 });
}
try {
const envs = await getEnvironments();
// Clean local cache (volumes + bind mount dirs)
const result = await cleanupScannerCache();
// Clean remote environment volumes
const skippedEnvs: string[] = [];
for (const env of envs) {
try {
const envResult = await cleanupScannerCache(env.id);
result.volumes.push(...envResult.volumes);
} catch {
skippedEnvs.push(env.name);
}
}
return json({
success: true,
removedVolumes: result.volumes,
removedDirs: result.dirs,
skippedEnvironments: skippedEnvs
});
} catch (error) {
console.error('Failed to clear scanner cache:', error);
return json({ error: 'Failed to clear scanner cache' }, { status: 500 });
}
};