mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-11 13:47:05 +02:00
Reorganize the whole javascript part as seperate files, for better maintainabillity
This commit is contained in:
19
pkg/web/static/js/api.js
Normal file
19
pkg/web/static/js/api.js
Normal 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user