From 95c778f254e4f74a8e1f75186f95b2ad16fcea2d Mon Sep 17 00:00:00 2001 From: Tau Date: Fri, 1 Mar 2019 18:52:33 -0500 Subject: [PATCH] startup: Add port map based on game type Ugly mechanism but whatever. Send different games to different ports so that we can set up independent Express instances tailored to each game's weird HTTP quirks. --- src/startup.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/startup.js b/src/startup.js index b634be4..bd4f4d0 100644 --- a/src/startup.js +++ b/src/startup.js @@ -4,6 +4,10 @@ const express = require('express') const zlib = require('zlib') const os = require('os') +const services = new Map(); + +services.set("SDBT", 9000); // Chunithm + function decodeRequest(req) { const buf = Buffer.from(req, 'base64') const bytes = zlib.unzipSync(buf) @@ -55,7 +59,7 @@ app.post('/sys/servlet/PowerOn', function (req, resp) { const respParams = { stat: 1, - uri: `http://${os.hostname()}:9000/`, + uri: `http://${os.hostname()}:${services.get(reqParams.game_id)}/`, host: '', place_id: '123', name: 'Name',