mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-17 14:03:15 +02:00
Skip coloring for SSH command output that dumps config file content
This commit is contained in:
@@ -154,13 +154,17 @@ function appendConsoleLog(message, timestamp) {
|
|||||||
// Color code different log levels using precise patterns to avoid
|
// Color code different log levels using precise patterns to avoid
|
||||||
// false positives from SSH flags (e.g. "-o LogLevel=ERROR") or
|
// false positives from SSH flags (e.g. "-o LogLevel=ERROR") or
|
||||||
// substrings like "stderr".
|
// substrings like "stderr".
|
||||||
|
// Skip coloring for SSH command output that dumps config file content
|
||||||
let logClass = 'text-green-400';
|
let logClass = 'text-green-400';
|
||||||
if (/❌/.test(message) || /\b(?:error|fatal)\s*:/i.test(message) || /\bfailed\s+to\b/i.test(message)) {
|
var isConfigDump = /SSH command output\b/.test(message) && /Fail2Ban-UI Managed Configuration|jail\.local|action_mwlg/.test(message);
|
||||||
logClass = 'text-red-400';
|
if (!isConfigDump) {
|
||||||
} else if (/⚠️/.test(message) || /\b(?:warning|warn)\s*:/i.test(message)) {
|
if (/❌/.test(message) || /\b(?:error|fatal)\s*:/i.test(message) || /\bfailed\s+to\b/i.test(message)) {
|
||||||
logClass = 'text-yellow-400';
|
logClass = 'text-red-400';
|
||||||
} else if (/✅/.test(message) || /\b(?:info|debug)\s*:/i.test(message) || /\bsuccessfully\b/i.test(message)) {
|
} else if (/⚠️/.test(message) || /\b(?:warning|warn)\s*:/i.test(message)) {
|
||||||
logClass = 'text-blue-400';
|
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';
|
logLine.className = logClass + ' leading-relaxed';
|
||||||
|
|||||||
Reference in New Issue
Block a user