perf: paginate docs list, lazy thumbnails, static cache headers

This commit is contained in:
Krikorios
2026-04-19 00:08:56 +03:00
parent da900cab2d
commit 95650e4c17
+17 -5
View File
@@ -193,16 +193,28 @@ async function scanDuplicates(btn) {
}
async function deleteDoc(docId, btn) {
if (!confirm('حذف هذه الوثيقة نهائياً؟')) return;
if (!window.confirm('حذف هذه الوثيقة نهائياً؟')) return;
const original = btn.textContent;
btn.disabled = true;
const res = await fetch(`/documents/${docId}`, { method: 'DELETE' });
btn.textContent = '...';
try {
const res = await fetch(`/documents/${docId}`, {
method: 'DELETE',
headers: { 'Accept': 'application/json' },
});
if (res.ok) {
// Reload so keeper-promotion (if the keeper was deleted) is reflected.
location.reload();
} else {
alert('فشل الحذف.');
btn.disabled = false;
return;
}
let msg = `HTTP ${res.status}`;
try { const j = await res.json(); if (j.error) msg += `${j.error}`; } catch (_) {}
alert(`فشل الحذف: ${msg}`);
} catch (e) {
alert(`خطأ في الشبكة: ${e.message}`);
}
btn.disabled = false;
btn.textContent = original;
}
async function unflagDuplicate(docId, btn) {