Просмотр исходного кода

Merge branch 'feature/config' into beta

Daniel Gibbs 9 лет назад
Родитель
Сommit
f954c0c5f3

+ 4 - 0
lgsm/config-default/config-lgsm/arkserver/_default.cfg

@@ -34,6 +34,10 @@ pushbulletalert="off"
 pushbullettoken="accesstoken"
 channeltag=""
 
+# Discord Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Discord
+discordalert="off"
+discordwebhook="https://discordapp.com/api/webhooks/12345/abcd12345"
+
 ## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
 updateonstart="off"
 

+ 6 - 1
lgsm/config-default/config-lgsm/insserver/_default.cfg

@@ -18,9 +18,14 @@ maxplayers="16"
 tickrate="64"
 workshop="0"
 
+## Optional: Game Server Login Token
+# GSLT can be used for running a public server.
+# More info: https://gameservermanagers.com/gslt
+gslt=""
+
 ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
 fn_parms(){
-parms="-game insurgency -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers} +sv_workshop_enabled ${workshop} -norestart"
+parms="-game insurgency -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} -tickrate ${tickrate} +sv_setsteamaccount ${gslt} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers} +sv_workshop_enabled ${workshop} -norestart"
 }
 
 #### LinuxGSM Settings ####

+ 11 - 1
lgsm/functions/alert.sh

@@ -67,4 +67,14 @@ elif [ "${pushbulletalert}" != "on" ]&&[ "${function_selfname}" == "command_test
 elif [ -z "${pushbullettoken}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
 	fn_print_error_nl "Pushbullet token not set"
 	fn_script_error_warn "Pushbullet token not set"
-fi
+fi
+
+if [ "${discordalert}" == "on" ]&&[ -n "${discordalert}" ]; then
+	alert_discord.sh
+elif [ "${discordalert}" != "on" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+	fn_print_warn_nl "Discord alerts not enabled"
+	fn_script_log_warn "Discord alerts not enabled"
+elif [ -z "${discordalert}" ]&&[ "${function_selfname}" == "command_test_alert.sh" ]; then
+	fn_print_error_nl "Discord token not set"
+	fn_script_error_warn "Discord token not set"
+fi

+ 20 - 0
lgsm/functions/alert_discord.sh

@@ -0,0 +1,20 @@
+#!/bin/bash
+# LinuxGSM alert_discord.sh function
+# Author: Daniel Gibbs
+# Contributor: faflfama
+# Website: https://gameservermanagers.com
+# Description: Sends Discord alert including the server status.
+
+if [ "$1" == "" ]; then  echo "missing message"; exit; fi
+prefix='{"content":"'
+postfix='","file":"content","embed":"content"}'
+echo "$prefix $1 $postfix" >f
+curl -v -X POST --data @f "${discordwebhook}"
+
+#if [ "${discordsend}" == "invalid_access_token" ]; then
+#	fn_print_fail_nl "Sending Discord alert: invalid_access_token"
+#	fn_script_log_fatal "Sending Discord alert: invalid_access_token"
+#else
+#	fn_print_ok_nl "Sending Discord alert"
+#	fn_script_log_pass "Sent Discord alert"
+#fi

+ 2 - 2
lgsm/functions/mods_core.sh

@@ -30,7 +30,7 @@ fn_mod_install_files(){
 	if [ ! -d "${extractdir}" ]; then
 		mkdir -p "${extractdir}"
 	fi
-	fn_dl_extract "${modstmpdir}" "${filename}" "${extractdir}"
+	fn_dl_extract "${modstmpdir}" "${modfilename}" "${extractdir}"
 }
 
 # Convert mod files to lowercase if needed
@@ -228,7 +228,7 @@ fn_mods_installed_list(){
 		# Increment line check
 		((installedmodsline++))
 	done
-	if [ -n "${installedmodscount}" ] ; then
+	if [ -n "${installedmodscount}" ]; then
 		fn_script_log_info "${installedmodscount} addons/mods are currently installed"
 	fi
 }