fix: provider startup order and enable flags

This commit is contained in:
Peter Steinberger
2025-12-26 16:54:53 +00:00
parent 17d9ba256b
commit ed2e738ea4
8 changed files with 127 additions and 26 deletions

View File

@@ -13,25 +13,35 @@ export async function buildProviderSummary(
const effective = cfg ?? loadConfig();
const lines: string[] = [];
const webLinked = await webAuthExists();
const authAgeMs = getWebAuthAgeMs();
const authAge = authAgeMs === null ? "unknown" : formatAge(authAgeMs);
const { e164 } = readWebSelfId();
lines.push(
webLinked
? chalk.green(
`WhatsApp: linked${e164 ? ` as ${e164}` : ""} (auth ${authAge})`,
)
: chalk.red("WhatsApp: not linked"),
);
const webEnabled = effective.web?.enabled !== false;
if (!webEnabled) {
lines.push(chalk.cyan("WhatsApp: disabled"));
} else {
const webLinked = await webAuthExists();
const authAgeMs = getWebAuthAgeMs();
const authAge = authAgeMs === null ? "unknown" : formatAge(authAgeMs);
const { e164 } = readWebSelfId();
lines.push(
webLinked
? chalk.green(
`WhatsApp: linked${e164 ? ` as ${e164}` : ""} (auth ${authAge})`,
)
: chalk.red("WhatsApp: not linked"),
);
}
const telegramToken =
process.env.TELEGRAM_BOT_TOKEN ?? effective.telegram?.botToken;
lines.push(
telegramToken
? chalk.green("Telegram: configured")
: chalk.cyan("Telegram: not configured"),
);
const telegramEnabled = effective.telegram?.enabled !== false;
if (!telegramEnabled) {
lines.push(chalk.cyan("Telegram: disabled"));
} else {
const telegramToken =
process.env.TELEGRAM_BOT_TOKEN ?? effective.telegram?.botToken;
lines.push(
telegramToken
? chalk.green("Telegram: configured")
: chalk.cyan("Telegram: not configured"),
);
}
const allowFrom = effective.routing?.allowFrom?.length
? effective.routing.allowFrom.map(normalizeE164).filter(Boolean)