fix: dynamically resolve active hostname in guide and connect views

This commit is contained in:
Hitonabi
2026-06-25 23:08:54 +02:00
parent e9fb72fdc7
commit b6af1c1b4a
4 changed files with 31 additions and 18 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -6,7 +6,7 @@
<meta name="theme-color" content="#0d1117" />
<link rel="manifest" href="/manifest.webmanifest" />
<title>Mission Control 2.0</title>
<script type="module" crossorigin src="/assets/index-CgKqjgpB.js"></script>
<script type="module" crossorigin src="/assets/index-BtTFipce.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CAfaSDN8.css">
</head>
<body>
+7 -1
View File
@@ -4,7 +4,13 @@ import { api, type ConnectResp } from "@/lib/api"
import { cn } from "@/lib/utils"
export function ConnectView() {
const [host, setHost] = useState(localStorage.getItem("mc_host") || "192.168.178.151")
const [host, setHost] = useState(() => {
const saved = localStorage.getItem("mc_host")
if (saved) return saved
const hn = window.location.hostname
if (hn && hn !== "localhost" && hn !== "127.0.0.1") return hn
return "192.168.178.151"
})
const [mcpPath, setMcpPath] = useState(localStorage.getItem("mc_mcp_path") || "")
const [data, setData] = useState<ConnectResp | null>(null)
const [active, setActive] = useState("cline")
+10 -3
View File
@@ -6,6 +6,13 @@ import { cn } from "@/lib/utils"
export function GuideView() {
const [activeTab, setActiveTab] = useState<"roocode" | "cursor" | "opencode">("roocode")
const [health, setHealth] = useState<Health | null>(null)
const currentHost = (() => {
const hn = window.location.hostname
if (hn && hn !== "localhost" && hn !== "127.0.0.1") return hn
return "192.168.178.151"
})()
const [testing, setTesting] = useState(false)
const [testResult, setTestResult] = useState<string | null>(null)
@@ -185,7 +192,7 @@ export function GuideView() {
<div className="pl-6 pt-1">
<div className="p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground">
<div><span className="text-muted-foreground/60">API Provider:</span> OpenAI Compatible</div>
<div><span className="text-muted-foreground/60">Base URL:</span> http://192.168.178.151:9001/v1</div>
<div><span className="text-muted-foreground/60">Base URL:</span> http://{currentHost}:9001/v1</div>
<div><span className="text-muted-foreground/60">API Key:</span> <span className="italic text-muted-foreground/50">beliebig (z.B. "local")</span></div>
<div><span className="text-muted-foreground/60">Model ID:</span> auto</div>
</div>
@@ -227,7 +234,7 @@ export function GuideView() {
<p className="pl-6">Deaktiviere die Standard-Cloudmodelle, klappe den Bereich <strong>OpenAI API</strong> auf und konfiguriere:</p>
<div className="pl-6 pt-1">
<div className="p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground">
<div><span className="text-muted-foreground/60">Override Base URL:</span> http://192.168.178.151:9001/v1</div>
<div><span className="text-muted-foreground/60">Override Base URL:</span> http://{currentHost}:9001/v1</div>
<div><span className="text-muted-foreground/60">API Key:</span> <span className="italic text-muted-foreground/50">beliebig (z.B. "local")</span></div>
</div>
</div>
@@ -268,7 +275,7 @@ export function GuideView() {
<p className="pl-6">Gehe in den Bereich Einstellungen Provider, deaktiviere die Cloud-Voreinstellungen und trage deinen lokalen Server ein:</p>
<div className="pl-6 pt-1">
<div className="p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1 text-foreground">
<div><span className="text-muted-foreground/60">Base URL:</span> http://192.168.178.151:9001/v1</div>
<div><span className="text-muted-foreground/60">Base URL:</span> http://{currentHost}:9001/v1</div>
<div><span className="text-muted-foreground/60">Model:</span> auto</div>
</div>
</div>