[FIX] Knowledge Base: token key errata (access_token->nis2_access_token) + init mancante

Bug CRITICO da test multi-agente: kb.js::getJwt() leggeva localStorage 'access_token'
ma l'app salva il JWT sotto 'nis2_access_token' -> ogni chiamata KB inviava
Authorization: Bearer (vuoto) -> 401 -> pagina KB completamente inutilizzabile
(upload/list/search/delete). Stesso pattern del bug this.delete.
Inoltre kb.html non aveva il blocco init (checkAuth/loadSidebar/I18n.init) presente
in tutte le altre pagine -> sidebar vuota e nessun redirect a login.

Fix: kb.js usa nis2_access_token; kb.html aggiunge i18n.js + init auth/chrome.
node --check OK. version 1.10.6.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
DevEnv nis2-agile
2026-05-31 15:11:37 +02:00
co-authored by Claude Opus 4.8
parent 4ab549fc0c
commit 8a55194b2f
3 changed files with 12 additions and 2 deletions
+10
View File
@@ -129,6 +129,16 @@
<script src="js/common.js"></script>
<script src="js/api.js"></script>
<script src="js/i18n.js"></script>
<script src="js/kb.js"></script>
<script>
// Gate auth + chrome come le altre pagine (kb.html ne era priva).
if (typeof checkAuth === 'function' && !checkAuth()) {
// checkAuth reindirizza a login se non autenticato
} else {
if (typeof loadSidebar === 'function') loadSidebar();
if (typeof I18n !== 'undefined' && I18n.init) I18n.init();
}
</script>
</body>
</html>