mirror of
https://github.com/swissmakers/fail2ban-ui.git
synced 2026-04-17 05:53:15 +02:00
24 lines
693 B
JavaScript
24 lines
693 B
JavaScript
// API helpers for Fail2ban UI.
|
|
"use strict";
|
|
|
|
// =========================================================================
|
|
// Server-Scoped Requests
|
|
// =========================================================================
|
|
|
|
// Adds the server ID to the URL if a server is selected.
|
|
function withServerParam(url) {
|
|
if (!currentServerId) {
|
|
return url;
|
|
}
|
|
return url + (url.indexOf('?') === -1 ? '?' : '&') + 'serverId=' + encodeURIComponent(currentServerId);
|
|
}
|
|
|
|
// Adds the server ID to the headers if a server is selected.
|
|
function serverHeaders(headers) {
|
|
headers = headers || {};
|
|
if (currentServerId) {
|
|
headers['X-F2B-Server'] = currentServerId;
|
|
}
|
|
return headers;
|
|
}
|