Status: color provider lines

main
Peter Steinberger 2025-12-09 16:31:38 +00:00
parent dc8f9e043d
commit 796f630a7c
2 changed files with 10 additions and 7 deletions

View File

@ -211,7 +211,7 @@ export async function statusCommand(
} }
runtime.log(info("System:")); runtime.log(info("System:"));
for (const line of summary.providerSummary) { for (const line of summary.providerSummary) {
runtime.log(info(` ${line}`)); runtime.log(` ${line}`);
} }
if (health) { if (health) {
const waLine = health.web.connect const waLine = health.web.connect

View File

@ -1,3 +1,4 @@
import chalk from "chalk";
import { loadConfig, type WarelayConfig } from "../config/config.js"; import { loadConfig, type WarelayConfig } from "../config/config.js";
import { normalizeE164 } from "../utils.js"; import { normalizeE164 } from "../utils.js";
import { import {
@ -20,28 +21,30 @@ export async function buildProviderSummary(
const { e164 } = readWebSelfId(); const { e164 } = readWebSelfId();
lines.push( lines.push(
webLinked webLinked
? `WhatsApp: linked${e164 ? ` as ${e164}` : ""} (auth ${authAge})` ? chalk.green(`WhatsApp: linked${e164 ? ` as ${e164}` : ""} (auth ${authAge})`)
: "WhatsApp: not linked", : chalk.red("WhatsApp: not linked"),
); );
const telegramToken = const telegramToken =
process.env.TELEGRAM_BOT_TOKEN ?? effective.telegram?.botToken; process.env.TELEGRAM_BOT_TOKEN ?? effective.telegram?.botToken;
lines.push( lines.push(
telegramToken ? "Telegram: configured" : "Telegram: not configured", telegramToken
? chalk.green("Telegram: configured")
: chalk.cyan("Telegram: not configured"),
); );
if (effective.webchat?.enabled === false) { if (effective.webchat?.enabled === false) {
lines.push("WebChat: disabled"); lines.push(chalk.yellow("WebChat: disabled"));
} else { } else {
const port = effective.webchat?.port ?? DEFAULT_WEBCHAT_PORT; const port = effective.webchat?.port ?? DEFAULT_WEBCHAT_PORT;
lines.push(`WebChat: enabled (port ${port})`); lines.push(chalk.green(`WebChat: enabled (port ${port})`));
} }
const allowFrom = effective.inbound?.allowFrom?.length const allowFrom = effective.inbound?.allowFrom?.length
? effective.inbound.allowFrom.map(normalizeE164).filter(Boolean) ? effective.inbound.allowFrom.map(normalizeE164).filter(Boolean)
: []; : [];
if (allowFrom.length) { if (allowFrom.length) {
lines.push(`AllowFrom: ${allowFrom.join(", ")}`); lines.push(chalk.cyan(`AllowFrom: ${allowFrom.join(", ")}`));
} }
return lines; return lines;