Skip coloring for SSH command output that dumps config file content

This commit is contained in:
2026-02-10 22:52:38 +01:00
parent 0053dc3938
commit c5739d0a14

View File

@@ -154,13 +154,17 @@ function appendConsoleLog(message, timestamp) {
// Color code different log levels using precise patterns to avoid
// false positives from SSH flags (e.g. "-o LogLevel=ERROR") or
// substrings like "stderr".
// Skip coloring for SSH command output that dumps config file content
let logClass = 'text-green-400';
if (/❌/.test(message) || /\b(?:error|fatal)\s*:/i.test(message) || /\bfailed\s+to\b/i.test(message)) {
logClass = 'text-red-400';
} else if (/⚠️/.test(message) || /\b(?:warning|warn)\s*:/i.test(message)) {
logClass = 'text-yellow-400';
} else if (//.test(message) || /\b(?:info|debug)\s*:/i.test(message) || /\bsuccessfully\b/i.test(message)) {
logClass = 'text-blue-400';
var isConfigDump = /SSH command output\b/.test(message) && /Fail2Ban-UI Managed Configuration|jail\.local|action_mwlg/.test(message);
if (!isConfigDump) {
if (//.test(message) || /\b(?:error|fatal)\s*:/i.test(message) || /\bfailed\s+to\b/i.test(message)) {
logClass = 'text-red-400';
} else if (/⚠️/.test(message) || /\b(?:warning|warn)\s*:/i.test(message)) {
logClass = 'text-yellow-400';
} else if (/✅/.test(message) || /\b(?:info|debug)\s*:/i.test(message) || /\bsuccessfully\b/i.test(message)) {
logClass = 'text-blue-400';
}
}
logLine.className = logClass + ' leading-relaxed';