Fix OpenClaw: auto-include gateway token in dashboard link
Deploy Dashboard / deploy (push) Successful in 48s

This commit is contained in:
Gan, Jimmy
2026-02-22 18:30:34 +08:00
parent edcaea61f0
commit c081e87a5e
3 changed files with 26 additions and 2 deletions
+17 -1
View File
@@ -1,7 +1,23 @@
<script>
import { onMount } from "svelte";
import { get } from "../lib/api.js";
let isTailscale = location.hostname.startsWith("100.");
let isLocal = location.hostname === "localhost" || location.hostname === "127.0.0.1" || location.hostname.startsWith("192.168.");
let canAccess = isTailscale || isLocal;
let token = $state("");
onMount(async () => {
if (canAccess) {
const res = await get("/system/openclaw-token");
token = res?.token || "";
}
});
function clawUrl() {
const base = `${location.protocol}//${location.hostname}:3100`;
return token ? `${base}/#token=${token}` : base;
}
</script>
<div class="space-y-4">
@@ -22,7 +38,7 @@
OpenClaw's security settings prevent it from being embedded inside the dashboard. Click below to launch the assistant securely in a new tab.
</p>
<a
href="{location.protocol}//{location.hostname}:3100"
href={clawUrl()}
target="_blank"
rel="noopener noreferrer"
class="inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-lg text-white bg-primary-600 hover:bg-primary-700 shadow-sm transition-colors"