docs: add CONTRIBUTING.md, CHANGELOG.md, and JSDoc to entire codebase
CI / Build & Test (push) Successful in 2m54s

Add docs/CONTRIBUTING.md covering the build system, dev workflow, all
npm scripts, how to add new native host message types, code style, and
debugging guidance.

Add CHANGELOG.md at the project root documenting all features and fixes
across the 1.0.0 release.

Add JSDoc (@param, @returns) to all previously undocumented exported
functions across 35 JS files:
- native-host/holesail-manager/ (index, virtual-hosts, service-tunnels,
  servers, port-allocator)
- native-host top-level managers (startup, connect-proxy, https-proxy,
  certificate-authority, ssh-manager, rdp-manager)
- extension/background/ (logs, native-messaging, proxy, message-router)
- extension/dashboard/core/ (utils, navigation, init)
- extension/dashboard/ui/ (modal, toast, state-tag)
- extension/dashboard/pages/ (all 10 page files)
- extension/dashboard/refresh.js, events.js
- extension/dashboard/data/hostname-validator.js
- scripts/ (build-host, run-install)
This commit is contained in:
Raven Scott
2026-03-01 00:40:53 -05:00
parent f0917a2d31
commit f1e98a7edd
38 changed files with 1018 additions and 41 deletions
+27 -2
View File
@@ -1,5 +1,9 @@
// Depends on: core/utils.js ($, escapeHtml, log), core/messaging.js (sendToNative),
// ui/toast.js (showToast), ui/modal.js (openModal, closeModal, showModalError)
/**
* Remote Desktop page — connection grid, add/edit modal, VNC viewer (noVNC over WebSocket),
* and RDP bitmap viewer (node-rdpjs-2 over WebSocket with offscreen canvas rendering).
* Depends on: core/utils.js ($, escapeHtml, log), core/messaging.js (sendToNative),
* ui/toast.js (showToast), ui/modal.js (openModal, closeModal, showModalError)
*/
let rdpConnections = [];
let activeRdpSession = null; // { sessionId, wsPort, type, ws, rfb, conn }
@@ -34,6 +38,9 @@ function saveRdpConnections(cb) {
);
}
/**
* Re-render the RDP/VNC connection grid from the current `rdpConnections` array.
*/
function renderRdpGrid() {
const grid = $('rdpGrid');
if (!grid) return;
@@ -108,6 +115,10 @@ function renderRdpGrid() {
});
}
/**
* Open the Add/Edit Remote Desktop Connection modal, pre-populated with `conn` if provided.
* @param {object} [conn] - Existing connection to edit; omit to add a new one.
*/
function openAddRdpModal(conn) {
const isEdit = !!conn;
$('modal-addRdp-title').textContent = isEdit ? 'Edit Remote Desktop Connection' : 'Add Remote Desktop Connection';
@@ -359,6 +370,11 @@ function renderRdpBitmap(ctx, bitmap) {
ctx.drawImage(_rdpOffscreen, destLeft, destTop, drawW, drawH);
}
/**
* Open the viewer modal and start a VNC or RDP session for the given connection.
* @param {object} conn - RDP/VNC connection object with `type`, `hsUrl`, `port`, etc.
* @returns {Promise<void>}
*/
async function connectRdp(conn) {
openModal('modal-rdpViewer');
@@ -410,6 +426,11 @@ async function connectRdp(conn) {
}
}
/**
* Disconnect the active RDP/VNC session: close the WebSocket, stop the protocol client,
* and send a stopRdpSession message to the native host.
* @returns {Promise<void>}
*/
async function disconnectRdp() {
if (!activeRdpSession) return;
const { sessionId, rfb, ws } = activeRdpSession;
@@ -431,6 +452,10 @@ async function disconnectRdp() {
}
}
/**
* Attach all event listeners for the Remote Desktop page.
* Called once during dashboard initialisation.
*/
function setupRdpEvents() {
$('addRdpBtn')?.addEventListener('click', () => openAddRdpModal(null));