version 1. Работают все функции на веб-панели, исправлено поведение при создании пользователей, теперь всё создаётся правильно

This commit is contained in:
2026-06-19 22:46:43 +03:00
parent 5469a967a2
commit 39c1fcf438
5 changed files with 215 additions and 19 deletions
+13 -1
View File
@@ -171,7 +171,19 @@ function showToast(msg,isErr=false){
t.textContent=msg;t.style.color=isErr?'var(--danger)':'var(--ok)';
t.style.display='block';setTimeout(()=>t.style.display='none',2500);
}
function copyText(text){navigator.clipboard.writeText(text).then(()=>showToast('Скопировано ✓'));}
function copyText(text){
if(navigator.clipboard&&navigator.clipboard.writeText){
navigator.clipboard.writeText(text).then(()=>showToast('Скопировано ✓')).catch(()=>_copyFallback(text));
}else{_copyFallback(text);}
}
function _copyFallback(text){
const ta=document.createElement('textarea');
ta.value=text;ta.style.cssText='position:fixed;opacity:0;top:0;left:0';
document.body.appendChild(ta);ta.focus();ta.select();
try{document.execCommand('copy');showToast('Скопировано ✓');}
catch(e){showToast('Ошибка копирования',true);}
document.body.removeChild(ta);
}
function toggleAccordion(hdr){
hdr.classList.toggle('aopen');
hdr.nextElementSibling.classList.toggle('open');
+6 -7
View File
@@ -150,7 +150,6 @@
</div>
</div>
{% endblock %}
<!-- SECURITY / FAIL2BAN -->
<div class="page" id="page-security">
<h1>Безопасность</h1>
@@ -182,7 +181,7 @@
</div>
<div class="form-group" style="max-width:220px">
<label>Время блокировки</label>
<select id="f2b-bantime" onchange="toggleCustomBantime()">
<select id="f2b-bantime" onchange="toggleCustomBantime(this.value)">
<option value="300">5 минут</option>
<option value="900">15 минут</option>
<option value="1800">30 минут</option>
@@ -210,7 +209,7 @@
</div>
</div>
{% endblock %}
{% block scripts %}
<script>
@@ -697,10 +696,10 @@ function fmtSeconds(s) {
return s + ' сек.';
}
document.getElementById('f2b-bantime').addEventListener('change', function() {
function toggleCustomBantime(val) {
document.getElementById('custom-bantime-group').style.display =
this.value === '0' ? '' : 'none';
});
val === '0' ? '' : 'none';
}
function applyPreset(maxRetry, banTime) {
document.getElementById('f2b-maxretry').value = maxRetry;
@@ -744,7 +743,7 @@ function codeBlock(json){
const txt=JSON.stringify(json,null,2);
const id='cb'+Math.random().toString(36).slice(2);
return `<div class="code-block" id="${id}">${escH(txt)}</div>
<button class="btn btn-secondary btn-sm" style="margin-top:8px" onclick="navigator.clipboard.writeText(document.getElementById('${id}').textContent).then(()=>showToast('Скопировано ✓'))">Копировать</button>`;
<button class="btn btn-secondary btn-sm" style="margin-top:8px" onclick="copyText(document.getElementById('${id}').textContent)">Копировать</button>`;
}
</script>
{% endblock %}