mirror of
https://github.com/multipleof4/KalBot.git
synced 2026-03-16 21:41:02 +00:00
Feat: Add strategy enable/disable + pause API
This commit is contained in:
17
app/api/live-toggle/route.js
Normal file
17
app/api/live-toggle/route.js
Normal file
@@ -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 });
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user