From f4f7ed00d1e725b3e23a60e62e1da31d375d397e Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 3 Sep 2025 22:45:22 -0700 Subject: [PATCH] chore: add consistent options for IRC, HUB, & NRS addresses (#2746) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2746 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- README.md | 2 +- src/controllers/api/hubController.ts | 5 ++--- src/controllers/api/loginController.ts | 4 ++-- src/services/configService.ts | 5 ++++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 24e5f670..deee20bf 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ SpaceNinjaServer requires a `config.json`. To set it up, you can copy the [confi - `skipTutorial` affects only newly created accounts, so you may wish to change it before logging in for the first time. - `logger.level` can be `fatal`, `error`, `warn`, `info`, `http`, `debug`, or `trace`. -- `myIrcAddresses` can be used to point to an IRC server. If not provided, defaults to `[ myAddress ]`. +- `ircAddress`, `hubAddress`, and `nrsAddress` are not present by default but can be provided if these secondary servers are on a different machine. - `worldState.eidolonOverride` can be set to `day` or `night` to lock the time to day/fass and night/vome on Plains of Eidolon/Cambion Drift. - `worldState.vallisOverride` can be set to `warm` or `cold` to lock the temperature on Orb Vallis. - `worldState.duviriOverride` can be set to `joy`, `anger`, `envy`, `sorrow`, or `fear` to lock the Duviri spiral. diff --git a/src/controllers/api/hubController.ts b/src/controllers/api/hubController.ts index bc0129e5..998b04ea 100644 --- a/src/controllers/api/hubController.ts +++ b/src/controllers/api/hubController.ts @@ -1,7 +1,6 @@ import type { RequestHandler } from "express"; -import { getReflexiveAddress } from "../../services/configService.ts"; +import { config, getReflexiveAddress } from "../../services/configService.ts"; export const hubController: RequestHandler = (req, res) => { - const { myAddress } = getReflexiveAddress(req); - res.json(`hub ${myAddress}:6952`); + res.json(`hub ${config.hubAddress ?? getReflexiveAddress(req).myAddress}:6952`); }; diff --git a/src/controllers/api/loginController.ts b/src/controllers/api/loginController.ts index bff89eb7..d93a9229 100644 --- a/src/controllers/api/loginController.ts +++ b/src/controllers/api/loginController.ts @@ -95,11 +95,11 @@ const createLoginResponse = ( BuildLabel: buildLabel }; if (version_compare(buildLabel, "2015.02.13.10.41") >= 0) { - resp.NRS = [myAddress]; + resp.NRS = [config.nrsAddress ?? myAddress]; } if (version_compare(buildLabel, "2015.05.14.16.29") >= 0) { // U17 and up - resp.IRC = config.myIrcAddresses ?? [myAddress]; + resp.IRC = [config.ircAddress ?? myAddress]; } if (version_compare(buildLabel, "2018.11.08.14.45") >= 0) { // U24 and up diff --git a/src/services/configService.ts b/src/services/configService.ts index 4c8ed4ef..2c7c9e01 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -14,7 +14,9 @@ export interface IConfig { myAddress: string; httpPort?: number; httpsPort?: number; - myIrcAddresses?: string[]; + ircAddress?: string; + hubAddress?: string; + nrsAddress?: string; administratorNames?: string[]; autoCreateAccount?: boolean; skipTutorial?: boolean; @@ -84,6 +86,7 @@ export interface IConfig { export const configRemovedOptionsKeys = [ "NRS", + "myIrcAddresses", "skipAllDialogue", "infiniteCredits", "infinitePlatinum",