Files
holesail-browser/native-host/host/handlers/ssh.js
T
Raven Scott 6fcd9fcf2b
CI / Build & Test (push) Successful in 3m19s
eat: implement Holesail-Browser enhancement plan
- 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
2026-03-15 00:24:31 -04:00

42 lines
1.2 KiB
JavaScript

/**
* Handlers for SSH sessions.
* Context: sshManager, debugLog
*/
function register(deps) {
const { sshManager, debugLog } = deps;
return [
{
type: 'startSshSession',
handle: async (payload, reply) => {
debugLog('startSshSession: payload=', JSON.stringify({ ...payload, hsUrl: payload.hsUrl ? payload.hsUrl.slice(0, 20) + '...' : null }));
const result = await sshManager.startSession(payload);
debugLog('startSshSession: result=', JSON.stringify({ ok: result.ok, sessionId: result.sessionId, wsPort: result.wsPort }));
reply(result);
}
},
{
type: 'stopSshSession',
handle: async (payload, reply) => {
debugLog('stopSshSession: payload=', JSON.stringify(payload));
const result = await sshManager.stopSession(payload);
debugLog('stopSshSession: result=', JSON.stringify(result));
reply(result);
}
},
{
type: 'resizeSshSession',
handle: async (payload, reply) => {
sshManager.resizeSession(payload);
reply({ ok: true });
}
},
{
type: 'getSshSessions',
handle: async (payload, reply) => reply({ ok: true, sessions: sshManager.getSessions() })
}
];
}
module.exports = { register };