mirror of
https://github.com/Novetus/Novetus_src.git
synced 2025-01-31 09:41:33 +02:00
byebye query system, hello list/delist!
This commit is contained in:
parent
e1f1adc0fb
commit
b50bcb9ef0
14
LICENSE
14
LICENSE
@ -28,23 +28,19 @@ Note: Older Novetus versions will say that they are under the GPL, but they are
|
||||
Read it here https://github.com/Novetus/Novetus_src/blob/master/LICENCE or in LICENCE.txt.
|
||||
|
||||
------------------------------------------------------------
|
||||
query.php license (GPL 3.0)
|
||||
Master Server license (GPL 3.0)
|
||||
------------------------------------------------------------
|
||||
|
||||
This file is part of Novetus, but unlike the rest of the program where it is under the MIT license,
|
||||
this file is under the GPL 3.0 license.
|
||||
|
||||
Novetus's query.php is free software: you can redistribute it and/or modify
|
||||
Novetus' Master Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Novetus's query.php is distributed in the hope that it will be useful,
|
||||
Novetus' Master Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Novetus's query.php. If not, see <https://www.gnu.org/licenses/>.
|
||||
along with Novetus' Master Server. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Read it here https://github.com/Novetus/Novetus_src/blob/master/LICENSE-QUERY-PHP or in LICENSE-QUERY-PHP.txt.
|
||||
Read it here https://github.com/Novetus/Novetus_src/blob/master/LICENSE-MASTER-SERVER or in LICENSE-MASTER-SERVER.txt.
|
@ -349,7 +349,7 @@ namespace NovetusCMD
|
||||
static void ServerExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
GlobalFuncs.PingMasterServer(0, "The server has removed itself from the master server list.");
|
||||
GlobalFuncs.PingMasterServer(false, "The server has removed itself from the master server list.");
|
||||
CloseHandlerInternal();
|
||||
|
||||
}
|
||||
|
@ -1380,55 +1380,13 @@ public class GlobalFuncs
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void GeneratePlayerID()
|
||||
{
|
||||
CryptoRandom random = new CryptoRandom();
|
||||
int randomID = 0;
|
||||
int randIDmode = random.Next(0, 8);
|
||||
int idlimit = 0;
|
||||
|
||||
switch (randIDmode)
|
||||
{
|
||||
case 0:
|
||||
idlimit = 9;
|
||||
break;
|
||||
case 1:
|
||||
idlimit = 99;
|
||||
break;
|
||||
case 2:
|
||||
idlimit = 999;
|
||||
break;
|
||||
case 3:
|
||||
idlimit = 9999;
|
||||
break;
|
||||
case 4:
|
||||
idlimit = 99999;
|
||||
break;
|
||||
case 5:
|
||||
idlimit = 999999;
|
||||
break;
|
||||
case 6:
|
||||
idlimit = 9999999;
|
||||
break;
|
||||
case 7:
|
||||
idlimit = 99999999;
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (idlimit > 0)
|
||||
{
|
||||
randomID = random.Next(0, idlimit);
|
||||
}
|
||||
else
|
||||
{
|
||||
randomID = random.Next();
|
||||
}
|
||||
|
||||
//2147483647 is max id.
|
||||
GlobalVars.UserConfiguration.UserID = randomID;
|
||||
int randomID = SecurityFuncs.GenerateRandomNumber();
|
||||
//2147483647 is max id.
|
||||
GlobalVars.UserConfiguration.UserID = randomID;
|
||||
}
|
||||
|
||||
public static string GenerateAndReturnTripcode()
|
||||
@ -2334,9 +2292,11 @@ public class GlobalFuncs
|
||||
break;
|
||||
case ScriptType.Server:
|
||||
#if LAUNCHER
|
||||
PingMasterServer(1, "Server will now display on the defined master server.", box);
|
||||
PingMasterServer(true, "Server will now display on the defined master server.", box);
|
||||
ConsolePrint("Your server's ID is " + GlobalVars.ServerID, 4, box);
|
||||
#elif CMD
|
||||
PingMasterServer(1, "Server will now display on the defined master server.");
|
||||
PingMasterServer(true, "Server will now display on the defined master server.");
|
||||
ConsolePrint("Your server's ID is " + GlobalVars.ServerID, 4);
|
||||
#endif
|
||||
goto default;
|
||||
default:
|
||||
@ -2376,18 +2336,30 @@ public class GlobalFuncs
|
||||
}
|
||||
|
||||
#if LAUNCHER
|
||||
public static void PingMasterServer(int online, string reason, RichTextBox box)
|
||||
public static void PingMasterServer(bool online, string reason, RichTextBox box)
|
||||
#else
|
||||
public static void PingMasterServer(int online, string reason)
|
||||
public static void PingMasterServer(bool online, string reason)
|
||||
#endif
|
||||
{
|
||||
string pingURL = "http://" + GlobalVars.UserConfiguration.ServerBrowserServerAddress +
|
||||
"/query.php?name=" + GlobalVars.UserConfiguration.ServerBrowserServerName +
|
||||
string pingURL = "";
|
||||
|
||||
if (online)
|
||||
{
|
||||
GlobalVars.ServerID = SecurityFuncs.GenerateRandomNumber();
|
||||
pingURL = "http://" + GlobalVars.UserConfiguration.ServerBrowserServerAddress +
|
||||
"/list.php?name=" + GlobalVars.UserConfiguration.ServerBrowserServerName +
|
||||
"&ip=" + (!string.IsNullOrWhiteSpace(GlobalVars.UserConfiguration.AlternateServerIP) ? GlobalVars.UserConfiguration.AlternateServerIP : GlobalVars.ExternalIP) +
|
||||
"&port=" + GlobalVars.UserConfiguration.RobloxPort +
|
||||
"&client=" + GlobalVars.UserConfiguration.SelectedClient +
|
||||
"&version=" + GlobalVars.ProgramInformation.Version +
|
||||
"&online=" + online;
|
||||
"&version=" + GlobalVars.ProgramInformation.Version +
|
||||
"&id=" + GlobalVars.ServerID;
|
||||
}
|
||||
else
|
||||
{
|
||||
pingURL = "http://" + GlobalVars.UserConfiguration.ServerBrowserServerAddress +
|
||||
"/delist.php?id=" + GlobalVars.ServerID;
|
||||
GlobalVars.ServerID = 0;
|
||||
}
|
||||
|
||||
#if LAUNCHER
|
||||
ConsolePrint("Pinging master server. " + reason, 4, box);
|
||||
@ -2400,6 +2372,11 @@ public class GlobalFuncs
|
||||
#elif CMD
|
||||
ConsolePrint(response, response.Contains("ERROR:") ? 2 : 4);
|
||||
#endif
|
||||
|
||||
if (response.Contains("ERROR:"))
|
||||
{
|
||||
GlobalVars.ServerID = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OpenClient(ScriptType type, string rbxexe, string args, string clientname, string mapname, EventHandler e, bool customization = false)
|
||||
|
@ -96,6 +96,7 @@ public static class GlobalVars
|
||||
public static bool ColorsLoaded = false;
|
||||
public static int ValidatedExtraFiles = 0;
|
||||
public static bool NoFileList = false;
|
||||
public static int ServerID = 0;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
@ -28,6 +28,57 @@ public class SecurityFuncs
|
||||
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||
}
|
||||
|
||||
public static int GenerateRandomNumber()
|
||||
{
|
||||
CryptoRandom random = new CryptoRandom();
|
||||
int randomID = 0;
|
||||
int randIDmode = random.Next(0, 8);
|
||||
int idlimit = 0;
|
||||
|
||||
switch (randIDmode)
|
||||
{
|
||||
case 0:
|
||||
idlimit = 9;
|
||||
break;
|
||||
case 1:
|
||||
idlimit = 99;
|
||||
break;
|
||||
case 2:
|
||||
idlimit = 999;
|
||||
break;
|
||||
case 3:
|
||||
idlimit = 9999;
|
||||
break;
|
||||
case 4:
|
||||
idlimit = 99999;
|
||||
break;
|
||||
case 5:
|
||||
idlimit = 999999;
|
||||
break;
|
||||
case 6:
|
||||
idlimit = 9999999;
|
||||
break;
|
||||
case 7:
|
||||
idlimit = 99999999;
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (idlimit > 0)
|
||||
{
|
||||
randomID = random.Next(0, idlimit);
|
||||
}
|
||||
else
|
||||
{
|
||||
randomID = random.Next();
|
||||
}
|
||||
|
||||
//2147483647 is max id.
|
||||
return randomID;
|
||||
}
|
||||
|
||||
//these 2 methods are for the clientinfo creator.
|
||||
public static string Base64DecodeNew(string base64EncodedData)
|
||||
{
|
||||
|
@ -599,7 +599,7 @@ namespace NovetusLauncher
|
||||
void ServerExited(object sender, EventArgs e)
|
||||
{
|
||||
GlobalVars.GameOpened = ScriptType.None;
|
||||
GlobalFuncs.PingMasterServer(0, "The server has removed itself from the master server list.", ConsoleBox);
|
||||
GlobalFuncs.PingMasterServer(false, "The server has removed itself from the master server list.", ConsoleBox);
|
||||
ClientExitedBase(sender, e);
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,8 @@ namespace NovetusLauncher
|
||||
string line;
|
||||
while ((line = await reader.ReadLineAsync()) != null)
|
||||
{
|
||||
string DecodedLine = SecurityFuncs.Base64DecodeOld(line);
|
||||
string[] initialLine = line.Split('|');
|
||||
string DecodedLine = SecurityFuncs.Base64DecodeOld(initialLine[1]);
|
||||
string[] serverInfo = DecodedLine.Split('|');
|
||||
GameServer gameServer = new GameServer(serverInfo[0], serverInfo[1], serverInfo[2], serverInfo[3], serverInfo[4]);
|
||||
if (gameServer.IsValid())
|
||||
|
@ -1,4 +1,4 @@
|
||||
1.3 Snapshot v22.8250.17845.1
|
||||
1.3 Snapshot v22.8251.26754.1
|
||||
Enhancements:
|
||||
- The initial file list for the Mod Package Creator now checks if all lines are created on the file.
|
||||
- The initial file list now generates when launching the SDK if one is not generated already.
|
||||
@ -8,6 +8,8 @@ Enhancements:
|
||||
- This plugin is disabled by default, so the server host will have to enable it manually if they wish to enable this feature.
|
||||
- Made Master Server ping messages more verbose.
|
||||
- Improved the stability of master server pings.
|
||||
- The Master Server has been split into 2 files: list.php and delist.php
|
||||
- Each server has a randomly generated ID that is only visible to the server host (in the console) and the master server host (in serverlist.txt)
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
1.3 Snapshot v22.8245.27180.1
|
||||
|
36
delist.php
Normal file
36
delist.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
Novetus' Master Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Novetus' Master Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Novetus' Master Server. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Read it here https://github.com/Novetus/Novetus_src/blob/master/LICENSE-MASTER-SERVER or in LICENSE-MASTER-SERVER.txt.
|
||||
*/
|
||||
|
||||
//id
|
||||
$id = $_GET["id"];
|
||||
|
||||
if (!empty($id) and is_numeric($id))
|
||||
{
|
||||
$file = 'serverlist.txt';
|
||||
|
||||
foreach(file($file) as $line)
|
||||
{
|
||||
if (strpos($line, $id) !== false)
|
||||
{
|
||||
$file_contents = file_get_contents($file);
|
||||
$contents = str_replace($line, '', $file_contents);
|
||||
file_put_contents($file, $contents);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
45
list.php
Normal file
45
list.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
Novetus' Master Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Novetus' Master Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Novetus' Master Server. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Read it here https://github.com/Novetus/Novetus_src/blob/master/LICENSE-MASTER-SERVER or in LICENSE-MASTER-SERVER.txt.
|
||||
*/
|
||||
|
||||
//NOVETUS MASTER SERVER QUERY CODE
|
||||
//thanks to idkwhatnametoget for the port fix
|
||||
|
||||
//name
|
||||
$name = $_GET["name"];
|
||||
//port
|
||||
$port = $_GET["port"];
|
||||
//client
|
||||
$client = $_GET["client"];
|
||||
//version
|
||||
$version = $_GET["version"];
|
||||
//id
|
||||
$id = $_GET["id"];
|
||||
|
||||
if (!empty($port) and $port < 65535 and is_numeric($port) and !empty($name) and !empty($client) and !empty($version) and !empty($id) and is_numeric($id))
|
||||
{
|
||||
//server ip
|
||||
$ip = $_GET["ip"];
|
||||
|
||||
$file = 'serverlist.txt';
|
||||
|
||||
//ONLY the $name and $client arguments will show up in the master server!
|
||||
$text = $id.'|'.base64_encode(base64_encode($name).'|'.base64_encode($ip).'|'.base64_encode($port).'|'.base64_encode($client).'|'.base64_encode($version))."\r\n";
|
||||
|
||||
file_put_contents($file, $text, FILE_APPEND);
|
||||
}
|
||||
?>
|
83
query.php
83
query.php
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of Novetus, but unlike the rest of the program where it is under the MIT license,
|
||||
this file is under the GPL 3.0 license.
|
||||
|
||||
Novetus's query.php is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Novetus's query.php is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Novetus's query.php. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//NOVETUS MASTER SERVER QUERY CODE
|
||||
//thanks to idkwhatnametoget for the port fix
|
||||
|
||||
//name
|
||||
$name = $_GET["name"];
|
||||
//port
|
||||
$port = $_GET["port"];
|
||||
//client
|
||||
$client = $_GET["client"];
|
||||
//version
|
||||
$version = $_GET["version"];
|
||||
|
||||
if (!empty($port) and $port < 65535 and is_numeric($port) and !empty($name) and !empty($client) and !empty($version))
|
||||
{
|
||||
//server ip
|
||||
$ip = $_GET["ip"];
|
||||
//online status
|
||||
$online = $_GET["online"];
|
||||
|
||||
//strings
|
||||
$deleteentry = 1;
|
||||
$status = "Offline";
|
||||
|
||||
$file = 'serverlist.txt';
|
||||
|
||||
//ONLY the $name and $client arguments will show up in the master server!
|
||||
$text = base64_encode(base64_encode($name).'|'.base64_encode($ip).'|'.base64_encode($port).'|'.base64_encode($client).'|'.base64_encode($version))."\r\n";
|
||||
|
||||
if ($online == 1)
|
||||
{
|
||||
$deleteentry = 0;
|
||||
|
||||
foreach(file($file) as $line)
|
||||
{
|
||||
if (strpos($line, $text) !== false)
|
||||
{
|
||||
$file_contents = file_get_contents($file);
|
||||
$contents = str_replace($line, '', $file_contents);
|
||||
file_put_contents($file, $contents);
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents($file, $text, FILE_APPEND);
|
||||
|
||||
$status = "Online";
|
||||
}
|
||||
|
||||
if ($deleteentry == 1)
|
||||
{
|
||||
foreach(file($file) as $line)
|
||||
{
|
||||
if (strpos($line, $text) !== false)
|
||||
{
|
||||
$file_contents = file_get_contents($file);
|
||||
$contents = str_replace($line, '', $file_contents);
|
||||
file_put_contents($file, $contents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Display the server info to browsers.
|
||||
echo "" . htmlspecialchars($name) . ". A " . htmlspecialchars($client) . " server running on ". htmlspecialchars($version) .". Server Status: " . htmlspecialchars($status) . "";
|
||||
}
|
||||
?>
|
@ -135,10 +135,11 @@ XCOPY "%cd%\litefiles\Novetus_dependency_installer.bat" "%scriptsdir%\batch\Nove
|
||||
XCOPY "%cd%\Novetus\Novetus_launcher_legacy.bat" "%scriptsdir%\batch" /y
|
||||
XCOPY "%cd%\Novetus\documentation.txt" "%dest%" /y
|
||||
XCOPY /c "%cd%\Novetus\.itch.toml" "%dest%" /y
|
||||
XCOPY "%cd%\Novetus\query.php" "%dest%" /y
|
||||
XCOPY "%cd%\Novetus\masterserver\list.php" "%dest%" /y
|
||||
XCOPY "%cd%\Novetus\masterserver\delist.php" "%dest%" /y
|
||||
XCOPY "%cd%\Novetus\masterserver\LICENSE-MASTER-SERVER.txt" "%dest%\LICENSE-MASTER-SERVER" /y
|
||||
XCOPY "%cd%\Novetus\changelog.txt" "%dest%\changelog.txt" /y
|
||||
XCOPY "%cd%\Novetus\LICENSE.txt" "%dest%\LICENSE" /y
|
||||
XCOPY "%cd%\Novetus\LICENSE-QUERY-PHP.txt" "%dest%\LICENSE-QUERY-PHP" /y
|
||||
XCOPY "%cd%\Novetus\LICENSE-RESHADE.txt" "%dest%\LICENSE-RESHADE" /y
|
||||
XCOPY "%cd%\Novetus\README-AND-CREDITS.TXT" "%dest%" /y
|
||||
XCOPY "%cd%\Novetus\addons\Addon_Template.lua" "%dest%" /y
|
||||
|
Loading…
Reference in New Issue
Block a user