15 lines
647 B
TypeScript
15 lines
647 B
TypeScript
import { json } from '@sveltejs/kit';
|
|
import { authenticateAgent } from '$lib/server/hosts/http.js';
|
|
import { updateHostLibraryCaches } from '$lib/server/game-files/index.js';
|
|
import { gameFileError, readGameJson } from '$lib/server/game-files/http.js';
|
|
export async function POST({ request, params }: { request: Request; params: { id: string } }) {
|
|
try {
|
|
const host = authenticateAgent(request);
|
|
const body = await readGameJson(request);
|
|
updateHostLibraryCaches(host.id, [{ ...body, libraryVersionId: params.id }]);
|
|
return json({ ok: true });
|
|
} catch (cause) {
|
|
return gameFileError(cause);
|
|
}
|
|
}
|