This commit is contained in:
Andras Bacsai
2021-06-18 21:16:05 +02:00
committed by GitHub
parent d43cd663d2
commit 2ff9c5fed5
18 changed files with 849 additions and 99 deletions

View File

@@ -0,0 +1,25 @@
import { saveServerLog } from '$lib/api/applications/logging';
import { execShellAsync } from '$lib/api/common';
import type { Request } from '@sveltejs/kit';
export async function post(request: Request) {
try {
const output = await execShellAsync('docker image prune -af')
return {
status: 200,
body: {
message: 'OK',
output: output.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split('\n').pop()
}
}
} catch (error) {
await saveServerLog(error);
return {
status: 500,
body: {
error: error.message || error
}
};
}
}