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

This commit is contained in:
Krikorios
2026-04-19 00:05:09 +03:00
parent 5b1e770948
commit da900cab2d
4 changed files with 45 additions and 17 deletions
+18 -7
View File
@@ -206,15 +206,26 @@ async function deleteDoc(docId, btn) {
}
async function unflagDuplicate(docId, btn) {
if (!confirm('تأكيد أنها ليست وثيقة مكررة؟')) return;
const original = btn.textContent;
btn.disabled = true;
const res = await fetch(`/documents/${docId}/unflag-duplicate`, { method: 'POST' });
if (res.ok) {
document.getElementById(`card-${docId}`)?.remove();
} else {
alert('فشل التحديث.');
btn.disabled = false;
btn.textContent = '...';
try {
const res = await fetch(`/documents/${docId}/unflag-duplicate`, {
method: 'POST',
headers: { 'Accept': 'application/json' },
});
if (res.ok) {
document.getElementById(`card-${docId}`)?.remove();
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 deleteAllDuplicates(btn) {