VNC client
This commit is contained in:
@@ -2,7 +2,6 @@ import express from "express";
|
||||
import { join } from 'path';
|
||||
import { environment } from './services/environment.mjs';
|
||||
import { statusRouter } from './services/status.mjs';
|
||||
import { vncRouter } from './services/vnc.mjs';
|
||||
import { attachUpgrade } from './services/websocket.mjs';
|
||||
|
||||
(async () => {
|
||||
@@ -18,7 +17,6 @@ import { attachUpgrade } from './services/websocket.mjs';
|
||||
// Routes
|
||||
app.use(express.static(join(environment.root, '../public')));
|
||||
app.use('/api', statusRouter);
|
||||
app.use('/vnc', vncRouter);
|
||||
|
||||
// Error handler
|
||||
app.use((err, req, res, next) => {
|
||||
|
||||
@@ -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