fix: vault home recursive + backup viewer fixes + AI status at startup
CI / security (push) Failing after 10m56s
CI / lint (push) Failing after 11m14s
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

- Vault home (#12): recursive file listing (rglob), rel_dir in metadata,
  'recursif' badge, updated roadmap description
- Backup viewer: fix close button (inline onclick + event delegation
  fallback for text nodes), improve error messages
- Backup API: remove response_model to prevent Pydantic 500 errors,
  add try/except + logging on backups/diff/restore endpoints,
  per-entry error handling in _list_backup_files,
  encoding safety (errors='replace') on read_text
- AI status: call /api/ai/status at startup in _initAIStatus
  instead of waiting for user click on sync badge
This commit is contained in:
2026-06-04 09:28:57 -04:00
parent b077c24bf1
commit fc1a4e336e
6 changed files with 200 additions and 85 deletions
+14 -12
View File
@@ -1,6 +1,7 @@
/* ObsiGate — Sync: SSE client + PWA registration */
import { state } from './state.js';
import { showToast } from './ui.js';
import { api } from './auth.js';
import { loadVaults, loadTags, refreshTagsForContext, refreshSidebarTreePreservingState } from './sidebar.js';
import { loadRecentFiles } from './config.js';
import { openFile } from './viewer.js';
@@ -339,16 +340,16 @@ function _renderSyncPanel(panel) {
let _aiProcessing = false;
let _aiConfigured = null; // null = unknown, true/false
/** Check if AI is configured by looking for the AI toolbar in the DOM.
* The toolbar is only rendered when the AI API responds successfully. */
function _checkAIStatus() {
const container = document.getElementById('ai-toolbar-container');
if (container && container.children.length > 0) {
_aiConfigured = true;
} else if (_aiConfigured === null) {
// Keep unknown state until we have evidence
_aiConfigured = null;
/** Check if AI is configured by calling the /api/ai/status endpoint.
* Updates _aiConfigured and refreshes the panel if open. */
async function _checkAIStatus() {
try {
const status = await api('/api/ai/status');
_aiConfigured = status.configured === true;
} catch {
_aiConfigured = false;
}
_updateAIStatusInPanel();
}
function _renderAIStatusSection(panel) {
@@ -420,6 +421,9 @@ function _setBadgeAIProcessing(active) {
/** Initialize AI status tracking. */
function _initAIStatus() {
// Check AI status immediately at startup
_checkAIStatus();
// Listen for AI processing events from ai.js
document.addEventListener('ai-processing-start', () => {
_aiProcessing = true;
@@ -433,13 +437,11 @@ function _initAIStatus() {
_updateAIStatusInPanel();
});
// Check AI status on first sync panel open
// Re-check AI status when sync panel opens (in case config changed)
const badge = document.getElementById('sync-badge');
if (badge) {
const origClick = badge.onclick;
badge.addEventListener('click', () => {
_checkAIStatus();
_updateAIStatusInPanel();
}, { once: false });
}
}