feat: sync moves to a plugin, desktop gets multiple accounts (#1580, #1654)

This commit is contained in:
LukeGus committed 2026-10-19 16:06:08 -05:00
1 parent 87cc80b291
commit 25816084aa
28 files changed
+1797 -49

No files matched your search

+2 -8
View File
@@ -1,14 +1,8 @@
import type { NextFunction, Request, Response } from "express";
import { markChanged } from "./feed.js";
import { notifyLocalWrite } from "./write-listeners.js";
const READS = new Set(["GET", "HEAD", "OPTIONS"]);
const writeListeners = new Set<() => void>();
/** Called after every successful write request, for a linked desktop's engine. */
export function onLocalWrite(listener: () => void): () => void {
writeListeners.add(listener);
return () => writeListeners.delete(listener);
}
/**
* Any successful write may change what a linked desktop should have, so it
@@ -23,7 +17,7 @@ export function syncChangeWatcher(
res.on("finish", () => {
if (res.statusCode >= 400) return;
markChanged();
for (const listener of writeListeners) listener();
notifyLocalWrite();
});
}
next();