diff --git a/admin-dashboard.html b/admin-dashboard.html index de0a0ea..ca28a5a 100644 --- a/admin-dashboard.html +++ b/admin-dashboard.html @@ -1426,35 +1426,68 @@ const HARDCODED_APPS = [ ]; // Load hardcoded apps -function loadHardcodedApps() { +async function loadHardcodedApps() { const hardcodedAppsList = document.getElementById('hardcodedAppsList'); - if (HARDCODED_APPS.length === 0) { + try { + // Get the list of dynamic apps to check for duplicates + const token = localStorage.getItem('token'); + if (!token) { + window.location.href = '/login.html'; + return; + } + + const response = await fetch('/api/apps', { + headers: { + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'application/json' + } + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const dynamicApps = await response.json(); + const dynamicAppIds = new Set(dynamicApps.map(app => app.id)); + + // Filter out hardcoded apps that are already in the dynamic apps list + const uniqueHardcodedApps = HARDCODED_APPS.filter(app => !dynamicAppIds.has(app.id)); + + if (uniqueHardcodedApps.length === 0) { + hardcodedAppsList.innerHTML = ` +
${app.url}
+${app.description}
+${app.url}
-${app.description}
-Žádné vlastní aplikace nebyly nalezeny
+