From cc8b7f558dca3203cdefffb0987bf399b88e9cd4 Mon Sep 17 00:00:00 2001 From: anshggss Date: Mon, 29 Jun 2026 15:56:48 +0530 Subject: [PATCH] fix: added local k8s config file, changed client to integrate with the gateway and added cors support --- client/index.html | 77 +++++----- client/index.js | 281 ++++++++++++++++++++++++------------ gateway/bun.lock | 8 + gateway/index.ts | 12 ++ gateway/package.json | 2 + gateway/routes/addToRoom.ts | 12 +- k8s.local.yaml | 75 ++++++++++ k8s.yaml | 9 +- server-manager/bun.lock | 12 ++ server-manager/index.ts | 6 + server-manager/package.json | 2 + 11 files changed, 353 insertions(+), 143 deletions(-) create mode 100644 k8s.local.yaml diff --git a/client/index.html b/client/index.html index 1f2bc16..333249f 100644 --- a/client/index.html +++ b/client/index.html @@ -1,69 +1,74 @@ - + + Box Game - - + + +
-
-

Box Game

-

Jump, collect hearts, beat your friends.

+
+

Box Game

+

Jump, collect hearts, beat your friends.

- - + + -
choose a room
+
choose a room
- - + + - -
- - -
+ +
+ + +
-

-
+

+
- + + + - + + diff --git a/client/index.js b/client/index.js index 2ce0173..2d02a8f 100644 --- a/client/index.js +++ b/client/index.js @@ -1,17 +1,13 @@ -// ============== SOCKET CONNECTION ============== -// Points to local server; update to production URL when deploying -const _host = window.location.hostname; -const SERVER_URL = - _host === "" || _host === "localhost" || _host === "127.0.0.1" - ? "http://localhost:3000" - : "https://server.boxgame.shadyggs.xyz"; - -const socket = io(SERVER_URL, { - reconnectionDelay: 1000, - reconnectionDelayMax: 5000, - transports: ["websocket"], - autoConnect: true, -}); +// ============== CONFIG ============== +// GATEWAY_URL is injected by index.html as a