VNC client
This commit is contained in:
@@ -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)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user