- Add unit tests (hostname-validator, TLDs, payload-schemas) and integration tests for message handler registry - Refactor native host message router into handler registry (handlers/state, tunnels, ssh, rdp, backup, ca, connections) - Add ESLint config and npm test + lint steps in CI - Dashboard: visibility-based refresh pause, configurable refresh interval (2s/5s/10s/paused) - Accessibility: ARIA on nav and modals, focus trap and restore, prefers-reduced-motion - Empty states: primary action buttons for virtual hosts, servers, service tunnels - Native host rate limiting for backup and CA operations; update SECURITY.md - CONTRIBUTING: "Adding a new dashboard page", dev workflow; add npm run dev script
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Aggregates all message handlers into a single type -> handle map.
|
||||
* Each handler module exports register(deps) and returns an array of { type, handle }.
|
||||
* deps must include all manager refs plus debugLog and log (for handlers that log).
|
||||
*/
|
||||
|
||||
const stateHandlers = require('./state.js');
|
||||
const connectionsHandlers = require('./connections.js');
|
||||
const tunnelsHandlers = require('./tunnels.js');
|
||||
const caHandlers = require('./ca.js');
|
||||
const sshHandlers = require('./ssh.js');
|
||||
const rdpHandlers = require('./rdp.js');
|
||||
const backupHandlers = require('./backup.js');
|
||||
|
||||
/**
|
||||
* Build the handler registry. Pass the same deps that message-router has.
|
||||
* @returns {Map<string, Function>} type -> async (payload, reply) => void
|
||||
*/
|
||||
function buildHandlers(deps) {
|
||||
const entries = [
|
||||
...stateHandlers.register(deps),
|
||||
...connectionsHandlers.register(deps),
|
||||
...tunnelsHandlers.register(deps),
|
||||
...caHandlers.register(deps),
|
||||
...sshHandlers.register(deps),
|
||||
...rdpHandlers.register(deps),
|
||||
...backupHandlers.register(deps)
|
||||
];
|
||||
|
||||
const map = new Map();
|
||||
for (const { type, handle } of entries) {
|
||||
if (map.has(type)) throw new Error(`Duplicate handler for type: ${type}`);
|
||||
map.set(type, handle);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
module.exports = { buildHandlers };
|
||||
Reference in New Issue
Block a user