feat: add server log preview

This commit is contained in:
2026-03-23 21:13:54 +01:00
parent c7ef3e9d27
commit 36c31fa790
6 changed files with 207 additions and 2 deletions

View File

@@ -0,0 +1,20 @@
'use server';
import { requireAuth } from '@/lib/auth/server';
import { getServerLog } from '@/lib/api/server/serverLog';
export async function getServerLogAction(
serverId: string,
lines: number = 100
): Promise<{ success: true; lines: string[] } | { success: false; message: string }> {
try {
const session = await requireAuth();
const data = await getServerLog(session.token!, serverId, lines);
return { success: true, lines: data };
} catch (error) {
return {
success: false,
message: error instanceof Error ? error.message : 'Failed to fetch server log'
};
}
}