big optimizations

This commit is contained in:
KingKDot
2026-03-22 23:21:27 -05:00
parent f69ca74346
commit 5c9c8dd543
18 changed files with 602 additions and 114 deletions
+6 -7
View File
@@ -51,24 +51,24 @@ export function handleCommand(target: ClientInfo, action: string, req: Request)
return Response.json({ ok: true });
}
if (action === "desktop_start") {
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_start", id: uuidv4() }));
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_start" as any, id: uuidv4() }));
return Response.json({ ok: true });
}
if (action === "desktop_stop") {
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_stop", id: uuidv4() }));
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_stop" as any, id: uuidv4() }));
return Response.json({ ok: true });
}
if (action === "desktop_select_display") {
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_select_display", id: uuidv4(), payload: { display: 0 } }));
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_select_display" as any, id: uuidv4(), payload: { display: 0 } }));
return Response.json({ ok: true });
}
if (action === "desktop_enable_mouse") {
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_enable_mouse", id: uuidv4(), payload: { enabled: true } }));
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_enable_mouse" as any, id: uuidv4(), payload: { enabled: true } }));
return Response.json({ ok: true });
}
if (action === "desktop_enable_keyboard") {
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_enable_keyboard", id: uuidv4(), payload: { enabled: true } }));
target.ws.send(encodeMessage({ type: "command", commandType: "desktop_enable_keyboard" as any, id: uuidv4(), payload: { enabled: true } }));
return Response.json({ ok: true });
}
if (action === "disconnect") {
@@ -111,12 +111,11 @@ export function handleCommand(target: ClientInfo, action: string, req: Request)
}
return new Response("Bad request", { status: 400 });
}
}
export function markOffline(id: string) {
setOnlineState(id, false);
}
export function markOnline(info: ClientInfo) {
upsertClientRow({ id: info.id, role: info.role, lastSeen: info.lastSeen, online: 1 });
upsertClientRow({ id: info.id, role: info.role, lastSeen: info.lastSeen, online: 1 as any });
}