mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-16 20:49:28 +00:00
26 lines
694 B
TypeScript
26 lines
694 B
TypeScript
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
|
|
}
|
|
};
|
|
}
|
|
}
|