From d60cdb6be266b09e537216c343378f678338528f Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 12 Apr 2024 09:27:15 +0100 Subject: [PATCH] Separate out address used by backend to assist with users who have locked down local machines and cannot connect to a local http server Remove unsed ip/port property assignment on server start that wasn't used anywhere --- project/assets/configs/http.json | 2 ++ project/src/helpers/HttpServerHelper.ts | 4 ++-- project/src/models/spt/config/IHttpConfig.ts | 6 +++++- project/src/servers/HttpServer.ts | 3 --- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/project/assets/configs/http.json b/project/assets/configs/http.json index 97892786..a6defa80 100644 --- a/project/assets/configs/http.json +++ b/project/assets/configs/http.json @@ -1,6 +1,8 @@ { "ip": "127.0.0.1", "port": 6969, + "backendIp": "127.0.0.1", + "backendPort": 6969, "webSocketPingDelayMs": 90000, "logRequests": true, "serverImagePathOverride": {} diff --git a/project/src/helpers/HttpServerHelper.ts b/project/src/helpers/HttpServerHelper.ts index d647c047..e0f6cadc 100644 --- a/project/src/helpers/HttpServerHelper.ts +++ b/project/src/helpers/HttpServerHelper.ts @@ -32,12 +32,12 @@ export class HttpServerHelper } /** - * Combine ip and port into url + * Combine ip and port into address * @returns url */ public buildUrl(): string { - return `${this.httpConfig.ip}:${this.httpConfig.port}`; + return `${this.httpConfig.backendIp}:${this.httpConfig.backendPort}`; } /** diff --git a/project/src/models/spt/config/IHttpConfig.ts b/project/src/models/spt/config/IHttpConfig.ts index e1ddb9d5..f1130624 100644 --- a/project/src/models/spt/config/IHttpConfig.ts +++ b/project/src/models/spt/config/IHttpConfig.ts @@ -2,10 +2,14 @@ import { IBaseConfig } from "@spt-aki/models/spt/config/IBaseConfig"; export interface IHttpConfig extends IBaseConfig { - webSocketPingDelayMs: number; kind: "aki-http"; + /** Address used by webserver */ ip: string; port: number; + /** Address used by game client to connect to */ + backendIp: string; + backendPort: string; + webSocketPingDelayMs: number; logRequests: boolean; /** e.g. "Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png": "Aki_Data/Server/images/traders/NewTraderImage.png" */ serverImagePathOverride: Record; diff --git a/project/src/servers/HttpServer.ts b/project/src/servers/HttpServer.ts index 421c7ae4..1adf92c6 100644 --- a/project/src/servers/HttpServer.ts +++ b/project/src/servers/HttpServer.ts @@ -45,9 +45,6 @@ export class HttpServer this.handleRequest(req, res); }); - this.databaseServer.getTables().server.ip = this.httpConfig.ip; - this.databaseServer.getTables().server.port = this.httpConfig.port; - /* Config server to listen on a port */ httpServer.listen(this.httpConfig.port, this.httpConfig.ip, () => {