Refine remote config and path browsing

This commit is contained in:
Dymas
2026-05-26 10:50:31 +02:00
parent 83497d8ff0
commit 4c430e1982
4 changed files with 96 additions and 4 deletions
+30 -2
View File
@@ -357,6 +357,18 @@ CONFIG_HTML = r"""<!doctype html>
gap: 8px;
min-height: 220px;
}
.browser-roots {
display: flex;
flex-wrap: wrap;
gap: 8px;
padding-bottom: 4px;
border-bottom: 1px solid var(--line);
}
.browser-roots .ghost.active {
background: rgba(255, 255, 255, 0.08);
border-color: var(--line-strong);
color: var(--text);
}
.browser-entry {
display: flex;
align-items: center;
@@ -724,7 +736,8 @@ CONFIG_HTML = r"""<!doctype html>
mode: "dir",
path: "",
parent_path: "",
home_path: ""
home_path: "",
root_paths: []
};
pathBrowserOverlay.hidden = true;
pathBrowserList.innerHTML = "";
@@ -739,6 +752,20 @@ CONFIG_HTML = r"""<!doctype html>
pathBrowserCurrentPath.textContent = data.path || "";
pathBrowserStatus.textContent = "";
pathBrowserList.innerHTML = "";
const roots = Array.isArray(data.root_paths) ? data.root_paths : [];
if (roots.length > 1) {
const rootGroup = document.createElement("div");
rootGroup.className = "browser-roots";
for (const rootPath of roots) {
const button = document.createElement("button");
button.type = "button";
button.className = `ghost${rootPath === data.path ? " active" : ""}`;
button.textContent = rootPath;
button.addEventListener("click", () => loadPathBrowser(rootPath));
rootGroup.appendChild(button);
}
pathBrowserList.appendChild(rootGroup);
}
if (!Array.isArray(data.entries) || !data.entries.length) {
const empty = document.createElement("div");
empty.className = "muted";
@@ -784,7 +811,8 @@ CONFIG_HTML = r"""<!doctype html>
mode,
path: $(targetId).value.trim() || "",
parent_path: "",
home_path: ""
home_path: "",
root_paths: []
};
pathBrowserOverlay.hidden = false;
await loadPathBrowser(state.pathBrowser.path);