CI / Build & Test (push) Successful in 2m46s
Split host.js (435 lines) into host/{paths,logger,startup,message-router}.js.
Split holesail-manager.js (698 lines) into holesail-manager/{state,settings,
connections,port-allocator,servers,virtual-hosts,service-tunnels,index}.js.
Top-level host.js and holesail-manager.js become thin shims so index.mjs
requires no changes. Deleted dev scratch file test-cp.mjs.
Updated CI with 12 new node --check lines for all sub-modules.
Updated docs/ARCHITECTURE.md with per-file tables for host/ and
holesail-manager/ sub-modules.
No functionality changed. No new dependencies.
35 lines
998 B
JavaScript
35 lines
998 B
JavaScript
/**
|
|
* In-memory SSH and RDP/VNC connection lists.
|
|
* These are persisted in state.json but are not live sessions —
|
|
* live sessions are managed by ssh-manager.js and rdp-manager.js.
|
|
*/
|
|
|
|
let sshConnectionsList = [];
|
|
let rdpConnectionsList = [];
|
|
let _saveState = null;
|
|
|
|
function init(saveStateFn) {
|
|
_saveState = saveStateFn;
|
|
}
|
|
|
|
function applyLoaded(ssh, rdp) {
|
|
sshConnectionsList = Array.isArray(ssh) ? ssh : [];
|
|
rdpConnectionsList = Array.isArray(rdp) ? rdp : [];
|
|
}
|
|
|
|
function getSshConnections() { return sshConnectionsList.slice(); }
|
|
function setSshConnections(list) {
|
|
if (!Array.isArray(list)) return;
|
|
sshConnectionsList = list;
|
|
if (_saveState) _saveState();
|
|
}
|
|
|
|
function getRdpConnections() { return rdpConnectionsList.slice(); }
|
|
function setRdpConnections(list) {
|
|
if (!Array.isArray(list)) return;
|
|
rdpConnectionsList = list;
|
|
if (_saveState) _saveState();
|
|
}
|
|
|
|
module.exports = { init, applyLoaded, getSshConnections, setSshConnections, getRdpConnections, setRdpConnections };
|