add xat and fix qemu process bug

This commit is contained in:
Lily Tsuru 2024-04-02 10:45:53 -04:00
parent 16ddf23ff4
commit 126a6f6f56
3 changed files with 8 additions and 5 deletions

View file

@ -14,7 +14,7 @@ import { WebSocket } from 'ws';
import Queue from 'mnemonist/queue.js'; import Queue from 'mnemonist/queue.js';
// for the maximum socket.io experience // for the maximum socket.io experience
const kCanvasJpegQuality = 0.35; const kCanvasJpegQuality = 0.25;
class VMUser { class VMUser {
public connection: WebSocket; public connection: WebSocket;
@ -300,7 +300,7 @@ class VirtualMachine extends EventEmitter {
let buffer = canvas.toBuffer('image/jpeg', { quality: kCanvasJpegQuality }); let buffer = canvas.toBuffer('image/jpeg', { quality: kCanvasJpegQuality });
await self.BroadcastMessage((encoder: Shared.MessageEncoder) => { await self.BroadcastMessage((encoder: Shared.MessageEncoder) => {
encoder.Init(buffer.length + 4); encoder.Init(buffer.length + 8);
encoder.SetDisplayRectMessage(0, 0, buffer); encoder.SetDisplayRectMessage(0, 0, buffer);
return encoder.Finish(); return encoder.Finish();
}); });
@ -313,7 +313,7 @@ class VirtualMachine extends EventEmitter {
let buffer = canvas.toBuffer('image/jpeg', { quality: kCanvasJpegQuality }); let buffer = canvas.toBuffer('image/jpeg', { quality: kCanvasJpegQuality });
await this.BroadcastMessage((encoder: Shared.MessageEncoder) => { await this.BroadcastMessage((encoder: Shared.MessageEncoder) => {
encoder.Init(buffer.length + 4); encoder.Init(buffer.length + 8);
encoder.SetDisplayRectMessage(x, y, buffer); encoder.SetDisplayRectMessage(x, y, buffer);
return encoder.Finish(); return encoder.Finish();
}); });
@ -334,7 +334,7 @@ class VirtualMachine extends EventEmitter {
}); });
await user.SendMessage((encoder: Shared.MessageEncoder) => { await user.SendMessage((encoder: Shared.MessageEncoder) => {
encoder.Init(buffer.length + 4); encoder.Init(buffer.length + 8);
encoder.SetDisplayRectMessage(0, 0, buffer); encoder.SetDisplayRectMessage(0, 0, buffer);
return encoder.Finish(); return encoder.Finish();
}); });

View file

@ -89,7 +89,6 @@ export class QemuVM extends EventEmitter {
await this.DisconnectQmp(); await this.DisconnectQmp();
this.DisconnectDisplay(); this.DisconnectDisplay();
await this.StopQemu(); await this.StopQemu();
this.SetState(VMState.Stopped);
} }
async Reset() { async Reset() {
@ -192,6 +191,8 @@ export class QemuVM extends EventEmitter {
self.VMLog('QEMU exited with a non-zero exit code. This usually means an error in the command line. Stopping VM.'); self.VMLog('QEMU exited with a non-zero exit code. This usually means an error in the command line. Stopping VM.');
await self.Stop(); await self.Stop();
} }
} else {
this.SetState(VMState.Stopped);
} }
}); });
} }

View file

@ -27,6 +27,8 @@
To avoid misusage, we re-snapshot the computer every 15 minutes! <a href="TBD: Check cngit lol">[Source code]</a> To avoid misusage, we re-snapshot the computer every 15 minutes! <a href="TBD: Check cngit lol">[Source code]</a>
</p> </p>
<center><iframe src="https://xat.com/embed/chat.php#id=213019806&gn=computernewb" width="650" height="486" frameborder="0" scrolling="no"></iframe><br><small><a target="_BLANK" href="https://xat.com/web_gear/chat/embed.php?id=213019806&GroupName=computernewb">Get computernewb chat group</a> | <a target="_BLANK" href="https://xat.com/computernewb"> Go to computernewb website</a></small><br></center>
<p style="margin-top: 30px; text-align: center; font-size: 11px; color: #666;"><small>Not</small> Powered by <a href="http://socket.io">Socket.IO (Don't use this!!)</a></p> <p style="margin-top: 30px; text-align: center; font-size: 11px; color: #666;"><small>Not</small> Powered by <a href="http://socket.io">Socket.IO (Don't use this!!)</a></p>