From 262700ee45aa01488367cb51962e580b0448d7a3 Mon Sep 17 00:00:00 2001 From: Steppenstreuner Date: Fri, 28 Aug 2026 13:21:32 +0200 Subject: [PATCH] add(core): open filesystem while adding library path --- static/app.js | 18 ++++ static/index.html | 256 +++++++++++++++++++++++++++------------------- wordarr/api/fs.py | 28 +++++ wordarr/main.py | 3 +- 4 files changed, 196 insertions(+), 109 deletions(-) create mode 100644 wordarr/api/fs.py diff --git a/static/app.js b/static/app.js index 58b2442..d5969ca 100644 --- a/static/app.js +++ b/static/app.js @@ -84,6 +84,24 @@ $("#lib-form").addEventListener("submit", async (e) => { } catch (err) { toast(err.message, true); } }); +// path autocompletion for the library form +{ + const pathInput = document.querySelector('#lib-form [name=root_path]'); + const datalist = $("#path-suggestions"); + let pathTimer; + pathInput.addEventListener("input", () => { + clearTimeout(pathTimer); + const value = pathInput.value; + if (!value.startsWith("/")) return; + pathTimer = setTimeout(async () => { + try { + const res = await api("/api/fs/browse?path=" + encodeURIComponent(value)); + datalist.innerHTML = res.dirs.map((d) => `