diff --git a/src/homegames_root/HomegamesRoot.js b/src/homegames_root/HomegamesRoot.js index ce5c279f..dcc4be52 100644 --- a/src/homegames_root/HomegamesRoot.js +++ b/src/homegames_root/HomegamesRoot.js @@ -13,6 +13,8 @@ if (!process.env.SQUISH_PATH) { let { Asset, Game, GameNode, Colors, Shapes, ShapeUtils } = require(process.env.SQUISH_PATH); +const squishMap = require('../common/squish-map'); + const { animations, reportBug } = require('../common/util'); const PLAYER_SETTINGS = require('../common/player-settings.js'); @@ -687,7 +689,9 @@ class HomegamesRoot { const gamePath = localGames[key].versions[versionId].gamePath; const squishVersion = parseSquishVersion(gamePath); - process.env.SQUISH_PATH = require.resolve(`squish-${squishVersion}`); + + process.env.SQUISH_PATH = squishMap[squishVersion]; + const _class = require(gamePath); const _gameAssets = _class.metadata && _class.metadata().assets; diff --git a/src/util/homenames-helper.js b/src/util/homenames-helper.js index 3131d9ec..92e490dd 100644 --- a/src/util/homenames-helper.js +++ b/src/util/homenames-helper.js @@ -13,6 +13,8 @@ const { getConfigValue, getUserHash, log } = require('homegames-common'); const HTTPS_ENABLED = getConfigValue('HTTPS_ENABLED', false); +const DOMAIN_NAME = getConfigValue('DOMAIN_NAME', null); + const getLocalIP = () => { const ifaces = os.networkInterfaces(); let localIP; @@ -47,6 +49,7 @@ const makeGet = (path = '', headers = {}, username) => new Promise((resolve, rej // todo: fix getPublicIP().then(publicIp => { const host = HTTPS_ENABLED ? (getUserHash(publicIp) + '.homegames.link') : 'localhost'; + const host = HTTPS_ENABLED ? (DOMAIN_NAME || (getUserHash(publicIp) + '.homegames.link')) : 'localhost'; const base = `${protocol}://${host}:${getConfigValue('HOMENAMES_PORT')}`;//'http://localhost:' + getConfigValue('HOMENAMES_PORT'); (HTTPS_ENABLED ? https : http).get(`${base}${path}`, (res) => { let buf = ''; @@ -70,7 +73,7 @@ const makePost = (path, _payload, username) => new Promise((resolve, reject) => port = getConfigValue('HOMENAMES_PORT'); getPublicIP().then(publicIp => { - hostname = HTTPS_ENABLED ? (getUserHash(publicIp) + '.homegames.link') : 'localhost'; + hostname = HTTPS_ENABLED ? (DOMAIN_NAME || (getUserHash(publicIp) + '.homegames.link')) : 'localhost'; const headers = {}; diff --git a/src/util/socket.js b/src/util/socket.js index 0291e4ba..873c5349 100644 --- a/src/util/socket.js +++ b/src/util/socket.js @@ -22,6 +22,8 @@ const PERFORMANCE_PROFILING = getConfigValue('PERFORMANCE_PROFILING', false); const HOTLOAD_ENABLED = getConfigValue('HOTLOAD_ENABLED', false); const BEZEL_SIZE_Y = getConfigValue('BEZEL_SIZE_Y', 15); +const DOMAIN_NAME = getConfigValue('DOMAIN_NAME', null); + const getPublicIP = () => new Promise((resolve, reject) => { https.get(`https://api.homegames.io/ip`, (res) => { let buf = ''; @@ -254,7 +256,7 @@ const socketServer = (gameSession, port, cb = null, certPath = null, username = const requestedGame = jsonMessage.clientInfo && jsonMessage.clientInfo.requestedGame; const req = (certPath ? https : http).request({ - hostname: certPath ? (getUserHash(publicIp)+ '.homegames.link') : 'localhost', + hostname: certPath ? (DOMAIN_NAME || (getUserHash(publicIp)+ '.homegames.link')) : 'localhost', port: HOMENAMES_PORT, path: `/info/${ws.id}`, method: 'GET'