mirror of
https://github.com/recroom2016/OpenRec.git
synced 2026-04-22 13:25:51 +00:00
2017 support in the works
This commit is contained in:
77
APIServer.cs
77
APIServer.cs
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using api;
|
||||
using api2018;
|
||||
using api2017;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace server
|
||||
@@ -30,7 +31,7 @@ namespace server
|
||||
try
|
||||
{
|
||||
this.listener.Prefixes.Add("http://localhost:" + start.Program.version + "/");
|
||||
if (start.Program.version == "2016")
|
||||
if (start.Program.version == "2017")
|
||||
{
|
||||
for (; ; )
|
||||
{
|
||||
@@ -68,60 +69,34 @@ namespace server
|
||||
{
|
||||
s = Config2.GetDebugConfig();
|
||||
}
|
||||
if (Url == "platformlogin/v1/profiles")
|
||||
{
|
||||
s = getorcreate.GetOrCreateArray((ulong.Parse(text.Remove(0, 32))));
|
||||
CachedPlayerID = ulong.Parse(text.Remove(0, 32));
|
||||
CachedPlatformID = ulong.Parse(text.Remove(0, 22));
|
||||
}
|
||||
if (Url == "platformlogin/v6")
|
||||
{
|
||||
s = PlatformLogin.v4(CachedPlayerID);
|
||||
}
|
||||
if (Url == "PlayerReporting/v1/moderationBlockDetails")
|
||||
{
|
||||
s = ModerationBlockDetails;
|
||||
}
|
||||
if (Url == "config/v1/amplitude")
|
||||
{
|
||||
s = Amplitude.amplitude();
|
||||
}
|
||||
if (Url.StartsWith("players/v1/"))
|
||||
{
|
||||
s = getorcreate.GetOrCreate(CachedPlayerID);
|
||||
}
|
||||
Console.WriteLine("API Response: " + s);
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(s);
|
||||
response.ContentLength64 = (long)bytes.Length;
|
||||
Stream outputStream = response.OutputStream;
|
||||
outputStream.Write(bytes, 0, bytes.Length);
|
||||
Thread.Sleep(400);
|
||||
outputStream.Close();
|
||||
this.listener.Stop();
|
||||
}
|
||||
}
|
||||
else if (start.Program.version == "2017")
|
||||
{
|
||||
for (; ; )
|
||||
{
|
||||
this.listener.Start();
|
||||
Console.WriteLine("APIServer.cs is listening.");
|
||||
HttpListenerContext context = this.listener.GetContext();
|
||||
HttpListenerRequest request = context.Request;
|
||||
HttpListenerResponse response = context.Response;
|
||||
string rawUrl = request.RawUrl;
|
||||
string Url = "";
|
||||
if (rawUrl.StartsWith("/api/"))
|
||||
{
|
||||
Url = rawUrl.Remove(0, 5);
|
||||
}
|
||||
string text;
|
||||
string s = "";
|
||||
using (StreamReader streamReader = new StreamReader(request.InputStream, request.ContentEncoding))
|
||||
{
|
||||
text = streamReader.ReadToEnd();
|
||||
}
|
||||
if (!(Url == ""))
|
||||
{
|
||||
Console.WriteLine("API Requested: " + Url);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("API Requested: " + rawUrl);
|
||||
}
|
||||
Console.WriteLine("API Data: " + text);
|
||||
if (Url.StartsWith("versioncheck"))
|
||||
{
|
||||
s = VersionCheckResponse;
|
||||
}
|
||||
if (Url == ("config/v2"))
|
||||
{
|
||||
s = Config2.GetDebugConfig();
|
||||
}
|
||||
Console.WriteLine("API Response: " + s);
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(s);
|
||||
response.ContentLength64 = (long)bytes.Length;
|
||||
Stream outputStream = response.OutputStream;
|
||||
outputStream.Write(bytes, 0, bytes.Length);
|
||||
Thread.Sleep(400);
|
||||
Thread.Sleep(200);
|
||||
outputStream.Close();
|
||||
this.listener.Stop();
|
||||
}
|
||||
@@ -299,7 +274,7 @@ namespace server
|
||||
response.ContentLength64 = (long)bytes.Length;
|
||||
Stream outputStream = response.OutputStream;
|
||||
outputStream.Write(bytes, 0, bytes.Length);
|
||||
Thread.Sleep(100);
|
||||
Thread.Sleep(200);
|
||||
outputStream.Close();
|
||||
this.listener.Stop();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace api
|
||||
{
|
||||
return JsonConvert.SerializeObject(new Amplitude
|
||||
{
|
||||
AmplitudeKey = "e1693a1003671058b6abc356c8ba8d59"
|
||||
AmplitudeKey = "NoKeyProvided"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -65,20 +65,20 @@ namespace gamesessions2018
|
||||
public static string Create(string jsonData)
|
||||
{
|
||||
Console.WriteLine("Custom Room Test...");
|
||||
GameSessions.CreateRequest createRequest = JsonConvert.DeserializeObject<GameSessions.CreateRequest>(jsonData);
|
||||
GameSessions.JoinRandomRequest createRequest = JsonConvert.DeserializeObject<GameSessions.JoinRandomRequest>(jsonData);
|
||||
{
|
||||
Config.localGameSession = new GameSessions.SessionInstance
|
||||
{
|
||||
GameSessionId = 1L,
|
||||
GameSessionId = 20181L,
|
||||
RegionId = "us",
|
||||
RoomId = createRequest.ActivityLevelIds,
|
||||
RoomId = createRequest.ActivityLevelIds[0],
|
||||
RecRoomId = null,
|
||||
EventId = null,
|
||||
CreatorPlayerId = (long?)APIServer.CachedPlayerID,
|
||||
Name = "Custom Room",
|
||||
ActivityLevelId = createRequest.ActivityLevelIds,
|
||||
ActivityLevelId = createRequest.ActivityLevelIds[0],
|
||||
Private = false,
|
||||
Sandbox = createRequest.IsSandbox,
|
||||
Sandbox = true,
|
||||
SupportsScreens = true,
|
||||
SupportsVR = true,
|
||||
GameInProgress = false,
|
||||
@@ -275,7 +275,7 @@ namespace gamesessions2018
|
||||
{
|
||||
public bool IsSandbox { get; set; }
|
||||
|
||||
public string ActivityLevelIds { get; set; }
|
||||
public string[] ActivityLevelIds { get; set; }
|
||||
|
||||
public ulong[] ExpectedPlayerIds { get; set; }
|
||||
|
||||
|
||||
63
GetOrCreates.cs
Normal file
63
GetOrCreates.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace api2017
|
||||
{
|
||||
// Token: 0x0200003A RID: 58
|
||||
internal class getorcreate
|
||||
{
|
||||
public static string GetOrCreate(ulong userid)
|
||||
{
|
||||
int level = int.Parse(File.ReadAllText("SaveData\\Profile\\level.txt"));
|
||||
string name = File.ReadAllText("SaveData\\Profile\\username.txt");
|
||||
return JsonConvert.SerializeObject(new Profiles
|
||||
{
|
||||
Id = userid,
|
||||
Username = name,
|
||||
DisplayName = name,
|
||||
XP = 48,
|
||||
Level = level,
|
||||
Reputation = 0,
|
||||
Verified = true,
|
||||
Developer = true,
|
||||
HasEmail = true,
|
||||
CanReceiveInvites = false,
|
||||
ProfileImageName = name,
|
||||
HasBirthday = true
|
||||
});
|
||||
}
|
||||
// Token: 0x06000197 RID: 407 RVA: 0x0000550C File Offset: 0x0000370C
|
||||
public static string GetOrCreateArray(ulong userid)
|
||||
{
|
||||
int level = int.Parse(File.ReadAllText("SaveData\\Profile\\level.txt"));
|
||||
string name = File.ReadAllText("SaveData\\Profile\\username.txt");
|
||||
return JsonConvert.SerializeObject(new Profiles[]
|
||||
{
|
||||
new Profiles
|
||||
{
|
||||
Id = userid,
|
||||
Username = name,
|
||||
DisplayName = name,
|
||||
XP = 48,
|
||||
Level = level,
|
||||
Reputation = 0,
|
||||
Verified = true,
|
||||
Developer = true,
|
||||
HasEmail = true,
|
||||
CanReceiveInvites = false,
|
||||
ProfileImageName = name,
|
||||
JuniorProfile = false,
|
||||
ForceJuniorImages = false,
|
||||
HasBirthday = true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Token: 0x06000199 RID: 409 RVA: 0x00002BBE File Offset: 0x00000DBE
|
||||
public static string playerName()
|
||||
{
|
||||
return File.ReadAllText("playerNameConfig.txt");
|
||||
}
|
||||
}
|
||||
}
|
||||
36
PlatformLogin.cs
Normal file
36
PlatformLogin.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace api2017
|
||||
{
|
||||
// Token: 0x02000032 RID: 50
|
||||
internal class PlatformLogin
|
||||
{
|
||||
// Token: 0x17000070 RID: 112
|
||||
// (get) Token: 0x06000137 RID: 311 RVA: 0x00002905 File Offset: 0x00000B05
|
||||
// (set) Token: 0x06000138 RID: 312 RVA: 0x0000290D File Offset: 0x00000B0D
|
||||
public string Token { get; set; }
|
||||
|
||||
// Token: 0x17000071 RID: 113
|
||||
// (get) Token: 0x06000139 RID: 313 RVA: 0x00002916 File Offset: 0x00000B16
|
||||
// (set) Token: 0x0600013A RID: 314 RVA: 0x0000291E File Offset: 0x00000B1E
|
||||
public ulong PlayerId { get; set; }
|
||||
|
||||
// Token: 0x17000072 RID: 114
|
||||
// (get) Token: 0x0600013B RID: 315 RVA: 0x00002927 File Offset: 0x00000B27
|
||||
// (set) Token: 0x0600013C RID: 316 RVA: 0x0000292F File Offset: 0x00000B2F
|
||||
public string Error { get; set; }
|
||||
|
||||
// Token: 0x0600013D RID: 317 RVA: 0x00005114 File Offset: 0x00003314
|
||||
public static string v4(ulong userid)
|
||||
{
|
||||
PlatformLogin value = new PlatformLogin
|
||||
{
|
||||
Token = "j3923mHJG032jew",
|
||||
PlayerId = userid,
|
||||
Error = ""
|
||||
};
|
||||
return JsonConvert.SerializeObject(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Profiles.cs
18
Profiles.cs
@@ -2,12 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace api2016
|
||||
|
||||
namespace api2017
|
||||
{
|
||||
class Profiles
|
||||
{
|
||||
|
||||
public ulong Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
@@ -15,27 +13,13 @@ namespace api2016
|
||||
public int Level { get; set; }
|
||||
public int Reputation { get; set; }
|
||||
public bool Verified { get; set; }
|
||||
|
||||
public bool Developer { get; set; }
|
||||
|
||||
|
||||
public bool HasEmail { get; set; }
|
||||
|
||||
|
||||
public bool CanReceiveInvites { get; set; }
|
||||
|
||||
|
||||
public string ProfileImageName { get; set; }
|
||||
|
||||
|
||||
public bool JuniorProfile { get; set; }
|
||||
|
||||
|
||||
public bool ForceJuniorImages { get; set; }
|
||||
|
||||
|
||||
public bool PendingJunior { get; set; }
|
||||
|
||||
public bool HasBirthday { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
17
Program.cs
17
Program.cs
@@ -23,11 +23,20 @@ namespace start
|
||||
Console.WriteLine("Discord: https://discord.gg/daC8QUhnFP" + Environment.NewLine);
|
||||
if (!(new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/version.txt").Contains(version)))
|
||||
{
|
||||
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") + Environment.NewLine);
|
||||
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"));
|
||||
}
|
||||
Console.WriteLine("1) Change Settings" + Environment.NewLine + "2) Modify Profile" + Environment.NewLine + "3) Start Server");
|
||||
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")
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine(new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/changelog.txt"));
|
||||
Console.WriteLine("Press any key to continue:");
|
||||
Console.ReadKey();
|
||||
Console.Clear();
|
||||
goto Start;
|
||||
}
|
||||
if (readline == "2")
|
||||
{
|
||||
Console.Clear();
|
||||
goto Settings;
|
||||
@@ -69,7 +78,7 @@ namespace start
|
||||
goto Start;
|
||||
}
|
||||
}
|
||||
if (readline == "2")
|
||||
if (readline == "3")
|
||||
{
|
||||
Console.Clear();
|
||||
goto Profile;
|
||||
@@ -152,7 +161,7 @@ namespace start
|
||||
goto Start;
|
||||
}
|
||||
}
|
||||
if (readline == "3")
|
||||
if (readline == "4")
|
||||
{
|
||||
Console.WriteLine("Please select the version of RecRoom the server should host: (2017, 2018)");
|
||||
string readline2 = Console.ReadLine();
|
||||
|
||||
Reference in New Issue
Block a user