Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion backend-api/__tests__/agents.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion backend-api/routes/agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}));

Expand Down
27 changes: 5 additions & 22 deletions frontend-dashboard/components/agents/openclaw/OpenClawUIPanel.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
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 }) {
const [loading, setLoading] = useState(true);
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);
Expand All @@ -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
Expand Down Expand Up @@ -88,14 +79,6 @@ export default function OpenClawUIPanel({ agentId }) {
</span>
</div>
<div className="flex items-center gap-2">
<button
onClick={copyPassword}
className="px-2.5 py-1.5 text-slate-400 hover:text-white transition-colors rounded-lg hover:bg-slate-700 text-xs flex items-center gap-1.5"
title="Copy gateway password"
>
{copied ? <Check size={12} className="text-green-400" /> : <Copy size={12} />}
{copied ? "Copied" : "Password"}
</button>
<button
onClick={fetchInfo}
className="p-1.5 text-slate-400 hover:text-white transition-colors rounded-lg hover:bg-slate-700"
Expand All @@ -106,7 +89,7 @@ export default function OpenClawUIPanel({ agentId }) {
<button
onClick={openInNewWindow}
className="px-3 py-1.5 bg-blue-600 hover:bg-blue-500 text-white text-xs font-bold rounded-lg transition-colors flex items-center gap-1.5 shadow-lg shadow-blue-600/20"
title="Open in new window"
title="Open embedded gateway UI in a new window"
>
<Maximize2 size={12} />
New Window
Expand Down
Loading