Commit Graph
61 Commits
Author SHA1 Message Date
modeco80 199924ff92 cvmts: rate limit the 'sync' instruction
the original Guacamole code did this too I'm pretty sure, and it was even more aggressive about it.
2024-10-05 05:00:52 -04:00
modeco80 41ee71f053 cvmts: Add staff audit logging support
Basically what it says on the tin.

More staff operations should probably be audited, but for now this provides a good starting point.
2024-09-21 21:14:27 -04:00
modeco80 072fd06918 cvmts: fix display event handler duplication
By only adding event handlers when the display is first lazily initalized.
2024-09-19 04:11:25 -04:00
modeco80 210e36f430 cvmts: fix memory leak
javascript blows chunks
2024-09-12 13:11:12 -04:00
modeco80 9d57779c75 fix config error logging so pino actually logs the Error object 2024-09-09 22:39:01 -04:00
modeco80 689be9d395 cvmts: Explicitly disable ws PMD/tracking
Seems to fix or at least make a pretty bad memory leak much slower.

I hate ws but the only other library is written by someone who isn't
a very nice person (putting it on the nice side)
2024-09-05 04:15:19 -04:00
modeco80 fae4c6d146 cvmts: Fix WebSocket errors causing process crashes 2024-08-30 20:30:17 -04:00
LilyandGitHub 3c4ddb72b8 Merge pull request #30 from computernewb/dev/better_display
merge better display branch
2024-08-23 10:04:19 -04:00
modeco80 338cc6e824 clean up some stuff and upgrade to the latest superqemu release 2024-08-23 10:01:41 -04:00
modeco80 b66810a227 it is nullable now so this comment doesn't make sense anymore 2024-08-23 07:29:32 -04:00
modeco80 e839f7f5aa better display/vm stuff
- moved superqemu's "QemuDisplay" here; the VNC VM and Qemu both share it (and it has been renamed to a less goofy dumb name)

- VNC VM has been heavily refactored to just use the VNC display we have (this means only one source of truth, less bugs, and it's generally just Better to share the code imho). this means that future plans to abstract this further (or implement the client in cvm-rs in general) won't cause any explosions, or require duplicate effort

- vms are now in src/vm/... just better organization

- superqemu doesn't manage a display anymore (or care about it, other than making sure the socket is unlinked on stop). Instead now it provides info for us to setup our own VNC client. This is also why we provide our own shim interface

This currently relies on a alpha version of superqemu.

Before this is merged into cvmts main I will publish a stable tag and point cvmts to that new version
2024-08-23 07:26:23 -04:00
modeco80 7d9fab2485 cvm-rs: don't leave reference to input buffer live
i think this was causing it to not be freed because we were holding a live reference (to NAPI/node/v8 side of things) even after we were done so the input buffer just never got freed from the buffer pool
2024-08-23 04:39:23 -04:00
modeco80 17191b0917 cvm-rs: version 0.2.0
- switch to napi-rs. this mostly affects only the backend side of things, but IMO napi-rs is better (also, way less boilerplate is needed compared to neon).

- jpeg encoding no longer clones the input buffer internally (or wraps it in a Mutex as well), thanks to napi-rs not sucking in this regard. this is *probably* a micro-optimization, but will make it easier to later on do parallel encoding of all rectangles

- guac encoding is weird. This is kind of a painpoint of napi-rs but it's bearable
2024-08-20 06:14:08 -04:00
modeco80 55566fbd3a cvm-rs: Switch thread pool to rayon
Much less underhanded than using an IO library's capability to do so. Also, rayon will make encoding multiple jpegs in parallel *much* easier.

tbh if i do that I may also switch to napi-rs, it seems a bit less painful and supports much more async shenigans.

(Also, it will actually bind classes properly... something Neon really sucks at unless you look at strange documentation.)
2024-08-20 04:11:29 -04:00
modeco80 a521f4c873 Queue rect updates for each frame (and.. maybe? do rects in parallel)
both superqemu and vncvm have supported this but I never did it for some reason. its noticably faster than before. testing seems to imply that its actually slightly faster without the batcher enabled (maybe because it's actually able to split the work now if I had to guess)
2024-08-20 01:05:44 -04:00
modeco80 432e75d42a cvmts: Use npm versions of superqemu/nodejs-rfb.
We publish them now, so let's use them in cvmts!

Additionally, this removes the 'shared' module entirely, since it has little purpose anymore. The logger is replaced with pino (because superqemu uses pino for logging itself).
2024-07-16 08:29:52 -04:00
modeco80 cf9f11819e qemu: remove more dead code
Not sure how I missed this.
2024-07-16 07:02:20 -04:00
modeco80 b9b0aa91df qemu: remove the last sleep call
Finally, no more hacky sleep calls are left. Woohoo. This was already
effectively done by the previous commit, but now that I know it works,
I've removed the test path entirely
2024-07-16 06:43:20 -04:00
modeco80 6a4c1e6ac2 qemu: Make sure stdin is open before writing
oops. Not sure how I didn't think of that.
2024-07-16 06:35:58 -04:00
modeco80 7413059193 qemu: Switch to QMP over stdio
Simply a more convinent pipe. Additionally, because the pipe will only break when the process exits,
this means we can now remove QMP reconnection logic entirely. Can't exactly have problems
when the problem code is factored out ;)
2024-07-14 19:04:19 -04:00
modeco80 e28bb3a9d7 remove connect/view gating (for now) 2024-07-11 20:49:49 -04:00
modeco80 ddf4d97511 qemu: more refactoring
qmp client is now much more robust (and doesn't fight over itself as much). this should
hopefully completely eliminate the case where display connects but qmp is half connected.

i also forgot QemuDisplay actually emits an event on connection, so we can just use that to
wait for when the display connects. which allows us to set the started state there instead of praying
when the qmp client connects that we are connected to the display roughly at the same time.

i also gated some stuff to require vm state in the server. this is a bit rickity, but does seem to work.
2024-07-11 20:33:50 -04:00
modeco80 7423c62957 re-add magic timeouts
also remove a problematic line that broke more than it helped
2024-07-11 03:39:00 -04:00
modeco80 25b32b23b7 qemu: More fun refactoring
The QMP client has been refactored slightly, mostly just to clean up its
edges slightly.

QemuVM however has seen a big refactor, especially connecting to QMP.
Flattening out this logic is something I should have done a long time ago.

This seemingly has finally hammered out the bugs, although time will tell.
2024-07-11 03:24:22 -04:00
modeco80 0b59c6d8be QMP client now buffers lines properly 2024-07-11 02:29:26 -04:00
modeco80 227a171110 qemu: Completely rewrite QMP client from scratch
It sucked. The new one is using Sans I/O principles, so it does not
directly do I/O or talk to a net.Socket directly (instead, QemuVM implements
the layer to do I/O). This means in the future this library could actually
be tested, but for now, I'm not bothering with that.

There's also some other cleanups that were bothering me.
2024-07-10 22:20:12 -04:00
modeco80 048f08b00b actually make vm swich displays properly or whatever 2024-07-10 18:43:35 -04:00
modeco80 bee25b5381 Fix the ability for IPData refcount to go negative 2024-07-10 18:32:05 -04:00
modeco80 8369de53ba qemu: log QEMU stderr as logger messages
Mostly for nicity, but also to make debugging start errors an actual possibility.
2024-06-23 02:56:17 -04:00
modeco80 2cc2c6ddf2 cvmts: "fix" panics in cvm-rs 2024-06-23 02:55:05 -04:00
modeco80 0df56cb5a4 qemu: cleanup/fix reset 2024-06-23 02:40:13 -04:00
modeco80 286f3eec62 cvm-rs: Actually throw Error on guac decode errors
we were throwing String or something before..
2024-06-23 02:11:23 -04:00
modeco80 183b17194e chore(README): cargo is usually a default part of a complete Rust toolchain so just specify "A Rust toolchain" 2024-06-22 21:46:37 -04:00
modeco80 dda72cad91 cvmts: quth => auth 2024-06-22 21:27:28 -04:00
modeco80 09d41617ed prettier reformat for merge (and remove jpeg-turbo Again) 2024-06-22 21:26:49 -04:00
modeco80 b8ed177885 cvm-rs: merge guac and jpeg libs together into one
doesn't really need to be two seperate libraries. also preperation for other funnies

the build script has been replaced with a much saner justfile which uses much saner "yarn workspace" invocations instead of blindly cding all over the place
2024-06-22 21:14:05 -04:00
modeco80 87a377a10f cvmts: replace jpeg-turbo native module with new rust module
This module also does threadpooling internally, so we don't need Piscina anymore (which I'm pretty sure was actually bottlenecking.)
2024-06-20 03:20:56 -04:00
modeco80 39521a4b1d misc stuff from production
(also refactors qemu a bit)
2024-06-19 23:30:29 -04:00
modeco80 97de887518 cvmts: Actually unref ipdata on disconnect 2024-06-19 18:26:27 -04:00
modeco80 fa23aa7432 cvmts: nope I have to fix it properly 2024-06-19 18:20:41 -04:00
modeco80 e798ff5c86 bandaid fix time 2024-06-19 18:16:16 -04:00
modeco80 0d34bb1c8e cvmts/qemu: support snapshots properly 2024-06-19 18:03:10 -04:00
modeco80 b485e7f689 cvmts: reimplement connection limit using ipdata 2024-06-19 17:56:55 -04:00
modeco80 ba8743f461 guac-rs: remove commented dead code
gits a SCM.
2024-06-19 02:34:38 -04:00
modeco80 b342d4874f remove license cargo key 2024-06-19 02:14:57 -04:00
modeco80 eefde464b4 why is yarn so picky 2024-06-19 01:49:12 -04:00
modeco80 d9ee611bc5 guac-rs: reformat im stupid 2024-06-19 01:37:17 -04:00
modeco80 4e50106585 cvmts: replace guacamole decoder with a node native module written in rust 2024-06-19 01:36:07 -04:00
modeco80 173ee8149f auth: Make more resilant to backend failures 2024-05-26 16:33:35 -04:00
modeco80 e184bfb085 qemu: fix qmp disconnection semi properly
this is actually something i need to push to crusttest as well, because
this will affect it as well, though not as badly because it will only break certain buttons
2024-05-22 17:56:04 -04:00
modeco80andyellows111 2e05504e4a hastily hand merge yellowcode vote patch thing
Co-Authored-By: yellows111 <ice_ice@email.com>
2024-05-01 08:08:43 -04:00
modeco80 e03bf57ede .. ok, i guess one node buffer can't be moved but the other magically can. 2024-04-24 04:38:47 -04:00
modeco80 a904f26961 abstract jpeg encoding away from "WSServer"
Additionally make thumbnail encoding threadpooled as well, just so it (probably) doesn't block as much.
2024-04-24 04:18:05 -04:00
modeco80 ddae307874 chore: reformat all code with prettier 2024-04-24 03:50:17 -04:00
modeco80 bcbf7db8d9 misc patches done to get everything to play ball
also adds editorconfig
2024-04-24 03:41:32 -04:00
modeco80 db97a62046 move jpeg encoding to a worker thread pool
this also switches cvmts back to building with tsc, mostly because
I couldn't get parcel's worker interop to work at all.
2024-04-23 19:43:42 -04:00
modeco80 59d5331b68 replace dirname with a hack that should behave like before
the '@ts-expect-error' is to silence tsc just in case, since this function does in fact exist during bundling. techinically the real solution would be to declare it but /shrug
2024-04-23 10:42:36 -04:00
modeco80 cb297e15c4 Giant refactoring (or at least the start)
In short:
- cvmts is now bundled/built via parcel and inside of a npm/yarn workspace with multiple nodejs projects
- cvmts now uses the crusttest QEMU management and RFB library (or a fork, if you so prefer).
- cvmts does NOT use node-canvas anymore, instead we opt for the same route crusttest took and just encode jpegs ourselves from the RFB provoded framebuffer via jpeg-turbo. this means funnily enough sharp is back for more for thumbnails, but actually seems to WORK this time
- IPData is now managed in a very similar way to the original cvm 1.2 implementation where a central manager and reference count exist. tbh it wouldn't be that hard to implement multinode either, but for now, I'm not going to take much time on doing that.

this refactor is still incomplete. please do not treat it as generally available while it's not on the default branch. if you want to use it (and report bugs or send fixes) feel free to, but while it may "just work" in certain situations it may be very broken in others.

(yes, I know windows support is partially totaled by this; it's something that can and will be fixed)
2024-04-23 09:57:02 -04:00
modeco80 820ef05832 chore: Remove reference to "fs" dummy package
Not needed.

This will end up landing again anyways in a major refactoring job,
but for now I'm making the change here because it's a one line change.
2024-04-23 07:14:13 -04:00
modeco80 28dddfc363 fix registered users' ability to bypass automute
ditto... oops.
2024-04-22 08:40:25 -04:00
modeco80 1637614c74 fix QMP deadlock 2023-02-07 22:38:41 -05:00