From 1d99902ca3dc5906728e860d682045e1f1ead31f Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Mon, 16 Mar 2026 11:30:54 -0700 Subject: [PATCH] Feat: Add strategy enable/disable + pause API --- app/api/live-toggle/route.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/api/live-toggle/route.js 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 }); + } +}