clean up some stuff and upgrade to the latest superqemu release
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@computernewb/nodejs-rfb": "^0.3.0",
|
"@computernewb/nodejs-rfb": "^0.3.0",
|
||||||
"@computernewb/superqemu": "0.2.4-alpha0",
|
"@computernewb/superqemu": "0.2.4",
|
||||||
"@cvmts/cvm-rs": "*",
|
"@cvmts/cvm-rs": "*",
|
||||||
"@maxmind/geoip2-node": "^5.0.0",
|
"@maxmind/geoip2-node": "^5.0.0",
|
||||||
"execa": "^8.0.1",
|
"execa": "^8.0.1",
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
import EventEmitter from 'node:events';
|
import EventEmitter from 'node:events';
|
||||||
import { Size, Rect } from '../Utilities';
|
import { Size, Rect } from '../Utilities';
|
||||||
|
|
||||||
|
|
||||||
|
// events:
|
||||||
|
//
|
||||||
|
// 'connected' -> () -> on successful connection
|
||||||
|
// 'resize' -> (w, h) -> done when resize occurs
|
||||||
|
// 'rect' -> (x, y, Buffer) -> framebuffer rect (RGBA)
|
||||||
|
// 'frame' -> () -> done at end of frame
|
||||||
|
|
||||||
export interface VMDisplay extends EventEmitter {
|
export interface VMDisplay extends EventEmitter {
|
||||||
Connect(): void;
|
Connect(): void;
|
||||||
Disconnect(): void;
|
Disconnect(): void;
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ import { VMDisplay } from './interface.js';
|
|||||||
|
|
||||||
import { Size, Rect } from '../Utilities.js';
|
import { Size, Rect } from '../Utilities.js';
|
||||||
|
|
||||||
const kQemuFps = 60;
|
// the FPS to run the VNC client at
|
||||||
|
// This only affects internal polling,
|
||||||
|
// if the VNC itself is sending updates at a slower rate
|
||||||
|
// the display will be at that slower rate
|
||||||
|
const kVncBaseFramerate = 60;
|
||||||
|
|
||||||
export type VncRect = {
|
export type VncRect = {
|
||||||
x: number;
|
x: number;
|
||||||
@@ -15,17 +19,13 @@ export type VncRect = {
|
|||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
// events:
|
|
||||||
//
|
|
||||||
// 'resize' -> (w, h) -> done when resize occurs
|
|
||||||
// 'rect' -> (x, y, ImageData) -> framebuffer
|
|
||||||
// 'frame' -> () -> done at end of frame
|
|
||||||
|
|
||||||
// TODO: replace with a non-asshole VNC client
|
// TODO: replace with a non-asshole VNC client (prefably one implemented
|
||||||
|
// as a part of cvm-rs)
|
||||||
export class VncDisplay extends EventEmitter implements VMDisplay {
|
export class VncDisplay extends EventEmitter implements VMDisplay {
|
||||||
private displayVnc = new VncClient({
|
private displayVnc = new VncClient({
|
||||||
debug: false,
|
debug: false,
|
||||||
fps: kQemuFps,
|
fps: kVncBaseFramerate,
|
||||||
|
|
||||||
encodings: [
|
encodings: [
|
||||||
VncClient.consts.encodings.raw,
|
VncClient.consts.encodings.raw,
|
||||||
@@ -64,12 +64,9 @@ export class VncDisplay extends EventEmitter implements VMDisplay {
|
|||||||
this.displayVnc.on('firstFrameUpdate', () => {
|
this.displayVnc.on('firstFrameUpdate', () => {
|
||||||
// apparently this library is this good.
|
// apparently this library is this good.
|
||||||
// at least it's better than the two others which exist.
|
// at least it's better than the two others which exist.
|
||||||
this.displayVnc.changeFps(kQemuFps);
|
this.displayVnc.changeFps(kVncBaseFramerate);
|
||||||
this.emit('connected');
|
this.emit('connected');
|
||||||
|
|
||||||
this.emit('resize', { width: this.displayVnc.clientWidth, height: this.displayVnc.clientHeight });
|
this.emit('resize', { width: this.displayVnc.clientWidth, height: this.displayVnc.clientHeight });
|
||||||
//this.emit('rect', { x: 0, y: 0, width: this.displayVnc.clientWidth, height: this.displayVnc.clientHeight });
|
|
||||||
this.emit('frame');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.displayVnc.on('desktopSizeChanged', (size: Size) => {
|
this.displayVnc.on('desktopSizeChanged', (size: Size) => {
|
||||||
|
|||||||
10
yarn.lock
10
yarn.lock
@@ -41,13 +41,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@computernewb/superqemu@npm:0.2.4-alpha0":
|
"@computernewb/superqemu@npm:0.2.4":
|
||||||
version: 0.2.4-alpha0
|
version: 0.2.4
|
||||||
resolution: "@computernewb/superqemu@npm:0.2.4-alpha0"
|
resolution: "@computernewb/superqemu@npm:0.2.4"
|
||||||
dependencies:
|
dependencies:
|
||||||
execa: "npm:^8.0.1"
|
execa: "npm:^8.0.1"
|
||||||
pino: "npm:^9.3.1"
|
pino: "npm:^9.3.1"
|
||||||
checksum: 10c0/ac002c2da734db0fc8823a4ae6c7361ef9cf2aa15fd0345376163ddd1f124654fd8d7576c3e9831ec57f6c41263683c3684e31db8066c31cff9abfc7a55a7346
|
checksum: 10c0/9ed3190bd95c60a6f74fbb6d29cbd9909ff18b04d64b5a09c02dec91169304f439d7b0ac91848b69621066810cdfef4a0dbf97075938ee40b3aebd74376b4440
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ __metadata:
|
|||||||
resolution: "@cvmts/cvmts@workspace:cvmts"
|
resolution: "@cvmts/cvmts@workspace:cvmts"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@computernewb/nodejs-rfb": "npm:^0.3.0"
|
"@computernewb/nodejs-rfb": "npm:^0.3.0"
|
||||||
"@computernewb/superqemu": "npm:0.2.4-alpha0"
|
"@computernewb/superqemu": "npm:0.2.4"
|
||||||
"@cvmts/cvm-rs": "npm:*"
|
"@cvmts/cvm-rs": "npm:*"
|
||||||
"@maxmind/geoip2-node": "npm:^5.0.0"
|
"@maxmind/geoip2-node": "npm:^5.0.0"
|
||||||
"@types/node": "npm:^20.12.5"
|
"@types/node": "npm:^20.12.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user