This commit is contained in:
2026-08-08 10:10:27 +02:00
parent 6dd70a0fc2
commit 3179d15b42
4 changed files with 48 additions and 9 deletions

View File

@@ -26,6 +26,14 @@
</div>
</div>
<div class="settings-item" style="margin-bottom: 20px;">
<label style="display: flex; align-items: center; gap: 10px; cursor: pointer; color: #ff6b6b; font-weight: bold;">
<input type="checkbox" id="cleanup_include_engaged" name="cleanup_include_engaged" value="true" @if(cleanup_include_engaged) checked @endif style="width: 18px; height: 18px; cursor: pointer;">
<span>Include items with engagement</span>
</label>
<span style="color: #888; display: block; margin-top: 5px; margin-left: 28px;">If checked, cleanup will purge ALL posts in the selected date range, even if they have comments or favorites.</span>
</div>
<div style="display: flex; gap: 10px; align-items: center;">
<button type="submit" class="btn-primary" style="width: auto; padding: 12px 40px; font-weight: bold;">Save Configuration</button>
<span id="cleanup-status" style="margin-left: 15px; font-weight: bold; display: none;"></span>
@@ -101,8 +109,13 @@
async function runCleanup() {
const btn = document.getElementById('run-cleanup-btn');
const status = document.getElementById('run-status');
const includeEngaged = document.getElementById('cleanup_include_engaged')?.checked || false;
if (!confirm('Are you absolutely sure? This will PERMANENTLY delete files from disk. This action cannot be undone.')) return;
const warningMsg = includeEngaged
? 'SECURITY CLEANUP WARNING: You have selected to INCLUDE posts WITH engagement (comments/favorites). Are you ABSOLUTELY SURE you want to permanently delete ALL posts in this date range?'
: 'Are you absolutely sure? This will PERMANENTLY delete files from disk. This action cannot be undone.';
if (!confirm(warningMsg)) return;
btn.disabled = true;
btn.textContent = 'CLEANING UP...';
@@ -110,12 +123,17 @@
status.style.color = 'var(--accent)';
try {
const formData = new URLSearchParams();
formData.append('include_engaged', includeEngaged ? 'true' : 'false');
const res = await fetch('/admin/cleanup/run', {
method: 'POST',
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/x-www-form-urlencoded',
'X-CSRF-Token': window.f0ckSession?.csrf_token || '{{ csrf_token }}'
}
},
body: formData
});
const cleanup_response = await res.json();