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); }
}
});
+16 -1
View File
@@ -1199,6 +1199,19 @@
? `<span class="sidebar-personalized-pill" title="Personalized recommendation based on your interests"><i class="fa-solid fa-wand-magic-sparkles"></i> For You</span>`
: '';
const isDev = !!(window.f0ckSession && window.f0ckSession.development);
const rawScore = (typeof video.score === 'number')
? video.score
: (typeof video.rank_score === 'number' ? video.rank_score : (video.xd_score || 0));
const formattedScore = (typeof rawScore === 'number')
? (Number.isInteger(rawScore) ? rawScore : +(rawScore.toFixed(1)))
: rawScore;
const devScoreAttr = isDev ? ` data-score="${escapeHtml(String(formattedScore))}"` : '';
const devScoreBadge = isDev
? `<span class="sidebar-video-score sidebar-dev-score" title="Development Score: ${formattedScore} (Algo: ${video.score ?? video.rank_score ?? 0}, xD: ${video.xd_score ?? 0})"><i class="fa-solid fa-code"></i> score: ${formattedScore}</span>`
: '';
const isTagFeed = options.isTagFeed || false;
const tagContext = options.tag || null;
const targetHref = (isTagFeed && tagContext)
@@ -1207,7 +1220,7 @@
const activeClass = options.isActive ? ' active-tag-item' : '';
return `
<div class="sidebar-video-card${activeClass}" data-id="${video.id}" data-slug="${escapeHtml(video.slug || '')}" data-file="${escapeHtml(video.dest || '')}" data-mime="${escapeHtml(video.mime || '')}" data-ext="${escapeHtml(ext ? ext.toLowerCase() : '')}" data-mode="${rClass}" data-personalized="${video.personalized ? 'true' : 'false'}">
<div class="sidebar-video-card${activeClass}" data-id="${video.id}" data-slug="${escapeHtml(video.slug || '')}" data-file="${escapeHtml(video.dest || '')}" data-mime="${escapeHtml(video.mime || '')}" data-ext="${escapeHtml(ext ? ext.toLowerCase() : '')}" data-mode="${rClass}" data-personalized="${video.personalized ? 'true' : 'false'}"${devScoreAttr}>
<a href="${targetHref}" class="sidebar-video-link" data-mode="${rClass}" data-inherit-context="false">
<div class="sidebar-video-thumb-wrap" data-file="${escapeHtml(video.dest || '')}" data-mime="${escapeHtml(video.mime || '')}" data-ext="${escapeHtml(ext ? ext.toLowerCase() : '')}" data-mode="${rClass}">
${thumbContentHtml}
@@ -1226,6 +1239,8 @@
${xdBadge}
${((timeStr || xdBadge) && forYouBadge) ? `&bull;` : ''}
${forYouBadge}
${((timeStr || xdBadge || forYouBadge) && devScoreBadge) ? `&bull;` : ''}
${devScoreBadge}
</div>
</div>
</div>