sync: add cross-subsystem event bus for config consistency

Add EventBus with loop guards to keep firewall, dnsmasq, wireguard,
and network configs consistent. Handlers emit SyncEvent after mutations;
subscribers compute diffs and write JSON without manual cascade loops.
This commit is contained in:
2026-06-29 20:44:36 +00:00
parent 348bbfbca6
commit 9088f34345
15 changed files with 2117 additions and 59 deletions
+7 -1
View File
@@ -182,7 +182,13 @@ export default definePage({
'on:click': async () => {
const res = await apiFetch('/api/dhcp/apply', { method: 'POST' });
if (res.ok) {
toast('dnsmasq applied', 'success');
const synced = res.data?.synced;
let msg = 'dnsmasq applied';
if (synced && synced.length) {
msg += ' (auto-synced: ' + synced.join(', ') + ')';
synced.forEach(s => modelFetch(s));
}
toast(msg, 'success');
modelFetch('dnsmasq');
} else {
toast(res.error || 'Apply failed', 'error');