diff --git a/backend/main.py b/backend/main.py index 6358ee2..e566059 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1514,7 +1514,8 @@ async def api_get_all_vault_settings(current_user=Depends(require_auth)): # Configuration API # --------------------------------------------------------------------------- -_CONFIG_PATH = Path("/app/data/config.json") +_BASE_DIR = Path(__file__).resolve().parent.parent +_CONFIG_PATH = _BASE_DIR / "data" / "config.json" _DEFAULT_CONFIG = { "search_workers": 2, diff --git a/backend/vault_settings.py b/backend/vault_settings.py index 7c1111a..5ff5925 100644 --- a/backend/vault_settings.py +++ b/backend/vault_settings.py @@ -16,7 +16,8 @@ import threading logger = logging.getLogger("obsigate.vault_settings") -_SETTINGS_PATH = Path("/app/data/vault_settings.json") +_BASE_DIR = Path(__file__).resolve().parent.parent +_SETTINGS_PATH = _BASE_DIR / "data" / "vault_settings.json" _settings_lock = threading.Lock() # In-memory cache of vault settings diff --git a/frontend/app.js b/frontend/app.js index 0eaf60f..a240851 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -3388,7 +3388,7 @@ type: "checkbox", id: `hide-hidden-${vault.name}`, "data-vault": vault.name, - checked: settings.hideHiddenFiles || false + checked: settings.hideHiddenFiles ? "true" : false }), el("span", { class: "config-toggle-slider" }) ]), @@ -3422,16 +3422,10 @@ }; promises.push( - fetch(`/api/vaults/${encodeURIComponent(vaultName)}/settings`, { + api(`/api/vaults/${encodeURIComponent(vaultName)}/settings`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(settings) - }).then(async response => { - if (!response.ok) { - const errorData = await response.json().catch(() => ({ detail: response.statusText })); - throw new Error(errorData.detail || `HTTP ${response.status}`); - } - return response.json(); }) ); }); @@ -4287,7 +4281,13 @@ function el(tag, attrs, children) { const e = document.createElement(tag); if (attrs) { - Object.entries(attrs).forEach(([k, v]) => e.setAttribute(k, v)); + Object.entries(attrs).forEach(([k, v]) => { + // Skip boolean false for standard HTML boolean attributes to avoid setAttribute("checked", "false") bug + if (v === false && (k === "checked" || k === "disabled" || k === "hidden" || k === "required" || k === "readonly")) { + return; + } + e.setAttribute(k, v); + }); } if (children) { children.forEach((c) => { if (c) e.appendChild(c); });