feat(hosts): manage servers and encrypted SSH credentials in UI (#7)

This commit is contained in:
Florian Schmidt
2026-11-16 10:19:52 +01:00
parent 4fe7e4e376
commit 4d9a632625
22 changed files with 1779 additions and 81 deletions
+3 -3
View File
@@ -22,7 +22,7 @@ export function createNotebookWatcher(workspaceDir: string, options: {
const listeners = new Set<(event: NotebookFileEvent) => void>();
const pending = new Map<string, ReturnType<typeof setTimeout>>();
let closed = false;
const watcher = watch(root, { ignoreInitial: true, followSymlinks: false, atomic: true });
const watcher = watch([root, resolve(workspaceDir, "hosts.yaml")], { ignoreInitial: true, followSymlinks: false, atomic: true });
const ready = new Promise<void>((resolveReady, reject) => {
watcher.once("ready", resolveReady);
watcher.on("error", (error) => {
@@ -34,8 +34,8 @@ export function createNotebookWatcher(workspaceDir: string, options: {
// Callers can await ready; avoid an unhandled rejection before they attach.
void ready.catch(() => {});
const schedule = (type: NotebookFileEvent["type"], file: string) => {
const path = relative(root, file).split(sep).join("/");
if (closed || !path.endsWith(".md") || path.startsWith("../") || isAbsolute(path)) return;
const path = resolve(file) === resolve(workspaceDir, "hosts.yaml") ? "hosts.yaml" : relative(root, file).split(sep).join("/");
if (closed || (!path.endsWith(".md") && path !== "hosts.yaml") || path.startsWith("../") || isAbsolute(path)) return;
clearTimeout(pending.get(path));
pending.set(path, setTimeout(() => {
pending.delete(path);