mirror of
https://github.com/Novetus/Novetus_src.git
synced 2025-01-31 09:41:33 +02:00
update to latest snapshot
This commit is contained in:
parent
5b518175e9
commit
a10dcdcdfa
37
Novetus/NovetusCore/Classes/SemaphoreLocker.cs
Normal file
37
Novetus/NovetusCore/Classes/SemaphoreLocker.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//https://stackoverflow.com/questions/7612602/why-cant-i-use-the-await-operator-within-the-body-of-a-lock-statement/50139704#50139704
|
||||
|
||||
public class SemaphoreLocker
|
||||
{
|
||||
private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
|
||||
|
||||
public async Task LockAsync(Func<Task> worker)
|
||||
{
|
||||
await _semaphore.WaitAsync();
|
||||
try
|
||||
{
|
||||
await worker();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_semaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
// overloading variant for non-void methods with return type (generic T)
|
||||
public async Task<T> LockAsync<T>(Func<Task<T>> worker)
|
||||
{
|
||||
await _semaphore.WaitAsync();
|
||||
try
|
||||
{
|
||||
return await worker();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_semaphore.Release();
|
||||
}
|
||||
}
|
||||
}
|
@ -30,14 +30,11 @@ namespace Novetus.Core
|
||||
|
||||
public class WebProxy
|
||||
{
|
||||
private ProxyServer Server = null;
|
||||
private ProxyServer Server = new ProxyServer();
|
||||
private ExplicitProxyEndPoint end;
|
||||
public ExtensionManager Manager = new ExtensionManager();
|
||||
|
||||
public bool HasStarted()
|
||||
{
|
||||
return Server.ProxyRunning;
|
||||
}
|
||||
private static readonly SemaphoreLocker _locker = new SemaphoreLocker();
|
||||
public bool Started { get { return Server.ProxyRunning; } }
|
||||
|
||||
public void DoSetup()
|
||||
{
|
||||
@ -77,8 +74,6 @@ namespace Novetus.Core
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Server = new ProxyServer();
|
||||
|
||||
if (Server.ProxyRunning)
|
||||
{
|
||||
Util.ConsolePrint("The web proxy is already on and running.", 2);
|
||||
@ -208,43 +203,44 @@ namespace Novetus.Core
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||
private async Task OnRequest(object sender, SessionEventArgs e)
|
||||
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
|
||||
{
|
||||
if (!IsValidURL(e.HttpClient))
|
||||
await _locker.LockAsync(async () =>
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = e.HttpClient.Request.RequestUri;
|
||||
|
||||
foreach (IExtension extension in Manager.GetExtensionList().ToArray())
|
||||
{
|
||||
IWebProxyExtension webProxyExtension = extension as IWebProxyExtension;
|
||||
if (webProxyExtension != null)
|
||||
if (!IsValidURL(e.HttpClient))
|
||||
{
|
||||
if (webProxyExtension.IsValidURL(uri.AbsolutePath.ToLowerInvariant(), uri.Host))
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = e.HttpClient.Request.RequestUri;
|
||||
|
||||
foreach (IExtension extension in Manager.GetExtensionList().ToArray())
|
||||
{
|
||||
IWebProxyExtension webProxyExtension = extension as IWebProxyExtension;
|
||||
if (webProxyExtension != null)
|
||||
{
|
||||
try
|
||||
if (webProxyExtension.IsValidURL(uri.AbsolutePath.ToLowerInvariant(), uri.Host))
|
||||
{
|
||||
await webProxyExtension.OnRequest(sender, e);
|
||||
return;
|
||||
try
|
||||
{
|
||||
await webProxyExtension.OnRequest(sender, e);
|
||||
return;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
e.GenericResponse("", HttpStatusCode.InternalServerError);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
else
|
||||
{
|
||||
e.GenericResponse("", HttpStatusCode.InternalServerError);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.GenericResponse("", HttpStatusCode.NotFound);
|
||||
e.GenericResponse("", HttpStatusCode.NotFound);
|
||||
});
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
@ -258,8 +254,6 @@ namespace Novetus.Core
|
||||
Util.ConsolePrint("Web Proxy stopping on port " + GlobalVars.WebProxyPort, 3);
|
||||
Server.BeforeRequest -= new AsyncEventHandler<SessionEventArgs>(OnRequest);
|
||||
Server.Stop();
|
||||
Server.Dispose();
|
||||
Server = null;
|
||||
|
||||
foreach (IExtension extension in Manager.GetExtensionList().ToArray())
|
||||
{
|
||||
|
@ -10,6 +10,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Classes\Script.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Classes\SemaphoreLocker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Classes\WebProxy.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)StorageAndFunctions\ClientManagement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Classes\Downloader.cs" />
|
||||
|
@ -335,6 +335,7 @@ namespace Novetus.Core
|
||||
case ScriptType.Studio:
|
||||
return GlobalVars.LauncherState.InStudio;
|
||||
case ScriptType.EasterEgg:
|
||||
case ScriptType.EasterEggServer:
|
||||
return GlobalVars.LauncherState.InEasterEggGame;
|
||||
default:
|
||||
return GlobalVars.LauncherState.InLauncher;
|
||||
@ -893,6 +894,7 @@ namespace Novetus.Core
|
||||
rbxfolder = "client";
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
case ScriptType.EasterEggServer:
|
||||
rbxfolder = "server";
|
||||
break;
|
||||
case ScriptType.Studio:
|
||||
@ -929,11 +931,14 @@ namespace Novetus.Core
|
||||
switch (type)
|
||||
{
|
||||
case ScriptType.Client:
|
||||
case ScriptType.Solo:
|
||||
case ScriptType.EasterEgg:
|
||||
rbxexe = BasePath + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_client.exe";
|
||||
break;
|
||||
case ScriptType.Solo:
|
||||
rbxexe = BasePath + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_solo.exe";
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
case ScriptType.EasterEggServer:
|
||||
rbxexe = BasePath + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_server.exe";
|
||||
break;
|
||||
case ScriptType.Studio:
|
||||
@ -950,16 +955,17 @@ namespace Novetus.Core
|
||||
switch (type)
|
||||
{
|
||||
case ScriptType.Client:
|
||||
case ScriptType.EasterEgg:
|
||||
rbxexe = BasePath + @"\\RobloxApp_client.exe";
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
case ScriptType.EasterEggServer:
|
||||
rbxexe = BasePath + @"\\RobloxApp_server.exe";
|
||||
break;
|
||||
case ScriptType.Studio:
|
||||
rbxexe = BasePath + @"\\RobloxApp_studio.exe";
|
||||
break;
|
||||
case ScriptType.Solo:
|
||||
case ScriptType.EasterEgg:
|
||||
rbxexe = BasePath + @"\\RobloxApp_solo.exe";
|
||||
break;
|
||||
case ScriptType.None:
|
||||
@ -1045,7 +1051,7 @@ namespace Novetus.Core
|
||||
#if URI
|
||||
UpdateStatus(label, "The client has been detected as modified.");
|
||||
#elif LAUNCHER
|
||||
Util.ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2);
|
||||
Util.ConsolePrint("ERROR - Failed to launch Novetus. (The client has been detected as modified.)", 2);
|
||||
#endif
|
||||
|
||||
#if LAUNCHER
|
||||
@ -1075,46 +1081,48 @@ namespace Novetus.Core
|
||||
#endif
|
||||
{
|
||||
#if LAUNCHER
|
||||
DecompressMap(type, nomap);
|
||||
DecompressMap(type, nomap);
|
||||
#endif
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ScriptType.Client:
|
||||
case ScriptType.EasterEgg:
|
||||
FileManagement.ReloadLoadoutValue(true);
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != ScriptType.Server)
|
||||
if (!GlobalVars.LocalPlayMode && GlobalVars.GameOpened != ScriptType.Server && GlobalVars.GameOpened != ScriptType.EasterEggServer)
|
||||
{
|
||||
goto default;
|
||||
}
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
if (GlobalVars.GameOpened == ScriptType.Server)
|
||||
case ScriptType.EasterEggServer:
|
||||
if (GlobalVars.GameOpened == ScriptType.Server || GlobalVars.GameOpened == ScriptType.EasterEggServer)
|
||||
{
|
||||
Util.ConsolePrint("ERROR - Failed to launch Novetus. (A server is already running.)", 2);
|
||||
|
||||
#if LAUNCHER
|
||||
if (!GlobalVars.isConsoleOnly)
|
||||
{
|
||||
MessageBox.Show("Failed to launch Novetus. (Error: A server is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
if (!GlobalVars.isConsoleOnly)
|
||||
{
|
||||
MessageBox.Show("Failed to launch Novetus. (Error: A server is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else if (GlobalVars.UserConfiguration.FirstServerLaunch)
|
||||
else if (GlobalVars.UserConfiguration.FirstServerLaunch && GlobalVars.GameOpened == ScriptType.Server)
|
||||
{
|
||||
#if LAUNCHER
|
||||
string hostingTips = "For your first time hosting a server, make sure your server's port forwarded (set up in your router), going through a tunnel server, or running from UPnP.\n" +
|
||||
"If your port is forwarded or you are going through a tunnel server, make sure your port is set up as UDP, not TCP.\n" +
|
||||
"Roblox does NOT use TCP, only UDP. However, if your server doesn't work with just UDP, feel free to set up TCP too as that might help the issue in some cases.";
|
||||
string hostingTips = "For your first time hosting a server, make sure your server's port forwarded (set up in your router), going through a tunnel server, or running from UPnP.\n" +
|
||||
"If your port is forwarded or you are going through a tunnel server, make sure your port is set up as UDP, not TCP.\n" +
|
||||
"Roblox does NOT use TCP, only UDP. However, if your server doesn't work with just UDP, feel free to set up TCP too as that might help the issue in some cases.";
|
||||
|
||||
if (!GlobalVars.isConsoleOnly)
|
||||
{
|
||||
MessageBox.Show(hostingTips, "Novetus - Hosting Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
Util.ConsolePrint("Tips: " + hostingTips, 4);
|
||||
}
|
||||
if (!GlobalVars.isConsoleOnly)
|
||||
{
|
||||
MessageBox.Show(hostingTips, "Novetus - Hosting Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
Util.ConsolePrint("Tips: " + hostingTips, 4);
|
||||
}
|
||||
#endif
|
||||
GlobalVars.UserConfiguration.FirstServerLaunch = false;
|
||||
}
|
||||
@ -1132,10 +1140,10 @@ namespace Novetus.Core
|
||||
Util.ConsolePrint("ERROR - Failed to launch Novetus. (A game is already running.)", 2);
|
||||
|
||||
#if LAUNCHER
|
||||
if (!GlobalVars.isConsoleOnly)
|
||||
{
|
||||
MessageBox.Show("Failed to launch Novetus. (Error: A game is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
if (!GlobalVars.isConsoleOnly)
|
||||
{
|
||||
MessageBox.Show("Failed to launch Novetus. (Error: A game is already running.)", "Novetus - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@ -1145,10 +1153,9 @@ namespace Novetus.Core
|
||||
ReadClientValues(ClientName);
|
||||
string luafile = GetLuaFileName(ClientName, type);
|
||||
string rbxexe = GetClientEXEDir(ClientName, type);
|
||||
string mapfile = type.Equals(ScriptType.EasterEgg) ?
|
||||
GlobalPaths.DataDir + "\\Appreciation.rbxl" :
|
||||
(nomap ? (type.Equals(ScriptType.Studio) ? GlobalPaths.ConfigDir + "\\Place1.rbxl" : "") : GlobalVars.UserConfiguration.MapPath);
|
||||
string mapname = type.Equals(ScriptType.EasterEgg) ? "" : (nomap ? "" : GlobalVars.UserConfiguration.Map);
|
||||
bool isEasterEgg = (type.Equals(ScriptType.EasterEggServer));
|
||||
string mapfile = isEasterEgg ? GlobalPaths.DataDir + "\\Appreciation.rbxl" : (nomap ? (type.Equals(ScriptType.Studio) ? GlobalPaths.ConfigDir + "\\Place1.rbxl" : "") : GlobalVars.UserConfiguration.MapPath);
|
||||
string mapname = isEasterEgg ? "" : (nomap ? "" : GlobalVars.UserConfiguration.Map);
|
||||
FileFormat.ClientInfo info = GetClientInfoValues(ClientName);
|
||||
string quote = "\"";
|
||||
string args = "";
|
||||
@ -1488,6 +1495,7 @@ namespace Novetus.Core
|
||||
switch (type)
|
||||
{
|
||||
case ScriptType.Client:
|
||||
case ScriptType.EasterEgg:
|
||||
return "_G.CSConnect("
|
||||
+ (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
|
||||
+ GlobalVars.CurrentServer.ServerIP + "',"
|
||||
@ -1499,6 +1507,7 @@ namespace Novetus.Core
|
||||
+ ((GlobalVars.ValidatedExtraFiles > 0) ? "'," + GlobalVars.ValidatedExtraFiles.ToString() + "," : "',0,")
|
||||
+ GlobalVars.UserConfiguration.NewGUI.ToString().ToLower() + ");";
|
||||
case ScriptType.Server:
|
||||
case ScriptType.EasterEggServer:
|
||||
return "_G.CSServer("
|
||||
+ GlobalVars.UserConfiguration.RobloxPort + ","
|
||||
+ GlobalVars.UserConfiguration.PlayerLimit + ","
|
||||
@ -1507,7 +1516,6 @@ namespace Novetus.Core
|
||||
+ ((GlobalVars.ValidatedExtraFiles > 0) ? "," + GlobalVars.ValidatedExtraFiles.ToString() + "," : ",0,")
|
||||
+ GlobalVars.UserConfiguration.NewGUI.ToString().ToLower() + ");";
|
||||
case ScriptType.Solo:
|
||||
case ScriptType.EasterEgg:
|
||||
return "_G.CSSolo("
|
||||
+ (info.UsesID ? GlobalVars.UserConfiguration.UserID : 0) + ",'"
|
||||
+ (info.UsesPlayerName ? GlobalVars.UserConfiguration.PlayerName : "Player") + "',"
|
||||
@ -1534,6 +1542,7 @@ namespace Novetus.Core
|
||||
case ScriptType.Studio:
|
||||
return "Studio";
|
||||
case ScriptType.EasterEgg:
|
||||
case ScriptType.EasterEggServer:
|
||||
return "A message from Bitl";
|
||||
default:
|
||||
return "N/A";
|
||||
|
@ -24,7 +24,8 @@ namespace Novetus.Core
|
||||
Solo = 2,
|
||||
Studio = 3,
|
||||
EasterEgg = 4,
|
||||
None = 5
|
||||
EasterEggServer = 5,
|
||||
None = 6
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -299,6 +299,7 @@ namespace Novetus.Core
|
||||
+ RandomStringTitle());
|
||||
break;
|
||||
case ScriptType.EasterEgg:
|
||||
case ScriptType.EasterEggServer:
|
||||
default:
|
||||
SetWindowText(exe.MainWindowHandle, ScriptFuncs.Generator.GetNameForType(type)
|
||||
+ RandomStringTitle());
|
||||
|
@ -680,7 +680,7 @@ namespace Novetus.Core
|
||||
return (p <= 0);
|
||||
}
|
||||
|
||||
public static void ConsolePrint(string text, int type = 1, bool noLog = false)
|
||||
public static void ConsolePrint(string text, int type = 1, bool noLog = false, bool scrollDown = true)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -718,7 +718,7 @@ namespace Novetus.Core
|
||||
#if LAUNCHER
|
||||
if (GlobalVars.consoleForm != null)
|
||||
{
|
||||
FormPrint(text, type, GlobalVars.consoleForm.ConsoleBox);
|
||||
FormPrint(text, type, GlobalVars.consoleForm.ConsoleBox, scrollDown);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -756,7 +756,7 @@ namespace Novetus.Core
|
||||
}
|
||||
}
|
||||
|
||||
private static void FormPrint(string text, int type, RichTextBox box)
|
||||
private static void FormPrint(string text, int type, RichTextBox box, bool scrollDown = true)
|
||||
{
|
||||
if (box == null)
|
||||
return;
|
||||
@ -790,6 +790,12 @@ namespace Novetus.Core
|
||||
box.AppendText(text, Color.Black);
|
||||
break;
|
||||
}
|
||||
|
||||
if (scrollDown)
|
||||
{
|
||||
box.SelectionStart = box.Text.Length;
|
||||
box.ScrollToCaret();
|
||||
}
|
||||
}
|
||||
|
||||
private static void ConsoleText(string text, ConsoleColor color, bool newLine = false)
|
||||
@ -805,7 +811,7 @@ namespace Novetus.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReadTextFileWithColor(string path)
|
||||
public static void ReadTextFileWithColor(string path, bool scrollDown = true)
|
||||
{
|
||||
var lines = File.ReadLines(path);
|
||||
foreach (var line in lines)
|
||||
@ -813,11 +819,11 @@ namespace Novetus.Core
|
||||
try
|
||||
{
|
||||
string[] vals = line.Split('|');
|
||||
ConsolePrint(vals[0], Convert.ToInt32(vals[1]), true);
|
||||
ConsolePrint(vals[0], Convert.ToInt32(vals[1]), true, scrollDown);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
ConsolePrint(line, 1, true);
|
||||
ConsolePrint(line, 1, true, scrollDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,6 +142,7 @@ namespace NovetusLauncher
|
||||
switch (GlobalVars.GameOpened)
|
||||
{
|
||||
case ScriptType.Server:
|
||||
case ScriptType.EasterEggServer:
|
||||
ShowCloseError("A server is open.", "Server", e);
|
||||
break;
|
||||
default:
|
||||
@ -191,7 +192,13 @@ namespace NovetusLauncher
|
||||
}
|
||||
if (GlobalVars.UserConfiguration.WebProxyEnabled)
|
||||
{
|
||||
GlobalVars.Proxy.Stop();
|
||||
try
|
||||
{
|
||||
GlobalVars.Proxy.Stop();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (!GlobalVars.AppClosed)
|
||||
@ -269,7 +276,7 @@ namespace NovetusLauncher
|
||||
}
|
||||
}
|
||||
|
||||
public void StartGame(ScriptType gameType, bool no3d = false, bool nomap = false, bool console = false)
|
||||
public async void StartGame(ScriptType gameType, bool no3d = false, bool nomap = false, bool console = false)
|
||||
{
|
||||
if (!console)
|
||||
{
|
||||
@ -355,7 +362,9 @@ namespace NovetusLauncher
|
||||
ClientManagement.LaunchRBXClient(ScriptType.Studio, false, nomap, new EventHandler(ClientExitedBase));
|
||||
break;
|
||||
case ScriptType.EasterEgg:
|
||||
ClientManagement.LaunchRBXClient(ScriptType.EasterEgg, false, false, new EventHandler(EasterEggExited));
|
||||
ClientManagement.LaunchRBXClient(ScriptType.EasterEggServer, false, false, new EventHandler(ServerExited));
|
||||
await Util.Delay(1500);
|
||||
ClientManagement.LaunchRBXClient(ScriptType.EasterEgg, false, true, new EventHandler(EasterEggExited));
|
||||
break;
|
||||
case ScriptType.None:
|
||||
default:
|
||||
@ -370,6 +379,11 @@ namespace NovetusLauncher
|
||||
|
||||
public void EasterEggLogic()
|
||||
{
|
||||
if (LocalVars.Clicks <= 0)
|
||||
{
|
||||
LocalVars.prevsplash = SplashLabel.Text;
|
||||
}
|
||||
|
||||
if (LocalVars.Clicks < 10)
|
||||
{
|
||||
LocalVars.Clicks += 1;
|
||||
@ -431,6 +445,12 @@ namespace NovetusLauncher
|
||||
{
|
||||
LocalVars.Clicks = 0;
|
||||
}
|
||||
|
||||
var processes = Process.GetProcessesByName("RobloxApp_server");
|
||||
foreach (var process in processes)
|
||||
{
|
||||
process.Kill();
|
||||
}
|
||||
ClientExitedBase(sender, e);
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,7 @@ namespace NovetusLauncher
|
||||
}
|
||||
else if (vals[1].Equals("off", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (!GlobalVars.Proxy.HasStarted() && !GlobalVars.UserConfiguration.WebProxyEnabled)
|
||||
if (!GlobalVars.Proxy.Started && !GlobalVars.UserConfiguration.WebProxyEnabled)
|
||||
{
|
||||
Util.ConsolePrint("The web proxy is disabled. Please turn it on in order to use this command.", 2);
|
||||
return;
|
||||
@ -408,7 +408,7 @@ namespace NovetusLauncher
|
||||
}
|
||||
else if (vals[1].Equals("disable", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (!GlobalVars.Proxy.HasStarted() && !GlobalVars.UserConfiguration.WebProxyEnabled)
|
||||
if (!GlobalVars.Proxy.Started && !GlobalVars.UserConfiguration.WebProxyEnabled)
|
||||
{
|
||||
Util.ConsolePrint("The web proxy is already disabled.", 2);
|
||||
return;
|
||||
@ -425,7 +425,7 @@ namespace NovetusLauncher
|
||||
}
|
||||
else if (vals[1].Equals("extensions", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
if (!GlobalVars.Proxy.HasStarted() && !GlobalVars.UserConfiguration.WebProxyEnabled)
|
||||
if (!GlobalVars.Proxy.Started && !GlobalVars.UserConfiguration.WebProxyEnabled)
|
||||
{
|
||||
Util.ConsolePrint("The web proxy is disabled. Please turn it on in order to use this command.", 2);
|
||||
return;
|
||||
@ -468,9 +468,9 @@ namespace NovetusLauncher
|
||||
public void ConsoleHelp()
|
||||
{
|
||||
ClearConsole();
|
||||
Util.ConsolePrint("Help:", 3, true);
|
||||
Util.ReadTextFileWithColor(GlobalPaths.BasePath + "\\" + GlobalPaths.ConsoleHelpFileName);
|
||||
Util.ConsolePrint(GlobalVars.Important2, 0, true);
|
||||
Util.ConsolePrint("Help:", 3, true, false);
|
||||
Util.ReadTextFileWithColor(GlobalPaths.BasePath + "\\" + GlobalPaths.ConsoleHelpFileName, false);
|
||||
Util.ConsolePrint(GlobalVars.Important2, 0, true, false);
|
||||
ScrollToTop();
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ namespace NovetusLauncher
|
||||
{
|
||||
ClearConsole();
|
||||
Util.ConsolePrint("ClientScript Documentation:", 3, true);
|
||||
Util.ReadTextFileWithColor(GlobalPaths.BasePath + "\\" + GlobalPaths.ClientScriptDocumentationFileName);
|
||||
Util.ReadTextFileWithColor(GlobalPaths.BasePath + "\\" + GlobalPaths.ClientScriptDocumentationFileName, false);
|
||||
ScrollToTop();
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ namespace NovetusLauncher
|
||||
{
|
||||
GlobalVars.UserConfiguration = savedConfig;
|
||||
}
|
||||
ConsoleForm.CloseEventInternal();
|
||||
ConsoleForm.CloseEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,7 @@ public partial class ItemCreationSDKColorMenu : Form
|
||||
}
|
||||
|
||||
parent.partColorID = Convert.ToInt32(colorMenu.Items[selectedIndex].Tag);
|
||||
#pragma warning disable CS1690 // Accessing a member on a field of a marshal-by-reference class may cause a runtime exception
|
||||
parent.partColorLabel.Text = parent.partColorID.ToString();
|
||||
#pragma warning restore CS1690 // Accessing a member on a field of a marshal-by-reference class may cause a runtime exception
|
||||
Close();
|
||||
}
|
||||
|
||||
|
@ -306,10 +306,10 @@ ROBLOX Script Generator was made by S. Costeira.
|
||||
Thank you to NT_x86 for helping me with security fixes.
|
||||
Thank you XlXi for the idea of the original logo. This logo was remade in newer verions in higher quality.
|
||||
Thank you Nukley for the idea of the Splash Tester.
|
||||
Credits go to Nostal-ia for getting 2011M corescripts working and helping me with 2011E corescripts.
|
||||
Credits go to matboff for getting 2011M corescripts working and helping me with 2011E corescripts.
|
||||
Credits to Hazelnut (creator of JRBX) for the buttons used in the Stylish style.
|
||||
Credits go to davcs86 for the HWID generation code (https://github.com/davcs86/csharp-uhwid)
|
||||
Credits go to BRAVONATCHO and Sodikm for parts of the web proxy code.
|
||||
Credits go to matboff and Sodikm for parts of the web proxy code.
|
||||
All credits for the used pieces of code go to the respective authors.
|
||||
|
||||
------------------------------------------------------------
|
||||
|
@ -1,3 +1,25 @@
|
||||
1.3 Snapshot v22.8412.32591.1
|
||||
Enhancements:
|
||||
- Added badge support to the Web Proxy.
|
||||
- The Easter Egg now loads up a server and a client, rather than loading a client in Play Solo mode.
|
||||
- Further improved web proxy reliability.
|
||||
|
||||
Fixes:
|
||||
- Fixed the previous splash not showing up after closing the Easter Egg.
|
||||
- Fixed a bug where the Console could close Novetus with a client open.
|
||||
----------------------------------------------------------------------------
|
||||
1.3 Snapshot v22.8411.39962.1
|
||||
Enhancements:
|
||||
- Web Proxy Extension API additions:
|
||||
- Added Author().
|
||||
- Improved Web Proxy Extension loading and management.
|
||||
- Improved the Console user experience.
|
||||
- Added proxy extensions reload - Reloads all Web Proxy extensions.
|
||||
- Added proxy extensions list - Lists all Web Proxy extensions.
|
||||
|
||||
Fixes:
|
||||
- Fixed a bug that happens when the user manually stops the Web Proxy with the Console.
|
||||
----------------------------------------------------------------------------
|
||||
1.3 Snapshot v22.8408.16129.1
|
||||
Enhancements:
|
||||
- Changed the design of the Console to be more user friendly.
|
||||
|
@ -16,7 +16,9 @@ Commands:|3
|
||||
+ config save - Saves the config file|4
|
||||
+ config load - Reloads the config file|4
|
||||
+ config reset - Resets the config file|4
|
||||
+ proxy <off/on/disable> - Turns Novetus' web proxy on and off.
|
||||
+ proxy <off/on/disable> - Turns Novetus' web proxy on and off. 'disable' disables the web proxy entirely.|4
|
||||
+ proxy extensions reload - Reloads all Web Proxy extensions.|4
|
||||
+ proxy extensions list - Lists all Web Proxy extensions.|4
|
||||
---------|1
|
||||
Command-Line Parameters:|3
|
||||
---------|1
|
||||
|
30
defaultaddons/URLSetup.lua
Normal file
30
defaultaddons/URLSetup.lua
Normal file
@ -0,0 +1,30 @@
|
||||
local this = {}
|
||||
|
||||
function this:Name()
|
||||
return "URL Setup Addon"
|
||||
end
|
||||
|
||||
function this:IsEnabled(Script, Client)
|
||||
if (Script ~= "Studio") then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function this:PreInit(Script, Client)
|
||||
pcall(function() game:GetService("BadgeService"):SetPlaceId(game.PlaceId) end)
|
||||
pcall(function() game:GetService("BadgeService"):SetAwardBadgeUrl("http://www.roblox.com/Game/Badge/AwardBadge.ashx?UserID=%d&BadgeID=%d&PlaceID=%d") end)
|
||||
pcall(function() game:GetService("BadgeService"):SetHasBadgeUrl("http://www.roblox.com/Game/Badge/HasBadge.ashx?UserID=%d&BadgeID=%d") end)
|
||||
pcall(function() game:GetService("BadgeService"):SetIsBadgeDisabledUrl("http://www.roblox.com/Game/Badge/IsBadgeDisabled.ashx?BadgeID=%d&PlaceID=%d") end)
|
||||
pcall(function() game:GetService("BadgeService"):SetIsBadgeLegalUrl("") end)
|
||||
end
|
||||
|
||||
-- DO NOT REMOVE THIS. this is required to load this addon into the game.
|
||||
|
||||
function AddModule(t)
|
||||
print("AddonLoader: Adding " .. this:Name())
|
||||
table.insert(t, this)
|
||||
end
|
||||
|
||||
_G.CSScript_AddModule=AddModule
|
@ -1,6 +1,6 @@
|
||||
-- put script names here
|
||||
|
||||
Addons = {"Utils", "ShadersCompatibility", "ServerWhitelist"}
|
||||
Addons = {"Utils", "ShadersCompatibility", "ServerWhitelist", "URLSetup"}
|
||||
|
||||
-- DONT EDIT ANYTHING ELSE BELOW
|
||||
|
||||
|
@ -16,6 +16,11 @@ public class Asset : IWebProxyExtension
|
||||
return "Asset Redirection Extension";
|
||||
}
|
||||
|
||||
public override string Author()
|
||||
{
|
||||
return "Bitl";
|
||||
}
|
||||
|
||||
public override bool IsValidURL(string absolutePath, string host)
|
||||
{
|
||||
return (absolutePath.EndsWith("/asset") || absolutePath.EndsWith("/asset/"));
|
||||
|
137
defaultaddons/novetusexts/webproxy/AwardBadge.cs
Normal file
137
defaultaddons/novetusexts/webproxy/AwardBadge.cs
Normal file
@ -0,0 +1,137 @@
|
||||
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;
|
||||
using Titanium.Web.Proxy.Http;
|
||||
using Titanium.Web.Proxy.Models;
|
||||
using Novetus.Core;
|
||||
|
||||
public class AwardBadge : IWebProxyExtension
|
||||
{
|
||||
struct BadgeData
|
||||
{
|
||||
public long BadgeId;
|
||||
public string BadgeName;
|
||||
public string BadgeCreatorName;
|
||||
}
|
||||
|
||||
private static readonly string BadgeDatabasePath = GlobalPaths.ConfigDir + "\\BadgeDatabase.ini";
|
||||
private string BadgeDatabaseSection = "BadgeDatabase";
|
||||
private string MetadataFileExtension = "_meta.ini";
|
||||
private INIFile ini = new INIFile(BadgeDatabasePath);
|
||||
|
||||
public override string Name()
|
||||
{
|
||||
return "Badge Award Extension";
|
||||
}
|
||||
|
||||
public override string Author()
|
||||
{
|
||||
return "Bitl";
|
||||
}
|
||||
|
||||
void AddBadgeToDB(long BadgeID, bool Awarded = false)
|
||||
{
|
||||
CreateBadgeDatabaseIfNeeded();
|
||||
ini.IniWriteValue(BadgeDatabaseSection, BadgeID.ToString(), Awarded.ToString());
|
||||
}
|
||||
|
||||
bool PlayerHasBadge(long BadgeID)
|
||||
{
|
||||
CreateBadgeDatabaseIfNeeded();
|
||||
|
||||
if (ini.IniValueExists(BadgeID.ToString()))
|
||||
{
|
||||
string awarded = ini.IniReadValue(BadgeDatabaseSection, BadgeID.ToString(), "False");
|
||||
return Convert.ToBoolean(awarded);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CreateBadgeDatabaseIfNeeded()
|
||||
{
|
||||
if (!File.Exists(BadgeDatabasePath))
|
||||
{
|
||||
Util.ConsolePrint("WARNING - " + BadgeDatabasePath + " not found. Creating empty badge database.", 5);
|
||||
File.Create(BadgeDatabasePath).Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnExtensionLoad()
|
||||
{
|
||||
CreateBadgeDatabaseIfNeeded();
|
||||
}
|
||||
|
||||
BadgeData LoadMetadata(long BadgeID)
|
||||
{
|
||||
BadgeData result;
|
||||
result.BadgeId = BadgeID;
|
||||
result.BadgeName = BadgeID.ToString();
|
||||
result.BadgeCreatorName = "Unknown";
|
||||
string metaFile = (GlobalVars.UserConfiguration.MapPath.Replace(".rbxl", "").Replace(".rbxlx", "").Replace(".bz2", "") + MetadataFileExtension);
|
||||
|
||||
if (GlobalVars.GameOpened == ScriptType.EasterEgg)
|
||||
{
|
||||
metaFile = ((GlobalPaths.DataDir + "\\Appreciation.rbxl").Replace(".rbxl", MetadataFileExtension));
|
||||
}
|
||||
|
||||
if (File.Exists(metaFile))
|
||||
{
|
||||
try
|
||||
{
|
||||
INIFile metaIni = new INIFile(metaFile);
|
||||
string section = BadgeID.ToString();
|
||||
|
||||
string name = metaIni.IniReadValue(section, "BadgeName", BadgeID.ToString());
|
||||
string creator = metaIni.IniReadValue(section, "BadgeCreatorName", "Unknown");
|
||||
result.BadgeName = name;
|
||||
result.BadgeCreatorName = creator;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override bool IsValidURL(string absolutePath, string host)
|
||||
{
|
||||
return absolutePath.EndsWith("/game/badge/awardbadge.ashx");
|
||||
}
|
||||
|
||||
string GenerateBadgeString(string creatorName, string badgeName, long id)
|
||||
{
|
||||
if (PlayerHasBadge(id))
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
|
||||
return GlobalVars.UserConfiguration.PlayerName + " won " + creatorName + "'s \"" + badgeName + "\" award!";
|
||||
}
|
||||
|
||||
public override async Task OnRequest(object sender, SessionEventArgs e)
|
||||
{
|
||||
await Util.Delay(1000);
|
||||
string query = e.HttpClient.Request.RequestUri.Query;
|
||||
long badgeid = 0;
|
||||
long userid = 0;
|
||||
if (!long.TryParse(NetFuncs.FindQueryString(query, "badgeid"), out badgeid) &&
|
||||
!long.TryParse(NetFuncs.FindQueryString(query, "userid"), out userid))
|
||||
{
|
||||
e.GenericResponse("", HttpStatusCode.BadRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
BadgeData meta = LoadMetadata(badgeid);
|
||||
|
||||
string badgeAwardString = GenerateBadgeString(meta.BadgeCreatorName, meta.BadgeName, badgeid);
|
||||
AddBadgeToDB(badgeid, true);
|
||||
e.Ok(badgeAwardString, NetFuncs.GenerateHeaders(badgeAwardString.Length.ToString()));
|
||||
}
|
||||
}
|
@ -16,6 +16,11 @@ public class StudioLaunchPage : IWebProxyExtension
|
||||
return "Studio Launch Page Extension";
|
||||
}
|
||||
|
||||
public override string Author()
|
||||
{
|
||||
return "Bitl";
|
||||
}
|
||||
|
||||
public override bool IsValidURL(string absolutePath, string host)
|
||||
{
|
||||
return absolutePath.EndsWith("/ide/landing.aspx") || absolutePath.EndsWith("/my/places.aspx");
|
||||
|
@ -16,6 +16,11 @@ public class UploadWarnings : IWebProxyExtension
|
||||
return "Upload Dialog Warnings Extension";
|
||||
}
|
||||
|
||||
public override string Author()
|
||||
{
|
||||
return "Bitl";
|
||||
}
|
||||
|
||||
public override bool IsValidURL(string absolutePath, string host)
|
||||
{
|
||||
return absolutePath.EndsWith("/uploadmedia/postimage.aspx") || absolutePath.EndsWith("/uploadmedia/uploadvideo.aspx");
|
||||
|
@ -108,6 +108,7 @@ del /s /q Novetus\config\ReShade.ini
|
||||
del /s /q Novetus\config\config.ini
|
||||
del /s /q Novetus\config\config_customization.ini
|
||||
del /s /q Novetus\config\initialfilelist.txt
|
||||
del /s /q Novetus\config\BadgeDatabase.ini
|
||||
|
||||
del /s /q Novetus\config\clients\GlobalSettings2_2007E.xml
|
||||
del /s /q Novetus\config\clients\GlobalSettings2_2007E-Shaders.xml
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user