This commit is contained in:
2026-09-12 06:57:10 +02:00
parent acf29df204
commit 03abac6bef
11 changed files with 178 additions and 30 deletions
+26 -6
View File
@@ -6668,14 +6668,23 @@ window.cancelAnimFrame = (function () {
if (!tagname) return;
suggestions.style.display = 'none';
try {
const csrf = window.f0ckSession?.csrf_token || document.querySelector('input[name="csrf_token"]')?.value || '';
const res = await fetch('/api/v2/settings/excluded_tags', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tagname })
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': csrf
},
body: JSON.stringify({ tagname, csrf_token: csrf })
});
const data = await res.json();
if (data.success) { renderTags(); input.value = ''; }
else window.flashMessage(data.msg || 'Error adding tag', 3000, 'error');
if (data.success) {
renderTags();
input.value = '';
if (typeof gridCacheMap !== 'undefined') gridCacheMap.clear();
} else {
window.flashMessage(data.msg || 'Error adding tag', 3000, 'error');
}
} catch (e) {
console.error(e);
} finally {
@@ -6699,9 +6708,20 @@ window.cancelAnimFrame = (function () {
e.preventDefault();
const tag = e.target.getAttribute('data-tag');
try {
const res = await fetch(`/api/v2/settings/excluded_tags/${encodeURIComponent(tag)}`, { method: 'DELETE' });
const csrf = window.f0ckSession?.csrf_token || document.querySelector('input[name="csrf_token"]')?.value || '';
const res = await fetch(`/api/v2/settings/excluded_tags/${encodeURIComponent(tag)}`, {
method: 'DELETE',
headers: {
'X-CSRF-Token': csrf
}
});
const data = await res.json();
if (data.success) renderTags();
if (data.success) {
renderTags();
if (typeof gridCacheMap !== 'undefined') gridCacheMap.clear();
} else {
window.flashMessage(data.msg || 'Error removing tag', 3000, 'error');
}
} catch (e) { console.error(e); }
}
});