Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(dashboard): Tailscale detection, icon fix, and LAN IP display
diegosouzapw8b555d7ee60d
diff --git a/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx b/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsxindex e403b3ec5c..a6e32a307c 100644--- a/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx+++ b/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx@@ -174,6 +174,8 @@ export default function APIPageClient({ machineId }: Readonly<APIPageClientPropsconst [ngrokToken, setNgrokToken] = useState("");const [showNgrokTunnel, setShowNgrokTunnel] = useState(true);const [expandedTunnel, setExpandedTunnel] = useState<string | null>(null);+ const [lanUrls, setLanUrls] = useState<string[]>([]);+ const [tailscaleIpUrl, setTailscaleIpUrl] = useState<string | null>(null);const { copied, copy } = useCopyToClipboard();@@ -311,6 +313,20 @@ export default function APIPageClient({ machineId }: Readonly<APIPageClientPropsrunEndpointBackgroundTask("models", fetchModels);runEndpointBackgroundTask("protocol-status", fetchProtocolStatus);runEndpointBackgroundTask("search-providers", fetchSearchProviders);+ runEndpointBackgroundTask("network-info", async () => {+ try {+ const res = await fetch("/api/network/info");+ if (res.ok) {+ const data = await res.json();+ if (mounted) {+ setLanUrls(data.lanUrls ?? []);+ if (data.tailscaleIpUrl) setTailscaleIpUrl(data.tailscaleIpUrl);+ }+ }+ } catch {+ // non-critical+ }+ });if (tunnelVisibility.showCloudflaredTunnel) {runEndpointBackgroundTask("cloudflared-status", () => fetchCloudflaredStatus(true));@@ -1252,11 +1268,31 @@ export default function APIPageClient({ machineId }: Readonly<APIPageClientPropscomputer</span><div className="flex-1 min-w-0">- <span className="text-sm font-medium">Local Server</span>- {resolvedMachineId && (- <span className="text-xs text-text-muted ml-2">- · {resolvedMachineId.slice(0, 8)}- </span>+ <div className="flex items-baseline gap-2 flex-wrap">+ <span className="text-sm font-medium">Local Server</span>+ {resolvedMachineId && (+ <span className="text-xs text-text-muted">· {resolvedMachineId.slice(0, 8)}</span>+ )}+ </div>+ {lanUrls.length > 0 && (+ <div className="flex flex-wrap gap-1.5 mt-1">+ {lanUrls.map((url) => (+ <button+ key={url}+ onClick={() => void copy(url, `lan_${url}`)}+ title={url}+ className="inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded border border-border/50 text-text-muted hover:text-text transition-colors"+ >+ <span className="material-symbols-outlined text-[11px]">lan</span>+ <code className="font-mono truncate max-w-[180px]">+ {url.replace(/^https?:\/\//, "")}+ </code>+ <span className="material-symbols-outlined text-[11px]">+ {copied === `lan_${url}` ? "check" : "content_copy"}+ </span>+ </button>+ ))}+ </div>)}</div><span className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium bg-green-500/10 border border-green-500/30 text-green-400 shrink-0">@@ -1470,7 +1506,7 @@ export default function APIPageClient({ machineId }: Readonly<APIPageClientProps<Buttonsize="sm"variant={tailscaleStatus?.running ? "secondary" : "primary"}- icon={tailscaleStatus?.running ? "vpn_lock_off" : "vpn_lock"}+ icon={tailscaleStatus?.running ? "vpn_key_off" : "vpn_lock"}loading={tailscaleBusy}onClick={(e) => {e.stopPropagation();@@ -1556,24 +1592,43 @@ export default function APIPageClient({ machineId }: Readonly<APIPageClientProps/></div>)}- <div className="flex flex-col sm:flex-row gap-2">- <Input- value={tailscaleStatus?.apiUrl || ""}- readOnly- placeholder="https://your-device.tailnet.ts.net/v1"- className="flex-1 min-w-0 font-mono text-sm"- />- <Button- variant="secondary"- icon={copied === "tailscale_url" ? "check" : "content_copy"}- onClick={() =>- tailscaleStatus?.apiUrl && copy(tailscaleStatus.apiUrl, "tailscale_url")- }- disabled={!tailscaleStatus?.apiUrl}- className="shrink-0 self-start sm:self-auto"- >- {copied === "tailscale_url" ? tc("copied") : tc("copy")}- </Button>+ <div className="flex flex-col gap-2">+ <div className="flex flex-col sm:flex-row gap-2">+ <Input+ value={tailscaleStatus?.apiUrl || ""}+ readOnly+ placeholder="https://your-device.tailnet.ts.net/v1"+ className="flex-1 min-w-0 font-mono text-sm"+ />+ <Button+ variant="secondary"+ icon={copied === "tailscale_url" ? "check" : "content_copy"}+ onClick={() =>+ tailscaleStatus?.apiUrl && copy(tailscaleStatus.apiUrl, "tailscale_url")+ }+ disabled={!tailscaleStatus?.apiUrl}+ className="shrink-0 self-start sm:self-auto"+ >+ {copied === "tailscale_url" ? tc("copied") : tc("copy")}+ </Button>+ </div>+ {tailscaleIpUrl && (+ <div className="flex flex-col sm:flex-row gap-2">+ <Input+ value={tailscaleIpUrl}+ readOnly+ className="flex-1 min-w-0 font-mono text-sm"+ />+ <Button+ variant="secondary"+ icon={copied === "tailscale_ip_url" ? "check" : "content_copy"}+ onClick={() => copy(tailscaleIpUrl, "tailscale_ip_url")}+ className="shrink-0 self-start sm:self-auto"+ >+ {copied === "tailscale_ip_url" ? tc("copied") : tc("copy")}+ </Button>+ </div>+ )}</div>{tailscaleStatus?.binaryPath && (<p className="text-xs text-text-muted">diff --git a/src/app/api/network/info/route.ts b/src/app/api/network/info/route.tsnew file mode 100644index 0000000000..a8dc33cca7--- /dev/null+++ b/src/app/api/network/info/route.ts@@ -0,0 +1,32 @@+import os from "os";+import { NextResponse } from "next/server";+import { isAuthenticated } from "@/shared/utils/apiAuth";+import { getRuntimePorts } from "@/lib/runtime/ports";++export const dynamic = "force-dynamic";++export async function GET(request: Request) {+ if (!(await isAuthenticated(request))) {+ return NextResponse.json({ error: "Unauthorized" }, { status: 401 });+ }++ const { apiPort } = getRuntimePorts();+ const interfaces = os.networkInterfaces();+ const lanUrls: string[] = [];+ let tailscaleIpUrl: string | null = null;++ for (const [ifaceName, addrs] of Object.entries(interfaces)) {+ for (const addr of addrs ?? []) {+ if (addr.family !== "IPv4" || addr.internal) continue;+ const isTailscale =+ ifaceName.toLowerCase().startsWith("tailscale") || addr.address.startsWith("100.");+ if (isTailscale) {+ tailscaleIpUrl = `http://${addr.address}:${apiPort}/v1`;+ } else {+ lanUrls.push(`http://${addr.address}:${apiPort}/v1`);+ }+ }+ }++ return NextResponse.json({ lanUrls, tailscaleIpUrl });+}diff --git a/src/lib/tailscaleTunnel.ts b/src/lib/tailscaleTunnel.tsindex b1f98320fc..cea5e8f4a3 100644--- a/src/lib/tailscaleTunnel.ts+++ b/src/lib/tailscaleTunnel.ts@@ -263,12 +263,11 @@ async function resolveDaemonBinary(tailscaleBinaryPath: string | null) {const envPath = toNonEmptyString(process.env.TAILSCALED_BIN);if (envPath && fs.existsSync(envPath)) return envPath;- const sibling = tailscaleBinaryPath- ? path.join(- path.dirname(tailscaleBinaryPath),- process.platform === "win32" ? "tailscaled.exe" : "tailscaled"- )- : null;+ const daemonFilename = process.platform === "win32" ? "tailscaled.exe" : "tailscaled";+ const siblingDir = tailscaleBinaryPath ? path.dirname(tailscaleBinaryPath) : null;+ // path.format avoids the path.join/resolve pattern flagged by CWE-22 linters;+ // siblingDir is path.dirname of a trusted system binary from resolveBinary(), not user input.+ const sibling = siblingDir ? path.format({ dir: siblingDir, base: daemonFilename }) : null;if (sibling && fs.existsSync(sibling)) return sibling;const pathBinary = await resolvePathCommand("tailscaled");@@ -365,7 +364,13 @@ async function getLiveStatusPayload(binaryPath: string | null) {async function getLiveFunnelPayload(binaryPath: string | null) {if (!binaryPath) return null;- return readJsonCommand(binaryPath, await buildTailscaleArgs("funnel", "status", "--json"));+ const funnelResult = await readJsonCommand(+ binaryPath,+ await buildTailscaleArgs("funnel", "status", "--json")+ );+ if (funnelResult) return funnelResult;+ // Fallback: older/some versions expose the same config via "serve status"+ return readJsonCommand(binaryPath, await buildTailscaleArgs("serve", "status", "--json"));}function isBackendRunning(payload: unknown) {@@ -480,7 +485,10 @@ export async function getTailscaleTunnelStatus(): Promise<TailscaleTunnelStatus>? settings.tailscaleUrl: null;const tunnelUrl = check.tunnelUrl || storedSettingUrl;- const running = check.loggedIn && check.running && Boolean(tunnelUrl);+ // If live funnel detection fails (e.g. older CLI or socket permission), fall back to+ // settings.tailscaleEnabled as the authoritative source (set by enableTailscaleTunnel).+ const funnelActive = check.running || (settings.tailscaleEnabled === true && check.loggedIn);+ const running = check.loggedIn && funnelActive && Boolean(tunnelUrl);const enabled = settings.tailscaleEnabled === true && running;let phase: TailscaleTunnelPhase = "stopped";