new options

This commit is contained in:
Mateusz Gruszczyński
2025-11-03 08:42:40 +01:00
parent b305368690
commit f96b426788
4 changed files with 126 additions and 94 deletions

View File

@@ -101,6 +101,18 @@
bindToggle('#add_path_based', '#base_redirect_fields');
bindToggle('#add_acl_path', '#forbidden_fields');
// Backend SSL redirect
const backendSslCheckbox = $('#backend_ssl_redirect');
const backendSslFields = $('#backend_ssl_fields');
backendSslCheckbox?.addEventListener('change', function() {
toggle(this.checked, backendSslFields);
if (this.checked) {
// Show frontend port field
document.getElementById('ssl_redirect_port')?.parentElement.classList.remove('d-none');
}
});
// LB Method - obsługa trybu no-lb
const lbMethodSelect = $('#lb_method');
const backendServersContainer = $('#backend_servers_container');
@@ -110,29 +122,29 @@
const isNoLb = lbMethodSelect?.value === 'no-lb';
if (isNoLb) {
// Ukryj przycisk dodawania kolejnych serwerów
// Hide add server button
if (addServerBtn) addServerBtn.classList.add('d-none');
// Zostaw tylko pierwszy serwer i usuń pozostałe
// Keep only first server and remove others
const serverRows = $$('.backend-server-row', backendServersContainer);
serverRows.forEach((row, idx) => {
if (idx > 0) row.remove();
});
// Dodaj informację o trybie no-lb jeśli jeszcze nie istnieje
// Add info about no-lb mode if it doesn't exist
if (!$('.no-lb-info')) {
const info = document.createElement('div');
info.className = 'alert alert-info alert-sm no-lb-info mt-2';
info.innerHTML = '<i class="bi bi-info-circle me-2"></i><small>Tryb <strong>no-lb</strong>: frontend → backend → pojedynczy serwer. Możesz włączyć XSS, DOS, SQL injection protection itp.</small>';
info.innerHTML = '<i class="bi bi-info-circle me-2"></i><small>Mode <strong>no-lb</strong>: frontend → backend → single server. You can still enable XSS, DOS, SQL injection protection etc.</small>';
if (backendServersContainer?.parentElement) {
backendServersContainer.parentElement.appendChild(info);
}
}
} else {
// Pokaż przycisk dodawania serwerów
// Show add server button
if (addServerBtn) addServerBtn.classList.remove('d-none');
// Usuń informację o no-lb
// Remove no-lb info
const info = $('.no-lb-info');
if (info) info.remove();
}