Compare commits

...

2 Commits

View File

@@ -119,7 +119,7 @@
</main> </main>
<script> <script>
const API = '/api' let API = ''
const GROUP_ORDER = ['Guides', 'Agents', 'Vues'] const GROUP_ORDER = ['Guides', 'Agents', 'Vues']
const TIER_MARKERS = { '\u{1F7E2}': 'tier-free', '\u{1F535}': 'tier-featured', '\u{1F7E0}': 'tier-pro', '\u{1F7E3}': 'tier-full' } const TIER_MARKERS = { '\u{1F7E2}': 'tier-free', '\u{1F535}': 'tier-featured', '\u{1F7E0}': 'tier-pro', '\u{1F7E3}': 'tier-full' }
@@ -147,17 +147,21 @@
] ]
async function init() { async function init() {
// Auto-detect API path : /api (proxy Apache) ou direct (local)
for (const prefix of ['', '/api']) {
try { try {
const res = await fetch(`${API}/docs`) const res = await fetch(`${prefix}/docs`)
if (!res.ok) throw new Error() if (!res.ok) continue
const data = await res.json() const data = await res.json()
if (data.docs?.length) { if (data.docs?.length) {
API = prefix
docs = data.docs docs = data.docs
liveMode = true liveMode = true
break
} }
} catch { } catch { /* next */ }
docs = STATIC_DOCS
} }
if (!liveMode) docs = STATIC_DOCS
document.getElementById('mode-badge').textContent = liveMode ? 'live' : 'static' document.getElementById('mode-badge').textContent = liveMode ? 'live' : 'static'
renderNav() renderNav()