feat: introduce initial ObsiGate Single Page Application with Python backend for vault browsing and search.
This commit is contained in:
parent
ec97d75e59
commit
413524c3bf
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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); });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user