VNC client

This commit is contained in:
2026-09-15 01:09:45 -04:00
parent 7023b3c358
commit 6a8a462b9f
68 changed files with 17865 additions and 406 deletions
-17
View File
@@ -1,26 +1,9 @@
import express from 'express';
import net from 'node:net';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { registerSocket } from './websocket.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const NOVNC_PKG = path.join(__dirname, '../../node_modules/@novnc/novnc');
const NOVNC_APP = path.join(__dirname, '../../public/vnc');
const VNC_HOST = process.env.VNC_HOST || '127.0.0.1';
const VNC_PORT = process.env.VNC_PORT || 5900;
export const vncRouter = express.Router();
vncRouter.use('/novnc', express.static(NOVNC_APP));
vncRouter.use('/novnc', express.static(NOVNC_PKG));
vncRouter.get('/novnc/defaults.json', (req, res) => res.json({}));
vncRouter.get('/novnc/mandatory.json', (req, res) => res.json({}));
vncRouter.get('/', (req, res) =>
res.redirect('/vnc/novnc/vnc.html?path=ws/vnc&autoconnect=true&resize=scale')
);
const wss = registerSocket('/ws/vnc', {
handleProtocols: protocols => (protocols.has('binary') ? 'binary' : false)
});