mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 03:40:21 +00:00
refactor(models): share auth helpers and forward-compat list fallbacks
This commit is contained in:
@@ -43,6 +43,22 @@ export const formatMs = (value?: number | null) => {
|
||||
return `${Math.round(value / 100) / 10}s`;
|
||||
};
|
||||
|
||||
export const isLocalBaseUrl = (baseUrl: string) => {
|
||||
try {
|
||||
const url = new URL(baseUrl);
|
||||
const host = url.hostname.toLowerCase();
|
||||
return (
|
||||
host === "localhost" ||
|
||||
host === "127.0.0.1" ||
|
||||
host === "0.0.0.0" ||
|
||||
host === "::1" ||
|
||||
host.endsWith(".local")
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export async function updateConfig(
|
||||
mutator: (cfg: OpenClawConfig) => OpenClawConfig,
|
||||
): Promise<OpenClawConfig> {
|
||||
|
||||
Reference in New Issue
Block a user