Complete Classic telemetry, authenticated player replies and reversible cutover
Core tests / core (push) Successful in 27s
Core tests / core (push) Successful in 27s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { env } from 'cloudflare:workers';
|
||||
import { z } from 'zod';
|
||||
import { requireAleOperator,rawAleEnabled } from '@/core/ale-auth';
|
||||
import {runGM} from '@/core/gm';
|
||||
import { compileAleOperatorRequest } from '@/core/ale';
|
||||
import { queueAleCommand } from '@/core/ale-store';
|
||||
import type { RuntimeConfig } from '@/core/types';
|
||||
@@ -20,6 +21,11 @@ export async function POST(request:Request){
|
||||
requireAleOperator(request,config);
|
||||
const text=await request.text();if(text.length>16000)return Response.json({error:'Request too large'},{status:413});
|
||||
const body=schema.parse(JSON.parse(text));
|
||||
if(config.GAME_BACKEND==='cmangos-classic'){
|
||||
if(body.kind!=='command')throw new Error('Classic supports native GM commands here; Lua/ALE methods belong to the Wrath backend.');
|
||||
const result=await runGM(body.command,true,true,config);
|
||||
return Response.json({ok:true,result});
|
||||
}
|
||||
const source=compileAleOperatorRequest(body,rawAleEnabled(config));
|
||||
const queued=await queueAleCommand(env.DB!,source);
|
||||
return Response.json({ok:true,command:queued},{status:202});
|
||||
|
||||
Reference in New Issue
Block a user