Restrict plugin lookups and reuse cached chat reads (Refs #98)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { getServer } from '$lib/server/fleet/servers.js';
|
||||
import { gameLogKey, resolveLogPath } from '$lib/server/fleet/logs.js';
|
||||
import { collectServerChat } from '$lib/server/fleet/chat.js';
|
||||
import { readServerChat } from '$lib/server/fleet/chat.js';
|
||||
|
||||
export async function GET({ params }: { params: { name: string } }) {
|
||||
const headers = { 'Cache-Control': 'no-store' };
|
||||
@@ -14,7 +14,7 @@ export async function GET({ params }: { params: { name: string } }) {
|
||||
return json({ ok: false, reason: 'Path traversal rejected' }, { status: 400, headers });
|
||||
|
||||
try {
|
||||
return json({ ok: true, ...(await collectServerChat(server)) }, { headers });
|
||||
return json({ ok: true, ...(await readServerChat(server)) }, { headers });
|
||||
} catch (error) {
|
||||
console.error('Could not read server chat', error);
|
||||
return json({ ok: false, reason: 'Could not read server chat' }, { status: 500, headers });
|
||||
|
||||
Reference in New Issue
Block a user