mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 04:18:05 +00:00
fix(bar): bind 'ccs bar launch' server to IPv4 loopback
startServer was called without a host, defaulting to 'localhost' which resolves to ::1 (IPv6) on macOS, while bar.json's baseUrl and the menu-bar app use 127.0.0.1 — so the app could not reach its own server (connection refused) and showed offline. Pass host 127.0.0.1 explicitly to match.
This commit is contained in:
@@ -72,7 +72,10 @@ async function defaultEnsureDashboard(): Promise<DashboardInfo> {
|
||||
const { startServer } = await import('../../web-server');
|
||||
|
||||
const port = await getPort({ port: [3000, 3001, 3002, 8000, 8080] });
|
||||
const { server } = await startServer({ port });
|
||||
// Bind IPv4 loopback explicitly. Without a host, startServer defaults to
|
||||
// 'localhost', which on macOS resolves to ::1 (IPv6) — but bar.json's baseUrl
|
||||
// (and the Swift app) use 127.0.0.1, so the app could not reach its own server.
|
||||
const { server } = await startServer({ port, host: '127.0.0.1' });
|
||||
|
||||
const addr = server.address();
|
||||
const resolvedPort = addr && typeof addr === 'object' ? addr.port : port;
|
||||
|
||||
Reference in New Issue
Block a user