


























@@ -75,10 +75,13 @@ describe("control UI routing", () => {
7575expect(window.location.pathname).toBe("/openclaw/sessions");
7676});
777778-it("updates the URL when clicking nav items", async () => {
78+it("keeps chat navigation links visible and updates the URL when clicked", async () => {
7979const app = mountApp("/chat");
8080await app.updateComplete;
818182+const dreamsLink = app.querySelector<HTMLAnchorElement>('a.nav-item[href="/dreaming"]');
83+expect(dreamsLink).not.toBeNull();
84+8285const link = app.querySelector<HTMLAnchorElement>('a.nav-item[href="/channels"]');
8386expect(link).not.toBeNull();
8487link?.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true, button: 0 }));
@@ -88,14 +91,6 @@ describe("control UI routing", () => {
8891expect(window.location.pathname).toBe("/channels");
8992});
909391-it("keeps dreams navigation visible even when dreaming is disabled", async () => {
92-const app = mountApp("/chat");
93-await app.updateComplete;
94-95-const dreamsLink = app.querySelector<HTMLAnchorElement>('a.nav-item[href="/dreaming"]');
96-expect(dreamsLink).not.toBeNull();
97-});
98-9994it("renders the dreaming view on the /dreaming route", async () => {
10095const app = mountApp("/dreaming");
10196app.dreamingStatus = {
@@ -410,27 +405,19 @@ describe("control UI routing", () => {
410405expect(container.scrollTop).toBe(targetScrollTop);
411406});
412407413-it("hydrates token from query params and strips them", async () => {
414-const app = mountApp("/ui/overview?token=abc123");
408+it("hydrates safe query params and strips unsafe credentials from the URL", async () => {
409+const app = mountApp("/ui/overview?token=abc123&password=sekret");
415410await app.updateComplete;
416411417412expect(app.settings.token).toBe("abc123");
413+expect(app.password).toBe("");
418414expect(JSON.parse(localStorage.getItem("openclaw.control.settings.v1") ?? "{}").token).toBe(
419415undefined,
420416);
421417expect(window.location.pathname).toBe("/ui/overview");
422418expect(window.location.search).toBe("");
423419});
424420425-it("strips password URL params without importing them", async () => {
426-const app = mountApp("/ui/overview?password=sekret");
427-await app.updateComplete;
428-429-expect(app.password).toBe("");
430-expect(window.location.pathname).toBe("/ui/overview");
431-expect(window.location.search).toBe("");
432-});
433-434421it("hydrates token from URL hash when settings already set", async () => {
435422localStorage.setItem(
436423"openclaw.control.settings.v1",
@@ -450,7 +437,7 @@ describe("control UI routing", () => {
450437expect(window.location.hash).toBe("");
451438});
452439453-it("hydrates token from URL hash and strips it", async () => {
440+it("hydrates token from URL hash, strips it, and clears it after gateway changes", async () => {
454441const app = mountApp("/ui/overview#token=abc123");
455442await app.updateComplete;
456443@@ -460,11 +447,6 @@ describe("control UI routing", () => {
460447);
461448expect(window.location.pathname).toBe("/ui/overview");
462449expect(window.location.hash).toBe("");
463-});
464-465-it("clears the current token when the gateway URL changes", async () => {
466-const app = mountApp("/ui/overview#token=abc123");
467-await app.updateComplete;
468450469451const gatewayUrlInput = app.querySelector<HTMLInputElement>(
470452'input[placeholder="ws://100.x.y.z:18789"]',
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。