Compare commits
2 Commits
15eab804e2
...
b53e134ecf
| Author | SHA1 | Date | |
|---|---|---|---|
| b53e134ecf | |||
| 9a35ddf45f |
@@ -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() {
|
||||||
try {
|
// Auto-detect API path : /api (proxy Apache) ou direct (local)
|
||||||
const res = await fetch(`${API}/docs`)
|
for (const prefix of ['', '/api']) {
|
||||||
if (!res.ok) throw new Error()
|
try {
|
||||||
const data = await res.json()
|
const res = await fetch(`${prefix}/docs`)
|
||||||
if (data.docs?.length) {
|
if (!res.ok) continue
|
||||||
docs = data.docs
|
const data = await res.json()
|
||||||
liveMode = true
|
if (data.docs?.length) {
|
||||||
}
|
API = prefix
|
||||||
} catch {
|
docs = data.docs
|
||||||
docs = STATIC_DOCS
|
liveMode = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} catch { /* next */ }
|
||||||
}
|
}
|
||||||
|
if (!liveMode) docs = STATIC_DOCS
|
||||||
|
|
||||||
document.getElementById('mode-badge').textContent = liveMode ? 'live' : 'static'
|
document.getElementById('mode-badge').textContent = liveMode ? 'live' : 'static'
|
||||||
renderNav()
|
renderNav()
|
||||||
|
|||||||
Reference in New Issue
Block a user