Skip to content

Commit

Permalink
bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
prosif committed May 27, 2024
1 parent c8e5344 commit 67dffa1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/homegames_root/HomegamesRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;

Expand Down
5 changes: 4 additions & 1 deletion src/util/homenames-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 = '';
Expand All @@ -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 = {};

Expand Down
4 changes: 3 additions & 1 deletion src/util/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 67dffa1

Please sign in to comment.