Adding option to log users ips

This commit is contained in:
2026-05-11 07:45:00 +02:00
parent 862b145c77
commit 1221e0580f
16 changed files with 306 additions and 38 deletions

View File

@@ -40,6 +40,26 @@
<span class="slider round"></span>
</label>
</div>
<div class="settings-toggle" style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 4px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px;">
<div>
<label style="display: block; font-weight: bold; color: var(--accent);">Log User IPs</label>
<p style="margin: 2px 0 0 0; font-size: 0.8em; color: #aaa;">Log all historical IPs for user accounts.</p>
</div>
<label class="switch">
<input type="checkbox" id="log_user_ips_toggle" {{ log_user_ips ? 'checked' : '' }} onchange="saveAdminSettings()">
<span class="slider round"></span>
</label>
</div>
<div class="settings-toggle" style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 4px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px;">
<div>
<label style="display: block; font-weight: bold; color: var(--accent);">Hash User IPs</label>
<p style="margin: 2px 0 0 0; font-size: 0.8em; color: #aaa;">Anonymize IPs by hashing them (same as failed logins).</p>
</div>
<label class="switch">
<input type="checkbox" id="hash_user_ips_toggle" {{ hash_user_ips ? 'checked' : '' }} onchange="saveAdminSettings()">
<span class="slider round"></span>
</label>
</div>
@if(registration_web_toggle_enabled)
<div class="settings-toggle" style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 4px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px;">
@@ -99,6 +119,8 @@
const status = document.getElementById('settings-status');
const approvalToggle = document.getElementById('manual_approval_toggle');
const registrationToggle = document.getElementById('registration_open_toggle');
const logIpsToggle = document.getElementById('log_user_ips_toggle');
const hashIpsToggle = document.getElementById('hash_user_ips_toggle');
const minTagsInput = document.getElementById('min_tags_input');
const trustedUploadsInput = document.getElementById('trusted_uploads_input');
@@ -114,6 +136,8 @@
},
body: new URLSearchParams({
manual_approval: approvalToggle.checked ? 'on' : 'off',
log_user_ips: logIpsToggle.checked ? 'on' : 'off',
hash_user_ips: hashIpsToggle.checked ? 'on' : 'off',
...(registrationToggle ? { registration_open: registrationToggle.checked ? 'on' : 'off' } : {}),
min_tags: minTagsInput.value,
trusted_uploads: trustedUploadsInput.value,