Skip to content

Commit d96f9f7

Browse files
authored
Bugfix 2.0.1 (#144)
* chore: update project version to 2.0.1 * fix: make user creation CLI command await role setting Unable to add "admin" role for created user from cli #134 * chore: remove server telemetry configuration file * feat: add session-based WebSocket proxy upgrade handling Implement WebSocket upgrade handling with session-based validation: - Extract sessionId from the request URL - Check if sessionId exists and has a corresponding proxy - Return 404 if session is invalid - Proceed with proxy upgrade for valid sessions Server crashes when Minecraft has connected #135
1 parent 21131c1 commit d96f9f7

File tree

8 files changed

+17
-48
lines changed

8 files changed

+17
-48
lines changed

apps/backend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "backend",
33
"private": true,
4-
"version": "2.0.0",
4+
"version": "2.0.1",
55
"type": "module",
66
"exports": {
77
"./hc": {

apps/backend/src/cli.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ program
7979
displayName: credentials.username,
8080
username: credentials.username,
8181
})
82-
.then((result) => {
82+
.then(async (result) => {
8383
console.info("User created: ", result.user);
84-
setRole({ userId: result.user.id, role });
84+
await setRole({ userId: result.user.id, role });
8585
console.info("Role set: ", role);
8686
process.exit();
8787
})

apps/backend/src/modules/vm/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,17 @@ const server = serve({
8383
port: vmPort,
8484
createServer: createServer,
8585
});
86+
8687
server.on("upgrade", (req, socket, head) => {
88+
const urlParts = req.url?.split("/");
89+
const sessionId = urlParts?.[1];
90+
91+
if (!sessionId || !vmProxies.has(sessionId)) {
92+
socket.write("HTTP/1.1 404 Not Found\r\n\r\n");
93+
socket.destroy();
94+
return;
95+
}
96+
8797
proxy.upgrade(req, socket as nodeSocket, head);
8898
});
8999

apps/backend/src/serverTelemetry.ts

-41
This file was deleted.

apps/docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "docs",
33
"type": "module",
4-
"version": "2.0.0",
4+
"version": "2.0.1",
55
"scripts": {
66
"dev": "astro dev",
77
"start": "astro dev",

apps/frontend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "frontend",
33
"private": true,
4-
"version": "2.0.0",
4+
"version": "2.0.1",
55
"type": "module",
66
"scripts": {
77
"dev": "wireit",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tutoriallm",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"private": true,
55
"type": "module",
66
"packageManager": "[email protected]",

packages/extensions/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "extensions",
33
"private": true,
44
"type": "module",
5-
"version": "2.0.0",
5+
"version": "2.0.1",
66
"exports": {
77
".": "./dist/index.js"
88
},

0 commit comments

Comments
 (0)