mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-03-12 01:17:48 +00:00
- Normalize all localhost variants to 'localhost' for consistent proxy configuration in Vite and server setup. - use one source of truth for network hosts functions by moving them to a shared - log production and development urls
23 lines
613 B
JavaScript
23 lines
613 B
JavaScript
export function isWildcardHost(host) {
|
|
return host === '0.0.0.0' || host === '::';
|
|
}
|
|
|
|
export function isLoopbackHost(host) {
|
|
return host === 'localhost' || host === '127.0.0.1' || host === '::1' || host === '[::1]';
|
|
}
|
|
|
|
export function normalizeLoopbackHost(host) {
|
|
if (!host) {
|
|
return host;
|
|
}
|
|
return isLoopbackHost(host) ? 'localhost' : host;
|
|
}
|
|
|
|
// Use localhost for connectable loopback and wildcard addresses in browser-facing URLs.
|
|
export function getConnectableHost(host) {
|
|
if (!host) {
|
|
return 'localhost';
|
|
}
|
|
return isWildcardHost(host) || isLoopbackHost(host) ? 'localhost' : host;
|
|
}
|