LinuxGSM icon indicating copy to clipboard operation
LinuxGSM copied to clipboard

[BUG] Wrong port value in sfserver alerts in discord

Open shalak opened this issue 2 years ago • 5 comments

User Story

As a sfserver user, I want queryport to be used in discord alerts.

Basic info

  • Distro: N/A
  • Game: [Satisfactory]
  • Command: [N/A]
  • LinuxGSM version: [v21.5.0]

Further Information

The alerts on discord are printing port, which for satisfactory is not the port a player should use in their game client (that one being queryport).

Expected behaviour

With default sfserver config values, I should see 15777 instead of 7777 in the alert below: image

shalak avatar Jan 26 '22 19:01 shalak

The issue originales from the naming convention that Satisfactory uses.

The simplest solution, would be something like this:

diff --git a/lgsm/config-default/config-lgsm/sfserver/_default.cfg b/lgsm/config-default/config-lgsm/sfserver/_default.cfg
index 45ca1151..7fc3d39f 100644
--- a/lgsm/config-default/config-lgsm/sfserver/_default.cfg
+++ b/lgsm/config-default/config-lgsm/sfserver/_default.cfg
@@ -10,12 +10,12 @@
 
 ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
 ip="0.0.0.0"
-queryport="15777"
+port="15777"
 beaconport="15000"
-port="7777"
+gameport="7777"
 
 ## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
-startparameters="FactoryGame -multihome=${ip} -ServerQueryPort=${queryport} -BeaconPort=${beaconport} -Port=${port} -log -unattended"
+startparameters="FactoryGame -multihome=${ip} -ServerQueryPort=${port} -BeaconPort=${beaconport} -Port=${gameport} -log -unattended"
 
 #### LinuxGSM Settings ####
 

Unfortunately, this introduces inconsistency, because now parameter names would not reflect the variable names, which may be confusing.

Alternatively, there could be a completely new variable introduced, just for alert messages:

diff --git a/lgsm/config-default/config-lgsm/sfserver/_default.cfg b/lgsm/config-default/config-lgsm/sfserver/_default.cfg
index 45ca1151..75672fe7 100644
--- a/lgsm/config-default/config-lgsm/sfserver/_default.cfg
+++ b/lgsm/config-default/config-lgsm/sfserver/_default.cfg
@@ -37,6 +37,7 @@ postalert="off"
 # Discord Alerts | https://docs.linuxgsm.com/alerts/discord
 discordalert="off"
 discordwebhook="webhook"
+gameclientport=${queryport}
 
 # Email Alerts | https://docs.linuxgsm.com/alerts/email
 emailalert="off"
diff --git a/lgsm/functions/alert_discord.sh b/lgsm/functions/alert_discord.sh
index 9db56da3..1e83b4a4 100755
--- a/lgsm/functions/alert_discord.sh
+++ b/lgsm/functions/alert_discord.sh
@@ -31,7 +31,7 @@ json=$(cat <<EOF
 			},
 			{
 				"name": "Server IP",
-				"value": "[${alertip}:${port}](https://www.gametracker.com/server_info/${alertip}:${port})",
+				"value": "[${alertip}:${gameclientport:-${port}}](https://www.gametracker.com/server_info/${alertip}:${gameclientport:-${port}})",
 				"inline": true
 			},
 			{

But that, as I understand, won't make sense for gametracker service...

As a sidenote, I believe a user should be able to disable the overall gametracker link embedding above, as it exposes a risk of leaking a private server's address.

shalak avatar Jan 26 '22 19:01 shalak

I can confirm this unusual behavior. Others servers you would enter the gameport to connect to in the game server browser. However it this instance you connect to the query port.

Since this is different from every other game I am unsure on how best to adapt it currently. There might have to be a connectport variable added for these sorts of issues

dgibbs64 avatar Jan 26 '22 21:01 dgibbs64

Hi, any news about this?

Just asking, because this it's a low priority.

vinanrra avatar Dec 20 '23 20:12 vinanrra

I can confirm this unusual behavior. Others servers you would enter the gameport to connect to in the game server browser. However it this instance you connect to the query port.

Since this is different from every other game I am unsure on how best to adapt it currently. There might have to be a connectport variable added for these sorts of issues

maybe in alerts have a check like if{sfserver) { code goes here }

johnoclockdk avatar Dec 24 '23 12:12 johnoclockdk

Or maybe set the port at the config and if set don't use the default maybe?

vinanrra avatar Dec 24 '23 12:12 vinanrra