mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 04:52:43 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import os from "node:os";
|
||||
|
||||
import { logDebug, logWarn } from "../logger.js";
|
||||
import { getLogger } from "../logging.js";
|
||||
import { ignoreCiaoCancellationRejection } from "./bonjour-ciao.js";
|
||||
@@ -28,7 +26,7 @@ export type GatewayBonjourAdvertiseOpts = {
|
||||
};
|
||||
|
||||
function isDisabledByEnv() {
|
||||
if (isTruthyEnvValue(process.env.CLAWDBOT_DISABLE_BONJOUR)) return true;
|
||||
if (isTruthyEnvValue(process.env.OPENCLAW_DISABLE_BONJOUR)) return true;
|
||||
if (process.env.NODE_ENV === "test") return true;
|
||||
if (process.env.VITEST) return true;
|
||||
return false;
|
||||
@@ -36,12 +34,12 @@ function isDisabledByEnv() {
|
||||
|
||||
function safeServiceName(name: string) {
|
||||
const trimmed = name.trim();
|
||||
return trimmed.length > 0 ? trimmed : "Moltbot";
|
||||
return trimmed.length > 0 ? trimmed : "OpenClaw";
|
||||
}
|
||||
|
||||
function prettifyInstanceName(name: string) {
|
||||
const normalized = name.trim().replace(/\s+/g, " ");
|
||||
return normalized.replace(/\s+\(Moltbot\)\s*$/i, "").trim() || normalized;
|
||||
return normalized.replace(/\s+\(OpenClaw\)\s*$/i, "").trim() || normalized;
|
||||
}
|
||||
|
||||
type BonjourService = {
|
||||
@@ -90,16 +88,19 @@ export async function startGatewayBonjourAdvertiser(
|
||||
// mDNS service instance names are single DNS labels; dots in hostnames (like
|
||||
// `Mac.localdomain`) can confuse some resolvers/browsers and break discovery.
|
||||
// Keep only the first label and normalize away a trailing `.local`.
|
||||
const hostnameRaw =
|
||||
process.env.OPENCLAW_MDNS_HOSTNAME?.trim() ||
|
||||
process.env.CLAWDBOT_MDNS_HOSTNAME?.trim() ||
|
||||
"openclaw";
|
||||
const hostname =
|
||||
os
|
||||
.hostname()
|
||||
hostnameRaw
|
||||
.replace(/\.local$/i, "")
|
||||
.split(".")[0]
|
||||
.trim() || "moltbot";
|
||||
.trim() || "openclaw";
|
||||
const instanceName =
|
||||
typeof opts.instanceName === "string" && opts.instanceName.trim()
|
||||
? opts.instanceName.trim()
|
||||
: `${hostname} (Moltbot)`;
|
||||
: `${hostname} (OpenClaw)`;
|
||||
const displayName = prettifyInstanceName(instanceName);
|
||||
|
||||
const txtBase: Record<string, string> = {
|
||||
@@ -140,7 +141,7 @@ export async function startGatewayBonjourAdvertiser(
|
||||
|
||||
const gateway = responder.createService({
|
||||
name: safeServiceName(instanceName),
|
||||
type: "moltbot-gw",
|
||||
type: "openclaw-gw",
|
||||
protocol: Protocol.TCP,
|
||||
port: opts.gatewayPort,
|
||||
domain: "local",
|
||||
|
||||
Reference in New Issue
Block a user