mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-04-25 03:12:54 -04:00
fix(webui): guard kept downloads fetch behind admin auth
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user