big optimizations
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user