Reorganize the whole javascript part as seperate files, for better maintainabillity

This commit is contained in:
2025-12-05 14:30:28 +01:00
parent fb4796de59
commit 2ce9c0095d
24 changed files with 3535 additions and 3112 deletions

19
pkg/web/static/js/api.js Normal file
View File

@@ -0,0 +1,19 @@
// API helper functions for Fail2ban UI
// Add server parameter to URL
function withServerParam(url) {
if (!currentServerId) {
return url;
}
return url + (url.indexOf('?') === -1 ? '?' : '&') + 'serverId=' + encodeURIComponent(currentServerId);
}
// Get server headers for API requests
function serverHeaders(headers) {
headers = headers || {};
if (currentServerId) {
headers['X-F2B-Server'] = currentServerId;
}
return headers;
}