Files
holesail-browser/native-host/host/handlers/index.js
T
Raven Scott 2595a01f65
CI / Build & Test (push) Successful in 4m27s
feat: autopass-based cross-device sync for Holesail Browser
- Native host: add autopass + corestore deps, sync-manager (createInvite, pairWithInvite, push/pull)
- Apply synced state via same flow as backup restore (state.json only, no certs)
- Holesail-manager: setOnStateSaved hook for sync push
- Extension: Sync dashboard page, getSyncStatus/createSyncInvite/pairWithInvite, syncApplied event
- Docs: NATIVE-HOST.md sync commands, SYNC.md
2026-03-15 01:31:51 -04:00

41 lines
1.3 KiB
JavaScript

/**
* 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');
const syncHandlers = require('./sync.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),
...syncHandlers.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 };