Add T6 Zombies fleet support with Plutainer configuration
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { T5_ZOMBIE_MAPS } from '$lib/server/fleet/map-aliases.js';
|
||||
import { T5_ZOMBIE_MAPS, T6_ZOMBIE_MAPS } from '$lib/server/fleet/map-aliases.js';
|
||||
|
||||
export function GET() {
|
||||
return json({ t5Zombie: T5_ZOMBIE_MAPS });
|
||||
return json({ t5Zombie: T5_ZOMBIE_MAPS, t6Zombie: T6_ZOMBIE_MAPS });
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { classifyHealth } from '$lib/server/fleet/health.js';
|
||||
import { queueCreateServer } from '$lib/server/fleet/create.js';
|
||||
import { config, komodoConfigured, rconConfigured } from '$lib/server/config.js';
|
||||
import type { RconPlayer } from '$lib/server/integrations/rcon.js';
|
||||
import type { GameMode } from '$lib/server/fleet/map-aliases.js';
|
||||
import type { GameMode, ZombieGame } from '$lib/server/fleet/map-aliases.js';
|
||||
|
||||
function safeJson<T>(raw: string | null): T | null {
|
||||
if (!raw) return null;
|
||||
@@ -52,18 +52,20 @@ export async function GET() {
|
||||
|
||||
export async function POST({ request }: { request: Request }) {
|
||||
const body = (await request.json().catch(() => ({}))) as {
|
||||
game?: string;
|
||||
gameMode?: string;
|
||||
mapSlug?: string;
|
||||
plutoKey?: string;
|
||||
expectedName?: string;
|
||||
};
|
||||
if (!body || typeof body.gameMode !== 'string' || typeof body.mapSlug !== 'string' || (body.plutoKey !== undefined && typeof body.plutoKey !== 'string') || (body.expectedName !== undefined && typeof body.expectedName !== 'string')) {
|
||||
if (!body || (body.game !== undefined && body.game !== 't5' && body.game !== 't6') || typeof body.gameMode !== 'string' || typeof body.mapSlug !== 'string' || (body.plutoKey !== undefined && typeof body.plutoKey !== 'string') || (body.expectedName !== undefined && typeof body.expectedName !== 'string')) {
|
||||
return json(
|
||||
{ ok: false, error: 'gameMode and mapSlug are required strings; plutoKey and expectedName are optional strings', kind: 'bad-request' },
|
||||
{ ok: false, error: 'game must be t5 or t6; gameMode and mapSlug are required strings; plutoKey and expectedName are optional strings', kind: 'bad-request' },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
const result = queueCreateServer({
|
||||
game: body.game as ZombieGame | undefined,
|
||||
gameMode: body.gameMode as GameMode,
|
||||
mapSlug: body.mapSlug,
|
||||
plutoKey: body.plutoKey,
|
||||
|
||||
Reference in New Issue
Block a user