diff --git a/backend-api/__tests__/agents.test.js b/backend-api/__tests__/agents.test.js index f300536..930a5cc 100644 --- a/backend-api/__tests__/agents.test.js +++ b/backend-api/__tests__/agents.test.js @@ -208,7 +208,6 @@ describe("GET /agents/:id/gateway-url", () => { expect(res.body).toEqual({ url: "http://gateway.external:19123", port: 19123, - token: "gateway-token", }); delete process.env.GATEWAY_HOST; diff --git a/backend-api/routes/agents.js b/backend-api/routes/agents.js index fee0f93..c128752 100644 --- a/backend-api/routes/agents.js +++ b/backend-api/routes/agents.js @@ -115,7 +115,6 @@ router.get("/:id/gateway-url", asyncHandler(async (req, res) => { res.json({ url: `http://${gatewayHost}:${hostPort}`, port: parseInt(hostPort), - token: agent.gateway_token, }); })); diff --git a/frontend-dashboard/components/agents/openclaw/OpenClawUIPanel.js b/frontend-dashboard/components/agents/openclaw/OpenClawUIPanel.js index 8ea2760..2806455 100644 --- a/frontend-dashboard/components/agents/openclaw/OpenClawUIPanel.js +++ b/frontend-dashboard/components/agents/openclaw/OpenClawUIPanel.js @@ -1,5 +1,5 @@ import { useState, useEffect, useRef } from "react"; -import { Loader2, AlertTriangle, RefreshCw, Maximize2, Copy, Check } from "lucide-react"; +import { Loader2, AlertTriangle, RefreshCw, Maximize2 } from "lucide-react"; import { fetchWithAuth } from "../../../lib/api"; export default function OpenClawUIPanel({ agentId }) { @@ -7,17 +7,8 @@ export default function OpenClawUIPanel({ agentId }) { const [error, setError] = useState(null); const [gatewayInfo, setGatewayInfo] = useState(null); const [iframeLoaded, setIframeLoaded] = useState(false); - const [copied, setCopied] = useState(false); const iframeRef = useRef(null); - function copyPassword() { - if (!gatewayInfo?.token) return; - navigator.clipboard.writeText(gatewayInfo.token).then(() => { - setCopied(true); - setTimeout(() => setCopied(false), 2000); - }); - } - function fetchInfo() { setLoading(true); setError(null); @@ -38,10 +29,10 @@ export default function OpenClawUIPanel({ agentId }) { return `/api/agents/${agentId}/gateway/embed?token=${encodeURIComponent(jwt)}`; } - // Direct host port URL for opening in a new window (no iframe restrictions) + // Open the same-origin embedded gateway UI in a new window without exposing the gateway password. function openInNewWindow() { - if (!gatewayInfo) return; - const url = `${gatewayInfo.url}#password=${encodeURIComponent(gatewayInfo.token)}`; + const url = getEmbedUrl(); + if (!url) return; // Use _blank and noopener to avoid popup blocker issues const w = window.open(url, "_blank", "noopener"); // Fallback: if popup was blocked, navigate via a temporary anchor @@ -88,14 +79,6 @@ export default function OpenClawUIPanel({ agentId }) {