diff --git a/app/api/live-toggle/route.js b/app/api/live-toggle/route.js new file mode 100644 index 0000000..3ccd748 --- /dev/null +++ b/app/api/live-toggle/route.js @@ -0,0 +1,17 @@ +import { NextResponse } from 'next/server'; +import fs from 'fs'; + +export async function POST(req) { + try { + const body = await req.json(); + const { action, strategy } = body; + + // Write command file that worker polls + const cmd = JSON.stringify({ action, strategy, ts: Date.now() }); + fs.writeFileSync('/tmp/kalbot-live-cmd', cmd); + + return NextResponse.json({ success: true, message: `Command "${action}" sent.` }); + } catch (e) { + return NextResponse.json({ error: e.message }, { status: 500 }); + } +}