From 7637140aad0fd84813988c0fbfb33cc2cf14dc03 Mon Sep 17 00:00:00 2001 From: Zontreck Date: Wed, 17 Jun 2020 00:59:35 -0700 Subject: [PATCH] Modify some features --- Assembly/ASMInfo.cs | 4 ++-- BotSession.cs | 1 + CommandSystem/BaseHooks.cs | 5 ++++- ConfigSystem/MainConfiguration.cs | 2 ++ Program.cs | 8 +++++++- WebHookServer/WebHookServer.cs | 5 ++++- 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Assembly/ASMInfo.cs b/Assembly/ASMInfo.cs index 970874f..eaebc4f 100644 --- a/Assembly/ASMInfo.cs +++ b/Assembly/ASMInfo.cs @@ -6,7 +6,7 @@ using System.Reflection; [assembly: AssemblyCompany("ZNI")] [assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)] [assembly: AssemblyCopyright("© 2020 Tara Piccari")] -[assembly: AssemblyFileVersion("5.1.950")] +[assembly: AssemblyFileVersion("5.1.960")] [assembly: AssemblyDescription("Second Life Bot - BotCore5")] @@ -15,7 +15,7 @@ namespace Bot.Assemble public class ASMInfo { public static string BotName = "ZBotCore"; - public static string BotVer = "5.1.950"; + public static string BotVer = "5.1.960"; public static string GitPassword { get diff --git a/BotSession.cs b/BotSession.cs index 90c761e..91f64ac 100644 --- a/BotSession.cs +++ b/BotSession.cs @@ -46,5 +46,6 @@ namespace Bot public DateTime LaunchTime { get; set; } = DateTime.Now; + public bool WaitForFiveMinutes = false; } } diff --git a/CommandSystem/BaseHooks.cs b/CommandSystem/BaseHooks.cs index 7333957..00f6c4e 100644 --- a/CommandSystem/BaseHooks.cs +++ b/CommandSystem/BaseHooks.cs @@ -136,7 +136,10 @@ namespace Bot.CommandSystem [CommandGroup("bot.help", 0, 0, "Alias to !help", MessageHandler.Destinations.DEST_AGENT | MessageHandler.Destinations.DEST_LOCAL | MessageHandler.Destinations.DEST_GROUP)] public void PrintAllHelp(UUID client, int level, GridClient grid, string[] additionalArgs, MessageHandler.MessageHandleEvent MHE, MessageHandler.Destinations source, CommandRegistry registry, UUID agentKey, string agentName) { - MHE(source, client, $"All commands viewable at: https://{MainConfiguration.Instance.WebServerIP}:{MainConfiguration.Instance.WebServerPort}/help"); + if (MainConfiguration.Instance.UseSSL) + MHE(source, client, $"All commands viewable at: https://{MainConfiguration.Instance.WebServerIP}:{MainConfiguration.Instance.WebServerPort}/help"); + else + MHE(source, client, $"All commands viewable at: http://{MainConfiguration.Instance.WebServerIP}:{MainConfiguration.Instance.WebServerPort}/help"); } // !help "command" [CommandGroup("help", 0, 1, "Prints help for one command", MessageHandler.Destinations.DEST_AGENT | MessageHandler.Destinations.DEST_LOCAL | MessageHandler.Destinations.DEST_GROUP | MessageHandler.Destinations.DEST_CONSOLE_INFO)] diff --git a/ConfigSystem/MainConfiguration.cs b/ConfigSystem/MainConfiguration.cs index cdfcac5..2856555 100644 --- a/ConfigSystem/MainConfiguration.cs +++ b/ConfigSystem/MainConfiguration.cs @@ -62,6 +62,8 @@ namespace Bot public int WebServerPort { get; set; } = 35591; public string WebServerIP { get; set; } = "zontreck.dev"; + public bool UseSSL { get; set; } = false; + public Dictionary BotAdmins { get; set; } = new Dictionary(); public List AuthedGithubUsers { get; set; } = new List(); diff --git a/Program.cs b/Program.cs index b1c533a..3a61465 100644 --- a/Program.cs +++ b/Program.cs @@ -277,7 +277,7 @@ namespace Bot prompter.Start(); CM = new CommandManager(BotSession.Instance.Logger, client, MH.callbacks); - + MainConfiguration.Instance.Save(); // Flush the config, to update the file format while (g_iIsRunning) { @@ -576,6 +576,12 @@ namespace Bot client.Network.Logout(); } while (client.Network.Connected) { } + + if (BotSession.Instance.WaitForFiveMinutes) + { + AutoResetEvent are = new AutoResetEvent(false); + are.WaitOne(TimeSpan.FromMinutes(5)); + } Environment.Exit(0); //System.Console.WriteLine("PAUSING. PRESS ANY KEY TO EXIT"); diff --git a/WebHookServer/WebHookServer.cs b/WebHookServer/WebHookServer.cs index e6e6999..8f2239d 100644 --- a/WebHookServer/WebHookServer.cs +++ b/WebHookServer/WebHookServer.cs @@ -59,7 +59,10 @@ namespace Bot.WebHookServer { listener = new HttpListener(); MHEx = MH.callbacks; - listener.Prefixes.Add($"https://*:{MainConfiguration.Instance.WebServerPort}/"); + if (MainConfiguration.Instance.UseSSL) + listener.Prefixes.Add($"https://*:{MainConfiguration.Instance.WebServerPort}/"); + else + listener.Prefixes.Add($"http://*:{MainConfiguration.Instance.WebServerPort}/"); listener.Start(); var hc = new HookCmds();