Added extra config to the WebSocket bot AllowIpAlias, which allows enabling of any IP to be used to host the WebSocket bot from

This commit is contained in:
zorua162 2023-11-19 13:43:32 +00:00
parent fd1009b43f
commit 1f4db70f8a
4 changed files with 2020 additions and 1993 deletions

View file

@ -287,13 +287,21 @@ public class WebSocketBot : ChatBot
[TomlInlineComment("$ChatBot.WebSocketBot.DebugMode$")]
public bool DebugMode = false;
[TomlInlineComment("$ChatBot.WebSocketBot.AllowIpAlias$")]
public bool AllowIpAlias = false;
}
public WebSocketBot()
{
_password = Config.Password;
_authenticatedSessions = new();
_waitingEvents = new();
var match = Regex.Match(Config.Ip!, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}");
if (!match.Success)
// If AllowIpAlias is set to true in the config, then always ignore this check
if (!match.Success & !Config.AllowIpAlias!)
{
LogToConsole(Translations.bot_WebSocketBot_failed_to_start_ip);
return;
@ -307,9 +315,6 @@ public class WebSocketBot : ChatBot
_ip = Config.Ip;
_port = Config.Port;
_password = Config.Password;
_authenticatedSessions = new();
_waitingEvents = new();
}
public override void Initialize()