fix(webui): guard kept downloads fetch behind admin auth

This commit is contained in:
2026-04-07 15:59:05 -04:00
parent 3c02988134
commit 02d49c1ab6
2 changed files with 10 additions and 1 deletions
+4
View File
@@ -193,6 +193,10 @@ async function fetchMissingTracks() {
}
async function fetchDownloads() {
if (!isAuthenticated() || !isAdminSession()) {
return;
}
try {
const data = await API.fetchDownloads();
const tbody = document.getElementById("downloads-table-body");
+6 -1
View File
@@ -75,7 +75,12 @@ window.switchTab = function (tabName) {
content.classList.add("active");
window.location.hash = tabName;
if (tabName === "kept" && typeof window.fetchDownloads === "function") {
if (
tabName === "kept" &&
authSession?.isAuthenticated?.() &&
authSession?.isAdminSession?.() &&
typeof window.fetchDownloads === "function"
) {
window.fetchDownloads();
}
}