Hub stage 6: blocking and cache actions on several servers

One endpoint, hub/servers/run (operate), runs a fixed set of actions on
the chosen servers in parallel with each server's admin token: add or
remove a domain in Blocked or Allowed, disable blocking for a time or
enable it, update block lists, replace the block list URLs, flush the
cache or delete a domain from it. Each server gets its own result and
the console offers Retry failed.

In "All servers", Blocking, Cache and Query Logs rows open this flow
instead of being disabled. The hub validates domains, minutes and the
server's list grammar (allow lists with !, switched-off lines with #)
and logs no URL list. Operators can now use the blocking switch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
DenozordecandClaude Opus 5.5 committed 2026-10-31 22:50:09 +07:00
1 parent 8bb1e01936
commit 34de910e04
31 files changed
+1560 -40

No files matched your search

+9 -1
View File
@@ -300,11 +300,19 @@ function route(path, q) {
for (const [k, v] of q) {
if (!(k in settings) || k === 'node' || k === 'token') continue
const old = settings[k]
if (k === 'enableBlocking' && v === 'true') settings.temporaryDisableBlockingTill = null
settings[k] = typeof old === 'boolean' ? v === 'true' : typeof old === 'number' ? Number(v) : Array.isArray(old) ? v.split(/[,\n]/).map((x) => x.trim()).filter((x) => x && x !== 'false') : v
}
return ok(settings)
}
case 'settings/forceUpdateBlockLists': case 'settings/temporaryDisableBlocking': return ok(path === 'settings/set' ? settings : { temporaryDisableBlockingTill: iso(now + 10 * 60_000) })
case 'settings/forceUpdateBlockLists': return ok()
case 'settings/temporaryDisableBlocking': {
// Blocking is off until the time given, as on a server; `settings/set enableBlocking=true` turns it back on.
const minutes = Number(q.get('minutes') ?? 10)
settings.enableBlocking = false
settings.temporaryDisableBlockingTill = iso(Date.now() + minutes * 60_000)
return ok({ temporaryDisableBlockingTill: settings.temporaryDisableBlockingTill })
}
case 'user/createSingleUseToken': return ok({ token: 'mock-once' })
case 'settings/getTsigKeyNames': return ok({ tsigKeyNames: ['transfer.example.net'] })
case 'dhcp/leases/list': return ok({ leases })