noVNC - 自動調整版(穩定無錯誤)
- ws://localhost:8081(已轉發到你的 10.75.171.0:25900)
+ ${this.vncUrl}(已轉發到你的 10.75.171.0:25900)
@@ -152,7 +156,7 @@ export class ClawComputerPanel extends LitElement {
}
private connect = async () => {
- const url = "ws://localhost:8081";
+ const url = this.vncUrl || "ws://localhost:8081";
if (this.rfb) {
this.rfb.disconnect();
}
@@ -243,6 +247,14 @@ export class ClawComputerPanel extends LitElement {
firstUpdated() {
window.addEventListener("resize", this.handleResize);
+
+ // Auto-connect if URL is configured
+ if (this.vncUrl) {
+ // Use setTimeout to ensure DOM is fully ready and to allow UI to render first
+ setTimeout(() => {
+ void this.connect();
+ }, 100);
+ }
}
disconnectedCallback() {
diff --git a/ui/src/ui/storage.ts b/ui/src/ui/storage.ts
index 4a46b8d0703..8da8fe27c60 100644
--- a/ui/src/ui/storage.ts
+++ b/ui/src/ui/storage.ts
@@ -22,6 +22,9 @@ export type UiSettings = {
navWidth: number; // Sidebar width when expanded (240–400px)
navGroupsCollapsed: Record; // Which nav groups are collapsed
locale?: string;
+ vncWsUrl?: string;
+ vncPassword?: string;
+ vncTarget?: string;
};
function isViteDevPage(): boolean {
@@ -135,6 +138,8 @@ export function loadSettings(): UiSettings {
navCollapsed: false,
navWidth: 220,
navGroupsCollapsed: {},
+ vncWsUrl: "ws://localhost:8081",
+ vncTarget: "10.75.171.25900",
};
try {
@@ -190,6 +195,9 @@ export function loadSettings(): UiSettings {
? parsed.navGroupsCollapsed
: defaults.navGroupsCollapsed,
locale: isSupportedLocale(parsed.locale) ? parsed.locale : undefined,
+ vncWsUrl: typeof parsed.vncWsUrl === "string" ? parsed.vncWsUrl : defaults.vncWsUrl,
+ vncPassword: typeof parsed.vncPassword === "string" ? parsed.vncPassword : undefined,
+ vncTarget: typeof parsed.vncTarget === "string" ? parsed.vncTarget : defaults.vncTarget,
};
if ("token" in parsed) {
persistSettings(settings);
@@ -219,6 +227,9 @@ function persistSettings(next: UiSettings) {
navWidth: next.navWidth,
navGroupsCollapsed: next.navGroupsCollapsed,
...(next.locale ? { locale: next.locale } : {}),
+ vncWsUrl: next.vncWsUrl,
+ vncPassword: next.vncPassword,
+ vncTarget: next.vncTarget,
};
localStorage.setItem(KEY, JSON.stringify(persisted));
}
diff --git a/ui/src/ui/views/overview.ts b/ui/src/ui/views/overview.ts
index ed8ef6fb740..8bbca92f099 100644
--- a/ui/src/ui/views/overview.ts
+++ b/ui/src/ui/views/overview.ts
@@ -299,24 +299,13 @@ export function renderOverview(props: OverviewProps) {
-
-
-
- ${
- isTrustedProxy ? t("overview.access.trustedProxy") : t("overview.access.connectHint")
- }
-
${
!props.connected
? html`
-
-
${t("overview.connection.title")}
-
- - ${t("overview.connection.step1")}
openclaw gateway run
- - ${t("overview.connection.step2")}
openclaw dashboard --no-open
- - ${t("overview.connection.step3")}
- - ${t("overview.connection.step4")}
openclaw doctor --generate-gateway-token
-
+
+