From 8b65bc41731036d776a1f097cca247eb2001eea9 Mon Sep 17 00:00:00 2001 From: Bitl Date: Fri, 10 Mar 2023 11:37:29 -0700 Subject: [PATCH] snapshot release --- Novetus/NovetusCore/Classes/INIFile.cs | 6 ++- Novetus/NovetusCore/Classes/WebProxy.cs | 52 +++++++------------ .../StorageAndFunctions/GlobalVars.cs | 1 - .../Forms/LauncherForm/LauncherFormShared.cs | 2 - .../LauncherFormStylishInterface.xaml.cs | 1 - .../NovetusLauncher/Forms/NovetusConsole.cs | 1 - changelog.txt | 10 ++-- consolehelp.txt | 1 + defaultaddons/novetusexts/webproxy/Asset.cs | 31 ++++++----- scripts/launcher/splashes.txt | 6 +++ 10 files changed, 57 insertions(+), 54 deletions(-) diff --git a/Novetus/NovetusCore/Classes/INIFile.cs b/Novetus/NovetusCore/Classes/INIFile.cs index 265bf1a..02598ba 100644 --- a/Novetus/NovetusCore/Classes/INIFile.cs +++ b/Novetus/NovetusCore/Classes/INIFile.cs @@ -29,7 +29,11 @@ namespace Novetus.Core public INIFile(string INIPath) { path = INIPath; - File.SetAttributes(path, FileAttributes.Normal); + + if (!File.Exists(path)) + { + File.Create(path).Close(); + } } /// /// Write Data to the INI File diff --git a/Novetus/NovetusCore/Classes/WebProxy.cs b/Novetus/NovetusCore/Classes/WebProxy.cs index 26cb5e2..caae2c0 100644 --- a/Novetus/NovetusCore/Classes/WebProxy.cs +++ b/Novetus/NovetusCore/Classes/WebProxy.cs @@ -35,6 +35,7 @@ namespace Novetus.Core public ExtensionManager Manager = new ExtensionManager(); private static readonly SemaphoreLocker _locker = new SemaphoreLocker(); public bool Started { get { return Server.ProxyRunning; } } + private int WebProxyPort = 61710; public void DoSetup() { @@ -45,7 +46,9 @@ namespace Novetus.Core "When enabling the web proxy, Novetus will locally create a certificate upon startup that ensures the proxy's functionality. Novetus will not send any user data to anyone, as everything involving the web proxy is entirely local to this computer.\n" + "If you have any issue connecting to other web sites, including Roblox, closing Novetus or typing 'proxy off' into Novetus' console will fix it in most instances.\n\n" + "Upon pressing 'Yes', Windows will ask you for permission to install the certificate.\n\n" + - "You can change this option at any time by typing 'proxy disable' or 'proxy on' in the Novetus console. This message will appear only once.\n"; + "You can change this option at any time by typing 'proxy disable' or 'proxy on' in the Novetus console.\n\n" + + "NOTE: The Web proxy feature requires an Internet connection to function properly.\n\n" + + "This message will appear only once.\n"; DialogResult result = MessageBox.Show(text, "Novetus - Web Proxy Opt-In", MessageBoxButtons.YesNo); @@ -87,8 +90,20 @@ namespace Novetus.Core Server.CertificateManager.RootCertificateIssuerName = "Novetus"; Server.CertificateManager.RootCertificateName = "Novetus Web Proxy"; Server.BeforeRequest += new AsyncEventHandler(OnRequest); - UpdateEndPoint(true); - Util.ConsolePrint("Web Proxy started on port " + GlobalVars.WebProxyPort, 3); + + end = new ExplicitProxyEndPoint(IPAddress.Any, WebProxyPort, true); + end.BeforeTunnelConnectRequest += new AsyncEventHandler(OnBeforeTunnelConnectRequest); + Server.AddEndPoint(end); + + Server.Start(); + + foreach(ProxyEndPoint endPoint in Server.ProxyEndPoints) + { + Server.SetAsSystemProxy(end, ProxyProtocolType.AllHttp); + } + + Util.ConsolePrint("Web Proxy started on port " + WebProxyPort, 3); + try { foreach (IExtension extension in Manager.GetExtensionList().ToArray()) @@ -110,35 +125,6 @@ namespace Novetus.Core } } - public void UpdateEndPoint(bool shouldRunServer = false, bool decrypt = true) - { - if (Server.ProxyEndPoints.Count > 0) - { - Server.RemoveEndPoint(end); - } - - GlobalVars.WebProxyPort = GlobalVars.UserConfiguration.RobloxPort + 1; - end = new ExplicitProxyEndPoint(IPAddress.Any, GlobalVars.WebProxyPort, decrypt); - end.BeforeTunnelConnectRequest += new AsyncEventHandler(OnBeforeTunnelConnectRequest); - Server.AddEndPoint(end); - - if (!Server.ProxyRunning && shouldRunServer) - { - Server.Start(); - } - - if (Server.ProxyRunning) - { - foreach (ProxyEndPoint endPoint in Server.ProxyEndPoints) - { - Server.SetAsSystemHttpProxy(end); - Server.SetAsSystemHttpsProxy(end); - } - } - - Util.ConsolePrint("Web Proxy Endpoint updated with port " + GlobalVars.WebProxyPort, 3); - } - private bool IsValidURL(HttpWebClient client) { string uri = client.Request.RequestUri.Host; @@ -253,7 +239,7 @@ namespace Novetus.Core return; } - Util.ConsolePrint("Web Proxy stopping on port " + GlobalVars.WebProxyPort, 3); + Util.ConsolePrint("Web Proxy stopping on port " + WebProxyPort, 3); Server.BeforeRequest -= new AsyncEventHandler(OnRequest); Server.Stop(); diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs index 0908ede..693ab78 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalVars.cs @@ -101,7 +101,6 @@ namespace Novetus.Core public static ScriptType GameOpened = ScriptType.None; public static string PlayerTripcode = ""; #if LAUNCHER || URI - public static int WebProxyPort = 0; public static WebProxy Proxy = new WebProxy(); #endif #endregion diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs index cddad90..34363f3 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/LauncherFormShared.cs @@ -593,7 +593,6 @@ namespace NovetusLauncher Tree.Focus(); IPBox.Text = GlobalVars.CurrentServer.ToString(); HostPortBox.Value = Convert.ToDecimal(GlobalVars.UserConfiguration.RobloxPort); - GlobalVars.Proxy.UpdateEndPoint(); IPLabel.Text = GlobalVars.CurrentServer.ServerIP; PortLabel.Text = GlobalVars.CurrentServer.ServerPort.ToString(); DiscordPresenceCheckbox.Checked = GlobalVars.UserConfiguration.DiscordPresence; @@ -970,7 +969,6 @@ namespace NovetusLauncher public void ChangeServerPort() { GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(HostPortBox.Value); - GlobalVars.Proxy.UpdateEndPoint(); } public void ChangeClient() diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs index 12e7e60..799cf61 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Stylish/LauncherFormStylishInterface.xaml.cs @@ -335,7 +335,6 @@ namespace NovetusLauncher if (!IsLoaded) return; GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(serverPortBox.Text); - GlobalVars.Proxy.UpdateEndPoint(); } private void maxPlayersBox_TextChanged(object sender, TextChangedEventArgs e) diff --git a/Novetus/NovetusLauncher/Forms/NovetusConsole.cs b/Novetus/NovetusLauncher/Forms/NovetusConsole.cs index 757b823..e18a4d6 100644 --- a/Novetus/NovetusLauncher/Forms/NovetusConsole.cs +++ b/Novetus/NovetusLauncher/Forms/NovetusConsole.cs @@ -155,7 +155,6 @@ namespace NovetusLauncher if (ConsoleArgs["hostport"] != null) { GlobalVars.UserConfiguration.RobloxPort = Convert.ToInt32(ConsoleArgs["hostport"]); - GlobalVars.Proxy.UpdateEndPoint(); } if (ConsoleArgs["upnp"] != null) diff --git a/changelog.txt b/changelog.txt index f12be4d..9fd3769 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,12 @@ -Snapshot v23.8451.38416.1 +Snapshot v23.8469.20669.1 Enhancements: - Added clean_junk.bat to allow the user to quickly reset their Novetus install. -- The Asset Web proxy extension now tries to download online assets for quicker asset loading on future map launches. -- Slightly increased asset loading times. +- The Asset Web Proxy extension now tries to download online assets for quicker asset loading on future map launches. + - Some older clients may take a long time to load assets regardless. +- Improved reliability under Wine. +- Enabled the use of commands in CMD mode. +- Changing any item or color in the customization menu will now automatically save the setting. No manual saving required! +- Added a note related to internet connection for the Web Proxy. ---------------------------------------------------------------------------- Snapshot v23.8428.35205.1 Notes: diff --git a/consolehelp.txt b/consolehelp.txt index f2adc74..ecad7db 100644 --- a/consolehelp.txt +++ b/consolehelp.txt @@ -13,6 +13,7 @@ Commands:|3 + clear - Clears all text in this window.|4 + help - Clears all text and shows this list.|4 + documentation - Clears all text and shows the ClientScript documentation.|4 ++ commandline - Prints all the command line variables passed to the launcher. Good for debugging.|4 + config save - Saves the config file|4 + config load - Reloads the config file|4 + config reset - Resets the config file|4 diff --git a/defaultaddons/novetusexts/webproxy/Asset.cs b/defaultaddons/novetusexts/webproxy/Asset.cs index ab4808a..ba366a1 100644 --- a/defaultaddons/novetusexts/webproxy/Asset.cs +++ b/defaultaddons/novetusexts/webproxy/Asset.cs @@ -2,6 +2,7 @@ using System; using System.IO; using System.Threading.Tasks; using System.Web; +using System.Net; using System.Collections.Generic; using Titanium.Web.Proxy; using Titanium.Web.Proxy.EventArguments; @@ -16,11 +17,21 @@ public class Asset : IWebProxyExtension return "Asset Redirection Extension"; } + public override string Version() + { + return "1.1.0"; + } + public override string Author() { return "Bitl"; } + public override void OnExtensionLoad() + { + Util.ConsolePrint("NOTE - Depending on how old the client is, assets may take a long time to load. Please be patient!"); + } + public override bool IsValidURL(string absolutePath, string host) { return (absolutePath.EndsWith("/asset") || absolutePath.EndsWith("/asset/")); @@ -72,22 +83,18 @@ public class Asset : IWebProxyExtension { if (!CanRedirectLocalAsset(GlobalPaths.DataPath, id, e)) { - //Util.ConsolePrint(Name() + ": Cannot find " + id.ToString() + " in " + GlobalPaths.DataPath + ". Checking client assets.", 5); if (!CanRedirectLocalAsset(GlobalPaths.AssetsPath, id, e)) { - //Util.ConsolePrint(Name() + ": Cannot find " + id.ToString() + " in " + GlobalPaths.AssetsPath + ". Redirecting.", 2); e.Redirect(url); - - Downloader download = new Downloader(url, id.ToString()); - - download.filePath = GlobalPaths.AssetCacheDirAssets; - download.showErrorInfo = false; - download.overwrite = false; - download.InitDownloadDirect(""); - - if (!download.getDownloadOutcome().Contains("Error")) + + if (e.HttpClient.Response.StatusCode != 409) { - Util.ConsolePrint(Name() + ": Localization of " + id.ToString() + " successful. Asset will be local on next launch.", 3); + Downloader download = new Downloader(url, id.ToString()); + + download.filePath = GlobalPaths.AssetCacheDirAssets; + download.showErrorInfo = false; + download.overwrite = false; + download.InitDownloadDirect(""); } } } diff --git a/scripts/launcher/splashes.txt b/scripts/launcher/splashes.txt index 26832e2..065ac2e 100644 --- a/scripts/launcher/splashes.txt +++ b/scripts/launcher/splashes.txt @@ -260,3 +260,9 @@ We're not candy!|This is serious! ppShader You're already dead.|NANI? Gravitational Pull of Pepsi +Let's fly to the castle! +Surrender or Run. +Aren't you excited?|Are you afraid now? +Teaching a new dog new tricks! +Nothing special, it's just my BASS CANNON! +I GOT THE ZOOMIES. I WILL NEVER CEASE! \ No newline at end of file