feat: default users to safe virtual CAN execution

This commit is contained in:
vee
2026-08-14 09:56:22 +08:00
parent 0ec43052f3
commit 1a96d39426
4 changed files with 23 additions and 24 deletions
+12 -18
View File
@@ -346,7 +346,7 @@
configStack.append(gestureModelField);
const userHardwareState = make("div", "v2-user-target-status", `
<i></i><span id="v2UserTargetText">正在检查真实台架</span>`);
<i></i><span id="v2UserTargetText">正在准备虚拟 CAN</span>`);
configStack.append(userHardwareState);
if (providerField) {
@@ -946,7 +946,7 @@
setModule("self-orchestration");
}
setPage(0);
requestUserHardwareMode();
requestUserSafeExecutionMode();
} else {
const note = $("#v2ExecutionNote");
if (note) note.textContent = "管理员可切换虚拟 CAN、模拟台架与真实台架";
@@ -976,25 +976,19 @@
window.setTimeout(() => window.dispatchEvent(new Event("resize")), 180);
}
function requestUserHardwareMode() {
const hardwareButton = $("#hardwareMode");
function requestUserSafeExecutionMode() {
const dryRunButton = $('[data-execution-mode="dry_run"]');
const note = $("#v2ExecutionNote");
const userTarget = $(".v2-user-target-status");
const userTargetText = $("#v2UserTargetText");
const runButton = $("#runButton");
if (!hardwareButton) return;
if (!hardwareButton.disabled) {
if (!hardwareButton.classList.contains("active")) hardwareButton.click();
if (note) note.textContent = "user 演示固定使用真实台架";
if (userTarget) userTarget.dataset.state = "ready";
if (userTargetText) userTargetText.textContent = "执行目标:真实台架";
if (runButton && !runButton.classList.contains("loading")) runButton.disabled = false;
} else if (note) {
note.textContent = "真实台架尚未就绪,服务端安全门禁保持锁定";
if (userTarget) userTarget.dataset.state = "locked";
if (userTargetText) userTargetText.textContent = "真实台架尚未就绪";
if (runButton) runButton.disabled = true;
}
if (!dryRunButton) return;
if (!dryRunButton.classList.contains("active")) dryRunButton.click();
if (note) note.textContent = "测试用户使用虚拟 CAN;真实台架仅由管理员显式启用";
if (userTarget) userTarget.dataset.state = "ready";
if (userTargetText) userTargetText.textContent = "执行目标:虚拟 CAN";
if (runButton && !runButton.classList.contains("loading")) runButton.disabled = false;
syncExecutionSelector();
}
function syncExecutionSelector() {
@@ -1033,7 +1027,7 @@
$(".v2-sidebar-footer")?.classList.toggle("offline", !online);
}
syncExecutionSelector();
if (ui.role === "user") requestUserHardwareMode();
if (ui.role === "user") requestUserSafeExecutionMode();
}
function setVehicleLinkState(connected) {
+1 -1
View File
@@ -22,7 +22,7 @@
<script src="/app.js?v=dual-seat-80" defer></script>
<script type="module" src="/gesture-control.js?v=android-pad-7"></script>
<script src="/pwa.js?v=android-pad-1" defer></script>
<script src="/console-v2.js?v=desktop-refactor-34" defer></script>
<script src="/console-v2.js?v=desktop-refactor-35" defer></script>
<script src="/self-extension.js?v=extension-20" defer></script>
<script src="/self-calibration.js?v=calibration-6" defer></script>
<script src="/self-repair.js?v=repair-20" defer></script>
+2 -2
View File
@@ -1,4 +1,4 @@
const CACHE_VERSION = "cognitive-agent-pad-v115";
const CACHE_VERSION = "cognitive-agent-pad-v116";
const SHELL_CACHE = `${CACHE_VERSION}-shell`;
const RUNTIME_CACHE = `${CACHE_VERSION}-runtime`;
const APP_SHELL = [
@@ -10,7 +10,7 @@ const APP_SHELL = [
"/gesture-control.js?v=android-pad-7",
"/pwa.js?v=android-pad-1",
"/console-v2.css?v=desktop-refactor-106",
"/console-v2.js?v=desktop-refactor-34",
"/console-v2.js?v=desktop-refactor-35",
"/self-extension.css?v=extension-18",
"/self-extension.js?v=extension-20",
"/self-calibration.css?v=calibration-10",