summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-09-02 18:00:28 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-09-02 18:00:28 -0600
commitc370d02ed7c705fc8352ec3aac6c3d82091fb5ce (patch)
tree9cbccd4feabc9e845066ab3194796be43f799e86
parent19bea535ece0b76a640ab24f69a05ed61f4d9670 (diff)
downloadjumpstorm-c370d02ed7c705fc8352ec3aac6c3d82091fb5ce.tar.gz
jumpstorm-c370d02ed7c705fc8352ec3aac6c3d82091fb5ce.zip
update port & host
-rw-r--r--docker-compose.yml2
-rw-r--r--server/src/constants.ts1
-rw-r--r--server/src/server.ts7
3 files changed, 6 insertions, 4 deletions
diff --git a/docker-compose.yml b/docker-compose.yml
index e3f8865..a9cfdb8 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -7,7 +7,7 @@ services:
networks:
- webapp
ports:
- - 1337:80
+ - 28303:80
restart: always
container_name: jumpstorm-client
hostname: client
diff --git a/server/src/constants.ts b/server/src/constants.ts
index 2968d3a..11b8c75 100644
--- a/server/src/constants.ts
+++ b/server/src/constants.ts
@@ -1,4 +1,5 @@
export namespace Constants {
+ export const HOST = '0.0.0.0';
export const SERVER_PORT = 8080;
export const SERVER_TICK_RATE = (1 / 120) * 1000;
export const GAME_TOPIC = 'game';
diff --git a/server/src/server.ts b/server/src/server.ts
index 3beebd5..f28c80f 100644
--- a/server/src/server.ts
+++ b/server/src/server.ts
@@ -38,6 +38,7 @@ export class GameServer {
public serve() {
if (!this.server)
this.server = Bun.serve<SessionData>({
+ host: Constants.HOST,
port: Constants.SERVER_PORT,
fetch: (req, srv) => this.fetchHandler(req, srv),
websocket: {
@@ -137,7 +138,7 @@ export class GameServer {
const headers = new Headers();
headers.set('Access-Control-Allow-Origin', '*');
- if (url.pathname == '/assign') {
+ if (url.pathname === '/api/assign') {
if (this.sessionManager.numSessions() > Constants.MAX_PLAYERS)
return new Response('too many players', { headers, status: 400 });
@@ -154,7 +155,7 @@ export class GameServer {
const sessionId = cookie.split(';').at(0)!.split('SessionId=').at(1);
- if (url.pathname == '/game') {
+ if (url.pathname === '/api/game') {
server.upgrade(req, {
headers,
data: {
@@ -165,7 +166,7 @@ export class GameServer {
return new Response('upgraded to ws', { headers });
}
- if (url.pathname == '/me') {
+ if (url.pathname === '/api/me') {
return new Response(sessionId, { headers });
}