This commit is contained in:
recroom2016tutorial
2022-03-17 00:29:54 -04:00
parent aab1932199
commit 3bd0fa5ba3
5 changed files with 131 additions and 51 deletions

View File

@@ -28,7 +28,7 @@ namespace server
{
try
{
//3 different servers for 3 different stages of the game, the apis change so much idk anymore
//2 different servers for 2 different stages of the game, the apis change so much idk anymore
this.listener.Prefixes.Add("http://localhost:" + start.Program.version + "/");
if (start.Program.version == "2017")
{
@@ -74,6 +74,13 @@ namespace server
CachedPlayerID = ulong.Parse(text.Remove(0, 32));
CachedPlatformID = ulong.Parse(text.Remove(0, 22));
File.WriteAllText("SaveData\\Profile\\userid.txt", Convert.ToString(CachedPlayerID));
if (new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/banned.txt").Contains(File.ReadAllText("SaveData\\Profile\\userid.txt")))
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You are banned. Using this version of OpenRec will not work, please download OpenRec 0.4.2 or prior.");
Console.ForegroundColor = ConsoleColor.Green;
start.Program.bannedflag = true;
}
}
if (Url == "platformlogin/v6")
{
@@ -82,6 +89,10 @@ namespace server
if (Url == "PlayerReporting/v1/moderationBlockDetails")
{
s = ModerationBlockDetails;
if (start.Program.bannedflag == true)
{
s = Banned;
}
}
if (Url == "config/v1/amplitude")
{
@@ -175,6 +186,7 @@ namespace server
string rawUrl = request.RawUrl;
string Url = "";
byte[] bytes = null;
string signature = request.Headers.Get("X-RNSIG");
if (rawUrl.StartsWith("/api/"))
{
Url = rawUrl.Remove(0, 5);
@@ -216,6 +228,13 @@ namespace server
CachedPlayerID = ulong.Parse(text.Remove(0, 32));
CachedPlatformID = ulong.Parse(text.Remove(0, 22));
File.WriteAllText("SaveData\\Profile\\userid.txt", Convert.ToString(CachedPlayerID));
if (new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/banned.txt").Contains(File.ReadAllText("SaveData\\Profile\\userid.txt")))
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You are banned. Using this version of OpenRec will not work, please download OpenRec 0.4.2 or prior.");
Console.ForegroundColor = ConsoleColor.Green;
start.Program.bannedflag = true;
}
}
if (Url == "platformlogin/v1/loginaccount")
{
@@ -248,6 +267,10 @@ namespace server
if (Url == "PlayerReporting/v1/moderationBlockDetails")
{
s = ModerationBlockDetails;
if (start.Program.bannedflag == true)
{
s = Banned;
}
}
if (Url == "//api/chat/v2/myChats?mode=0&count=50")
{
@@ -381,11 +404,9 @@ namespace server
{
bytes = Encoding.UTF8.GetBytes((JsonConvert.SerializeObject(gamesessions2018.GameSessions2.JoinRoom(text))));
}
if (rawUrl.Contains("//api/images/v4/uploadtransient?gameSessionId=2018"))
{
File.WriteAllBytes("SaveData\\Images\\image" + Convert.ToString(int.Parse(File.ReadAllText("SaveData\\Images\\count.txt") + 1)) + ".png", Encoding.UTF8.GetBytes(text.Remove(0, 50).Remove(text.Length - 48, 48)));
int imagecount = int.Parse(File.ReadAllText("SaveData\\Images\\count.txt"));
File.WriteAllText("SaveData\\Images\\count.txt", Convert.ToString(imagecount + 1));
if (rawUrl == "//api/sanitize/v1/isPure")
{
s = JsonConvert.SerializeObject(Sanitize.SanitizeRequest(text));
}
if (Url == "avatar/v3/saved")
{
@@ -430,7 +451,8 @@ namespace server
public static string VersionCheckResponse = "{\"ValidVersion\":true}";
public static string ModerationBlockDetails = "{\"ReportCategory\":0,\"Duration\":0,\"GameSessionId\":0,\"Message\":\"\"}";
public static string ImagesV2Named = "[{\"FriendlyImageName\":\"DormRoomBucket\",\"ImageName\":\"OpenRec\",\"StartTime\":\"2021-12-27T21:27:38.1880175-08:00\",\"EndTime\":\"2043-12-27T21:27:38.1880399-08:00\"}";
public static string Banned = "{\"ReportCategory\":1,\"Duration\":10,\"GameSessionId\":100,\"Message\":\"You have been banned. You are probably a little kid and are now whining at your VR headset. If you aren't a little kid, DM me to appeal.\"}";
private HttpListener listener = new HttpListener();
}
}

72
Class1.cs Normal file
View File

@@ -0,0 +1,72 @@
using System;
using Newtonsoft.Json;
namespace api2018
{
// Token: 0x02000081 RID: 129
public class Sanitize
{
// Token: 0x0600039D RID: 925 RVA: 0x0000C51C File Offset: 0x0000A71C
public static Sanitize.SanitizeRequestDTO SanitizeChatRequest(string chatMessage)
{
Sanitize.SanitizePostDTO sanitizePostDTO = JsonConvert.DeserializeObject<Sanitize.SanitizePostDTO>(chatMessage);
return new Sanitize.SanitizeRequestDTO
{
StringValue = sanitizePostDTO.Value
};
}
// Token: 0x0600039E RID: 926 RVA: 0x0000C51C File Offset: 0x0000A71C
public static Sanitize.SanitizeRequestDTO SanitizeRequest(string chatMessage)
{
Sanitize.SanitizePostDTO sanitizePostDTO = JsonConvert.DeserializeObject<Sanitize.SanitizePostDTO>(chatMessage);
return new Sanitize.SanitizeRequestDTO
{
StringValue = sanitizePostDTO.Value
};
}
// Token: 0x0600039F RID: 927 RVA: 0x0000C544 File Offset: 0x0000A744
public static string SanitizeChatMessageRequest(string postData, string signature)
{
Sanitize.SanitizePostDTO sanitizePostDTO = JsonConvert.DeserializeObject<Sanitize.SanitizePostDTO>(postData);
return "\"" + sanitizePostDTO.Value + "\"";
}
// Token: 0x02000082 RID: 130
public class SanitizePostDTO
{
// Token: 0x1700016F RID: 367
// (get) Token: 0x060003A1 RID: 929 RVA: 0x000039AA File Offset: 0x00001BAA
// (set) Token: 0x060003A2 RID: 930 RVA: 0x000039B2 File Offset: 0x00001BB2
public string Value { get; set; }
// Token: 0x17000170 RID: 368
// (get) Token: 0x060003A3 RID: 931 RVA: 0x000039BB File Offset: 0x00001BBB
// (set) Token: 0x060003A4 RID: 932 RVA: 0x000039C3 File Offset: 0x00001BC3
public int ReplacementChar { get; set; }
}
// Token: 0x02000083 RID: 131
public class SanitizeRequestDTO
{
// Token: 0x17000171 RID: 369
// (get) Token: 0x060003A6 RID: 934 RVA: 0x000039CC File Offset: 0x00001BCC
// (set) Token: 0x060003A7 RID: 935 RVA: 0x000039D4 File Offset: 0x00001BD4
public string StringValue { get; set; }
}
// Token: 0x02000084 RID: 132
public class SanitizeStringRequest
{
// Token: 0x060003A9 RID: 937 RVA: 0x000039DD File Offset: 0x00001BDD
public SanitizeStringRequest(string text)
{
this.value = text;
}
// Token: 0x040002E6 RID: 742
public string value;
}
}
}

View File

@@ -12,17 +12,21 @@ namespace gamesessions2018
public static string JoinRandom(string jsonData)
{
long? creatorid = 1243409L;
long gamesessionid = 2018L;
long gamesessionid = 20181L;
Console.WriteLine("OpenRec GameSession Room");
GameSessions.JoinRandomRequest joinRandomRequest = JsonConvert.DeserializeObject<GameSessions.JoinRandomRequest>(jsonData);
if (File.ReadAllText("SaveData\\App\\privaterooms.txt") == "Enabled")
{
gamesessionid = new Random().Next(0, 100);
gamesessionid = new Random().Next(0, 99);
}
if (start.Program.version == "2017")
{
creatorid = (long?)APIServer.CachedPlayerID;
}
if (start.Program.bannedflag == true)
{
gamesessionid = 100L;
}
Config.localGameSession = new GameSessions.SessionInstance
{
GameSessionId = gamesessionid,
@@ -64,14 +68,17 @@ namespace gamesessions2018
// Token: 0x060000C0 RID: 192 RVA: 0x00004D24 File Offset: 0x00002F24
public static string Create(string jsonData)
{
long gamesessionid = 2016L;
long gamesessionid = 20161L;
Console.WriteLine("OpenRec GameSession Custom Room");
if (File.ReadAllText("SaveData\\App\\privaterooms.txt") == "Enabled")
{
gamesessionid = new Random().Next(0, 100);
gamesessionid = new Random().Next(0, 99);
}
if (start.Program.bannedflag == true)
{
gamesessionid = 100L;
}
GameSessions.CreateRequest createRequest = JsonConvert.DeserializeObject<GameSessions.CreateRequest>(jsonData);
Config.localGameSession = new GameSessions.SessionInstance
{
GameSessionId = gamesessionid,

View File

@@ -26,6 +26,16 @@ namespace start
{
Console.WriteLine("This version of OpenRec is outdated. We recommend you install the latest version, OpenRec " + new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/version.txt"));
}
if (File.Exists("SaveData\\Profile\\userid.txt"))
{
if (new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/banned.txt").Contains(File.ReadAllText("SaveData\\Profile\\userid.txt")))
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You are banned. Using this version of OpenRec will not work, please download OpenRec 0.4.2 or prior.");
Console.ForegroundColor = ConsoleColor.Green;
bannedflag = true;
}
}
Console.WriteLine("1) Changelog" + Environment.NewLine +"2) Change Settings" + Environment.NewLine + "3) Modify Profile" + Environment.NewLine + "4) Start Server");
string readline = Console.ReadLine();
if (readline == "1")
@@ -116,7 +126,7 @@ namespace start
File.WriteAllText("SaveData\\Profile\\username.txt", newusername);
Console.Clear();
Console.WriteLine("Success!");
goto Start;
goto Profile;
}
else if (readline3 == "2")
{
@@ -139,7 +149,7 @@ namespace start
}
Console.Clear();
Console.WriteLine("Success!");
goto Start;
goto Profile;
}
else if (readline4 == "2")
{
@@ -159,7 +169,7 @@ namespace start
}
Console.Clear();
Console.WriteLine("Success!");
goto Start;
goto Profile;
}
else if (readline4 == "3")
{
@@ -186,17 +196,9 @@ namespace start
if (readline == "4")
{
Console.WriteLine("Please select the version of RecRoom the server should host: (2017 (Beta), 2018)");
Console.WriteLine("Please select the version of RecRoom the server should host: (2017, 2018)");
string readline2 = Console.ReadLine();
if (readline2 == "2016")
{
version = "2016";
Console.Clear();
Console.WriteLine("Version Selected: " + start.Program.version);
new APIServer();
new WebSocket();
}
else if (readline2 == "2017")
if (readline2 == "2017")
{
version = "2017";
Console.Clear();
@@ -215,33 +217,10 @@ namespace start
new WebSocket();
}
}
if (readline == "5")
{
Console.Clear();
goto ChatStart;
ChatStart:
Console.WriteLine("Pinging the chat servers...");
try
{
string ping = new WebClient().DownloadString("https://openrecchat.loca.lt/ping");
}
catch (Exception ex4)
{
Console.WriteLine("Chat servers currently offline...");
Console.WriteLine("Press any key to continue:");
Console.ReadKey();
goto Start;
}
Console.WriteLine("Success!");
Console.WriteLine("Press any key to continue:");
Console.ReadKey();
OpenRecNet.RecNet();
}
}
public static string version = "";
public static string appversion = "0.4.2";
public static string appversion = "0.5.0";
public static bool bannedflag = false;
}
}

View File

@@ -53,7 +53,7 @@ namespace start
}
if (!(File.Exists("SaveData\\Profile\\userid.txt")))
{
File.WriteAllText("SaveData\\Profile\\userid.txt", "2");
File.WriteAllText("SaveData\\Profile\\userid.txt", "10000000");
}
if (!(File.Exists("SaveData\\myrooms.txt")))
{