fix: …
This commit is contained in:
@@ -144,15 +144,14 @@
|
||||
const canReaders = inGroup(groups, "readers");
|
||||
const canEditors = inGroup(groups, "editors");
|
||||
|
||||
access.canUsers = Boolean((info?.ok && (canReaders || canEditors)) || (isDev() && !info?.ok));
|
||||
const whoamiSkipped = Boolean(window.__archiFlags && window.__archiFlags.whoamiSkipped);
|
||||
access.canUsers = Boolean((info?.ok && (canReaders || canEditors)) || whoamiSkipped);
|
||||
access.ready = true;
|
||||
|
||||
if (btnMediaSubmit) btnMediaSubmit.disabled = !access.canUsers;
|
||||
if (btnSend) btnSend.disabled = !access.canUsers;
|
||||
|
||||
if (btnRefSubmit) btnRefSubmit.disabled = !access.canUsers;
|
||||
|
||||
|
||||
// si pas d'accès, on informe (soft)
|
||||
if (!access.canUsers) {
|
||||
if (msgHead) {
|
||||
@@ -162,12 +161,13 @@
|
||||
}
|
||||
}
|
||||
}).catch(() => {
|
||||
// fallback dev
|
||||
// fallback dev (cohérent: media + ref + comment)
|
||||
access.ready = true;
|
||||
if (isDev()) {
|
||||
if (Boolean(window.__archiFlags && window.__archiFlags.whoamiSkipped)) {
|
||||
access.canUsers = true;
|
||||
if (btnMediaSubmit) btnMediaSubmit.disabled = false;
|
||||
if (btnSend) btnSend.disabled = false;
|
||||
if (btnRefSubmit) btnRefSubmit.disabled = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -209,8 +209,12 @@
|
||||
async function loadIndex() {
|
||||
if (_idxP) return _idxP;
|
||||
_idxP = (async () => {
|
||||
const res = await fetch("/annotations-index.json?_=" + Date.now(), { cache: "no-store" }).catch(() => null);
|
||||
if (res && res.ok) return await res.json();
|
||||
try {
|
||||
const res = await fetch("/annotations-index.json?_=" + Date.now(), { cache: "no-store" });
|
||||
if (res && res.ok) return await res.json();
|
||||
} catch {}
|
||||
// ✅ antifragile: ne pas “cacher” un échec pour toujours (dev/HMR/boot race)
|
||||
_idxP = null;
|
||||
return null;
|
||||
})();
|
||||
return _idxP;
|
||||
@@ -564,6 +568,14 @@
|
||||
hideMsg(msgComment);
|
||||
|
||||
const idx = await loadIndex();
|
||||
|
||||
// ✅ message soft si l’index est indisponible (sans écraser le message d’auth)
|
||||
if (!idx && msgHead && msgHead.hidden) {
|
||||
msgHead.hidden = false;
|
||||
msgHead.textContent = "Index annotations indisponible (annotations-index.json).";
|
||||
msgHead.dataset.kind = "info";
|
||||
}
|
||||
|
||||
const data = idx?.pages?.[pageKey]?.paras?.[currentParaId] || null;
|
||||
|
||||
renderLevel2(data);
|
||||
|
||||
Reference in New Issue
Block a user