feat(hosts): manage servers and encrypted SSH credentials in UI (#7)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user