mirror of
https://github.com/SubleXBle/Fail2Ban-Report.git
synced 2026-02-12 03:38:45 -06:00
Update action-collector.js
This commit is contained in:
@@ -35,15 +35,18 @@ function collectAndExecuteActions(ip, jail = '') {
|
||||
const message = data.message || 'No message returned.';
|
||||
let type;
|
||||
|
||||
if (action === 'report') {
|
||||
type = 'info';
|
||||
// check fo type
|
||||
if (data.type) {
|
||||
type = data.type; // from backend
|
||||
} else {
|
||||
type = data.success ? "success" : "error";
|
||||
// fallback:
|
||||
type = data.success ? 'success' : 'error';
|
||||
}
|
||||
|
||||
showNotification(prefix + message, type);
|
||||
})
|
||||
|
||||
|
||||
.catch(err => {
|
||||
const errorMsg = `[${action.toUpperCase()}] Error processing IP ${ip}: ${err}`;
|
||||
showNotification(errorMsg, "error");
|
||||
@@ -63,7 +66,7 @@ function showNotification(message, type = "info") {
|
||||
if (!container) return;
|
||||
|
||||
const note = document.createElement('div');
|
||||
note.className = 'notification ' + type; // CSS notification success/error/info
|
||||
note.className = 'notification ' + type; // CSS Klassen wie notification success/error/info
|
||||
|
||||
note.innerText = message;
|
||||
container.appendChild(note);
|
||||
|
||||
Reference in New Issue
Block a user