This commit is contained in:
Raidenxd2
2026-08-07 04:45:59 -04:00
commit 255b572a6f
219 changed files with 1652469 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
namespace asdfasdf.APIs;
public static class AI
{
public static void Init(WebApplication app)
{
app.MapGet("/roomieai/user/access", () =>
{
RoomieUserAccess userAccess = new()
{
error = "All purchased Roomie energy has been used",
error_id = "AI.InsufficientRoomieAICreditNoSub",
success = false
};
return userAccess;
});
}
}
+577
View File
@@ -0,0 +1,577 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
namespace asdfasdf.APIs;
public static class API
{
public static ApiResponse SuccessResponse;
public static void Init(WebApplication app)
{
SuccessResponse = new()
{
success = true,
error = string.Empty
};
if (!File.Exists("ServerData/CharadeWords.json"))
{
List<CharadeWord> cw = new();
cw.Add(new(0, "Lemres"));
cw.Add(new(1, "your mom"));
cw.Add(new(2, "F"));
cw.Add(new(3, "Gamer"));
cw.Add(new(4, "Gaming chair"));
cw.Add(new(5, "Gaming keyboard"));
cw.Add(new(6, "Oculus Quest 4"));
cw.Add(new(7, "Nintendo Switch 3"));
cw.Add(new(8, "PlayStation 6"));
cw.Add(new(9, "GTA 7"));
cw.Add(new(10, "Black Shoe"));
cw.Add(new(11, "Xbox 720"));
cw.Add(new(12, "wii phone"));
cw.Add(new(13, "Valve Index 2"));
cw.Add(new(14, "BONEWORKS"));
cw.Add(new(15, "BONELAB"));
cw.Add(new(16, "Sonic"));
cw.Add(new(17, "Fuck you you don't get a word"));
cw.Add(new(18, "Rec room 2"));
cw.Add(new(19, "4DCharades"));
cw.Add(new(20, "ONE TWO THREE FOUR BADADADADADADAA BBBBB"));
cw.Add(new(21, "puyo puyo"));
cw.Add(new(22, "t-spin"));
cw.Add(new(23, "garry's mod"));
cw.Add(new(24, "Merge conflict"));
cw.Add(new(25, "Hi. I hate you. I hope you die."));
cw.Add(new(26, "The entirety of North Korea"));
cw.Add(new(27, "Gaming controller"));
cw.Add(new(28, "the"));
cw.Add(new(29, "ENA"));
cw.Add(new(30, "N"));
cw.Add(new(31, "No peeking!"));
File.WriteAllText("ServerData/CharadeWords.json", JsonSerializer.Serialize(cw));
}
if (!File.Exists("ServerData/RoomFilters.json"))
{
RoomFilters filters = new();
filters.PinnedFilters = new();
filters.PopularFilters = new();
filters.TrendingFilters = new();
filters.PinnedFilters.Add("recroomoriginal");
filters.PinnedFilters.Add("community");
filters.PinnedFilters.Add("featured");
filters.PinnedFilters.Add("quest");
filters.PinnedFilters.Add("pvp");
filters.PinnedFilters.Add("hangout");
filters.PinnedFilters.Add("game");
filters.PinnedFilters.Add("art");
filters.PinnedFilters.Add("store");
filters.PinnedFilters.Add("tutorial");
filters.PinnedFilters.Add("fandom");
filters.PinnedFilters.Add("performance");
filters.PinnedFilters.Add("action");
filters.PinnedFilters.Add("horror");
filters.PopularFilters.Add("pvp");
filters.PopularFilters.Add("quest");
filters.PopularFilters.Add("game");
filters.PopularFilters.Add("hangout");
filters.PopularFilters.Add("art");
filters.TrendingFilters.Add("roleplay");
filters.TrendingFilters.Add("nomp");
filters.TrendingFilters.Add("rp");
filters.TrendingFilters.Add("casual");
filters.TrendingFilters.Add("fun");
filters.TrendingFilters.Add("action");
filters.TrendingFilters.Add("military");
filters.TrendingFilters.Add("sports");
File.WriteAllText("ServerData/RoomFilters.json", JsonSerializer.Serialize(filters));
}
app.MapGet("/api/gameconfigs/v1/all", () => File.ReadAllText("gameconfig.json"));
app.MapGet("/api/customAvatarItems/v1/isCreationAllowedForAccount", () =>
{
app.Logger.LogWarning("(API) /api/customAvatarItems/v1/isCreationAllowedForAccount STUB");
CustomAvatarItems_CreationAllowed creationAllowed = new()
{
success = true
};
return creationAllowed;
});
app.MapGet("/api/customAvatarItems/v1/me", () => {
app.Logger.LogWarning("(API) /api/customAvatarItems/v1/me STUB");
return "[]";
});
app.MapPost("/api/customAvatarItems/v1/bulk", () =>
{
app.Logger.LogWarning("(API) /api/customAvatarItems/v1/bulk STUB");
// List<BulkCustomAvatarItem> avatarItems = new();
//
// BulkCustomAvatarItem avatarItem = new()
// {
// Accessibility = 2,
// CreatedAt = "2024-11-06T20:55:26.184Z",
// CreatorAccountId = 1,
// CustomAvatarItemId = "e396c94f-5e76-438f-9ed5-c6174011d239",
// CurrentSaves = Array.Empty<Object>(),
// ForceCannotPublish = false,
// IsFeatured = false,
// IsRecRoomApproved = true,
// ModifiedAt = "2024-11-06T20:55:26.184Z",
// Name = "(UGCTee_Shirt)",
// OutfitType = 101,
// PreviewOrientation = 0,
// Price = 0,
// RankedEntityId = "e396c94f-5e76-438f-9ed5-c6174011d239",
// Tags = Array.Empty<Object>(),
// };
//
// BulkCustomAvatarItem avatarItem2 = new()
// {
// Accessibility = 2,
// CreatedAt = "2024-11-05T23:44:26.452Z",
// CreatorAccountId = 1,
// CustomAvatarItemId = "8c03db9e-ea46-48f9-a114-3afd18454e31",
// CurrentSaves = Array.Empty<Object>(),
// ForceCannotPublish = false,
// IsFeatured = false,
// IsRecRoomApproved = true,
// ModifiedAt = "2024-11-05T23:44:26.452Z",
// Name = "(UGCPulloverHoodie_Shirt)",
// OutfitType = 101,
// PreviewOrientation = 0,
// Price = 0,
// RankedEntityId = "8c03db9e-ea46-48f9-a114-3afd18454e31",
// Tags = Array.Empty<Object>(),
// };
//
// avatarItems.Add(avatarItem);
// avatarItems.Add(avatarItem2);
return Results.Created("/api/customAvatarItems/v1/bulk", "[]");
});
app.MapGet("/api/versioncheck/v4", (string v, int p) =>
{
app.Logger.LogInformation("VersionCheck: " + v + " " + p);
VersionCheckObject ver = new()
{
VersionStatus = 0,
UpdateNotificationStage = 0,
IsVersionIslanded = false,
IsCrossPlayDisabled = false,
};
return ver;
});
// It's also like this on the actual API
app.MapGet("/api/versioncheck/islandedversions", () => "[]");
app.MapGet("/api/keepsakes/categories", () =>
{
app.Logger.LogWarning("(API) /api/keepsakes/categories STUB");
return File.ReadAllText("keepsakes_categories.json");
});
app.MapGet("/api/progressionEvents/event/18", () =>
{
app.Logger.LogWarning("(API) /api/progressionEvents/event/18 STUB");
ProgressionEvent progressionEvent = new()
{
ActiveExperiment = "liveops_2025q4_yeti",
BoostDailyGameplayMinutesLimit = 0,
BoosXpMultiplier = 0,
CollectionEndTime = DateTime.Now.AddMonths(-1),
EventInfoImageName = "DefaultProfileImage.png",
EventLeaderboardId = 18,
InitialCurrencyGrant = 300,
IsEnabled = false,
Name = "Yetis challenge",
ProgressionEventId = 18,
PurchasableXpBoostId = "e4a7b4d4-f609-4008-9874-f6cd01b896ea",
StartTime = DateTime.Now.AddMonths(-2),
UsesBoost = false
};
return progressionEvent;
});
app.MapGet("/api/players/v2/progression/bulk", (int id) =>
{
app.Logger.LogWarning("(API) /api/players/v2/progression/bulk STUB\n" + id);
List<Progression> progressions = new();
Progression progression = new()
{
Level = 50,
PlayerId = Accounts.account.accountId,
XP = 0
};
progressions.Add(progression);
return progressions;
});
app.Map("/api/PlayerReporting/v1/moderationBlockDetails", () =>
{
// var a = await request.ReadFormAsync();
// var a1 = a.ElementAt(0);
app.Logger.LogWarning("(API) /api/PlayerReporting/v1/moderationBlockDetails STUB");
ModerationBlockDetail block = new()
{
ReportCategory = ReportCategory.Moderator,
Duration = 0,
GameSessionId = 0,
IsHostKick = false,
PlayerIdReporter = 0,
IsBan = false,
IsVoiceModAutoban = false,
IsDeviceBan = false,
IsWarning = false,
ShowCreatorCodeOfConduct = false
};
// ModerationBlockDetail block = new()
// {
// ReportCategory = ReportCategory.Moderator,
// Duration = 555,
// GameSessionId = 0,
// IsHostKick = false,
// PlayerIdReporter = 1,
// IsBan = true,
// IsVoiceModAutoban = false,
// IsDeviceBan = true,
// IsWarning = false,
// ShowCreatorCodeOfConduct = false
// };
return Results.Created("/api/PlayerReporting/v1/moderationBlockDetails", block);
});
app.MapGet("/api/PlayerReporting/v1/voteToKickReasons", () =>
{
app.Logger.LogWarning("(API) /api/PlayerReporting/v1/voteToKickReasons STUB");
return "[]";
});
app.MapPost("/api/PlayerReporting/v1/hile", () =>
{
return false;
});
app.MapGet("/api/banappeal/generateCode", () =>
{
ApiResponse response = new()
{
success = false,
error = "Lemres"
};
return response;
});
app.MapGet("/outfits/me", () =>
{
app.Logger.LogWarning("(API) /outfits/me STUB");
Outfit outfit = new()
{
Accessibility = 0,
DataVersion = 0,
LegacyData = new()
{
FaceFeatures = "{\"ver\":6,\"eyeId\":\"AjGMoJhEcEehacRZjUMuDg\",\"eyePos\":{\"x\":0.0,\"y\":0.0},\"eyeScl\":0.05000000074505806,\"mouthId\":\"FrZBRanXEEK29yKJ4jiMjg\",\"mouthPos\":{\"x\":0.0,\"y\":0.0},\"mouthScl\":0.05000000074505806,\"hairPrimaryColorId\":\"\",\"hairSecondaryColorId\":\"5e51ac88-e365-418b-a303-8737fd2e6bc8\",\"hairPatternId\":\"\",\"beardColorId\":\"5e51ac88-e365-418b-a303-8737fd2e6bc8\",\"beardSecondaryColorId\":\"5e51ac88-e365-418b-a303-8737fd2e6bc8\",\"beardPatternId\":\"\",\"faceShapeId\":\"yR4oYZr_AUSynXCgwS2lGw\",\"bodyShapeId\":\"bY1RGIph0kiAxbd6Shn9tQ\",\"useHatAnchorParams\":true,\"useHelmetHair\":1,\"hideEars\":true,\"hatAnchorParams\":{\"NormalizedPosition\":{\"x\":0.5,\"y\":0.5},\"HemisphereOffsets\":{\"x\":0.0,\"y\":0.0,\"z\":0.0},\"HemisphereRotations\":{\"x\":0.0,\"y\":0.0,\"z\":0.0}}}",
HairColor = "5e51ac88-e365-418b-a303-8737fd2e6bc8",
SelectionsV1 = "193a3bf9-abc0-4d78-8d63-92046908b1c5,,0;b6rLwzD4NkKV7xKn9ZYVkA,PRLBrEEZhUumm3VnYVJP6Q,1;5cd08cfb-c729-4c30-96d9-6a99bb934d91,,1;071f179a-dde2-407f-92b2-f0c16fcb4e39,VudVdOAjZUibHmtFeNkvSw,0;ecc1dbe6-ca06-4564-b2a6-30956194d1e9,dee70c38-7a99-4c2b-9181-665f1bf75aca,0b2395e1-ebcc-47e9-aaf1-faf9e9cec4cd,,2;ecc1dbe6-ca06-4564-b2a6-30956194d1e9,f8b0cfe8-e129-4578-8bb5-f60af5d38599,0b2395e1-ebcc-47e9-aaf1-faf9e9cec4cd,,3",
SelectionsV2 = "{\"selections\":[{\"PrefabGuid\":\"193a3bf9-abc0-4d78-8d63-92046908b1c5\",\"CombinationGuid\":\"\",\"BodyPart\":0,\"UgcOutfitData\":{\"BaseAvatarItemColor\":{\"r\":0.0,\"g\":0.0,\"b\":0.0,\"a\":0.0},\"CustomAvatarItemId\":\"\"}},{\"PrefabGuid\":\"b6rLwzD4NkKV7xKn9ZYVkA\",\"CombinationGuid\":\"PRLBrEEZhUumm3VnYVJP6Q\",\"BodyPart\":1,\"UgcOutfitData\":{\"BaseAvatarItemColor\":{\"r\":0.0,\"g\":0.0,\"b\":0.0,\"a\":0.0},\"CustomAvatarItemId\":\"\"}},{\"PrefabGuid\":\"5cd08cfb-c729-4c30-96d9-6a99bb934d91\",\"CombinationGuid\":\"\",\"BodyPart\":1,\"UgcOutfitData\":{\"BaseAvatarItemColor\":{\"r\":0.0,\"g\":0.0,\"b\":0.0,\"a\":0.0},\"CustomAvatarItemId\":\"\"}},{\"PrefabGuid\":\"071f179a-dde2-407f-92b2-f0c16fcb4e39\",\"CombinationGuid\":\"VudVdOAjZUibHmtFeNkvSw\",\"BodyPart\":0,\"UgcOutfitData\":{\"BaseAvatarItemColor\":{\"r\":0.0,\"g\":0.0,\"b\":0.0,\"a\":0.0},\"CustomAvatarItemId\":\"\"}},{\"PrefabGuid\":\"ecc1dbe6-ca06-4564-b2a6-30956194d1e9\",\"CombinationGuid\":\"dee70c38-7a99-4c2b-9181-665f1bf75aca,0b2395e1-ebcc-47e9-aaf1-faf9e9cec4cd,\",\"BodyPart\":2,\"UgcOutfitData\":{\"BaseAvatarItemColor\":{\"r\":0.0,\"g\":0.0,\"b\":0.0,\"a\":0.0},\"CustomAvatarItemId\":\"\"}},{\"PrefabGuid\":\"ecc1dbe6-ca06-4564-b2a6-30956194d1e9\",\"CombinationGuid\":\"f8b0cfe8-e129-4578-8bb5-f60af5d38599,0b2395e1-ebcc-47e9-aaf1-faf9e9cec4cd,\",\"BodyPart\":3,\"UgcOutfitData\":{\"BaseAvatarItemColor\":{\"r\":0.0,\"g\":0.0,\"b\":0.0,\"a\":0.0},\"CustomAvatarItemId\":\"\"}}]}",
SkinColor = "85343b16-d58a-4091-96d8-083a81fb03ae"
},
Slot = 0
};
return outfit;
});
app.MapGet("/api/playerReputation/v2/bulk", (string id) =>
{
app.Logger.LogWarning("(API) /api/playerReputation/v2/bulk STUB");
List<BulkPlayerReputation> reps = new();
BulkPlayerReputation rep = new()
{
AccountId = Accounts.account.accountId,
CheerCreative = 0,
CheerCredit = 10,
CheerGeneral = 0,
CheerGreatHost = 0,
CheerHelpful = 0,
CheerSportsman = 0,
IsCheerful = true,
Noteriety = 0,
SelectedCheer = 0
};
reps.Add(rep);
return reps;
});
app.Map("/api/relationships/v2/get", () => "[]");
app.MapGet("/api/statsigUserProperties", () => "{\"success\" : true}");
app.MapPost("/api/gamesight/event", () =>
{
ApiResponseNoValue response = new()
{
success = true
};
return Results.Created("/api/gamesight/event", response);
});
app.MapGet("/api/config/v1/amplitude", () =>
{
AmplitudeConfig config = new()
{
AmplitudeKey = "93941036bd6a7243bf5c628535f41d63",
UseRudderStack = false,
RudderStackKey = "23NiJHIgu3koaGNCZIiuYvIQNCu",
UseStatSig = true,
StatSigKey = "client-SBZkOrjD3r1Cat3f3W8K6sBd11WKlXZXIlCWj6l4Aje",
StatSigEnvironment = 0
};
return config;
});
app.MapGet("/api/config/v1/backtrace", () =>
{
BacktraceConfig config = new()
{
ReportBudget = 125,
FilterType = 0,
SampleRate = 1,
LogLineCount = 50,
CaptureNativeCrashes = 0,
AMRThresholdMS = 0,
MessageCount = 1000,
MessageRegex = "^.*$",
VersionRegex = ".*"
};
return config;
});
app.MapGet("/api/config/v2", () =>
{
app.Logger.LogWarning("(API) /api/config/v2 STUB");
return File.ReadAllText("wwwroot/config/config.json");
});
app.MapGet("/api/quickPlay/v1/getandclear", () =>
{
app.Logger.LogWarning("(API) /api/quickPlay/v1/getandclear STUB");
return "";
});
app.MapGet("/api/messages/v2/get", () =>
{
app.Logger.LogWarning("(API) /api/messages/v2/get STUb");
return "[]";
});
app.MapGet("/api/images/v2/named", () =>
{
app.Logger.LogWarning("(API) /api/images/v2/named STUB");
return "[]";
});
app.MapGet("/api/communityboard/v2/current", () =>
{
return File.ReadAllText("communityboard.json");
});
app.MapGet("/api/playerevents/v1/all", () =>
{
app.Logger.LogWarning("(API) /api/playerevents/v1/all STUB");
PlayerEvents events = new()
{
Created = Array.Empty<object>(),
Responses = Array.Empty<object>()
};
return events;
});
app.MapGet("/api/customAvatarItems/v1/isCreationEnabled", () =>
{
return true;
});
app.MapGet("/api/customAvatarItems/v1/isRenderingEnabled", () =>
{
return true;
});
app.MapGet("/api/config/v1/azurespeech", () =>
{
var config = new
{
Key = "dce8de5b297747d9b5bddcc7f19e8c5b",
Region = "eastus",
Enabled = false,
};
return config;
});
app.MapGet("/api/announcement/v1/get", () =>
{
app.Logger.LogWarning("(API) /api/announcement/v1/get STUB");
return "[]";
});
app.MapPost("/api/sanitize/v1", ([FromBody] SanitizeRequest request) =>
{
return Results.Ok(JsonSerializer.Serialize(request.Value));
});
app.MapPost("/api/sanitize/v1/isPure", () =>
{
var result = new
{
IsPure = true
};
return result;
});
app.MapGet("/api/testcasemanagement/v1/testpasssummary", () =>
{
app.Logger.LogWarning("(API) /api/testcasemanagement/v1/testpasssummary STUB");
return "[]";
});
app.MapGet("/api/testcasemanagement/v1/testplans", () =>
{
app.Logger.LogWarning("(API) /api/testcasemanagement/v1/testplans STUB");
return "[]";
});
app.MapPost("/api/rooms/v1/verifyRole", () =>
{
app.Logger.LogWarning("(API) /api/rooms/v1/verifyRole STUB");
return true;
});
app.MapGet("/api/inventions/v2/mine", () =>
{
app.Logger.LogWarning("(API) /api/inventions/v2/mine STUB");
return "[]";
});
app.MapGet("/api/apple/musicpromotion/active", () =>
{
return true;
});
app.MapGet("/api/inventions/v2/search", (int skip, int take) =>
{
app.Logger.LogWarning("(API) /api/inventions/v2/search STUB");
return "[]";
});
app.MapGet("/api/inventions/v1/room", (int id) =>
{
app.Logger.LogWarning("(API) /api/inventions/v1/room STUB");
return "[]";
});
app.MapGet("/api/keepsakes/globalconfig", () =>
{
var response = new
{
KeepsakeFeatureEnabled = true,
KeepsakeRoomLimit = 10,
SocialXpBoostEnabled = false
};
return response;
});
app.MapGet("/api/keepsakes/rooms/{roomId}", (int roomId) =>
{
app.Logger.LogWarning("(API) /api/keepsakes/rooms/{{roomId}} STUB");
return Results.NoContent();
});
app.MapGet("/api/activities/charades/v1/words/{activityName}", (string activityName) =>
{
return File.ReadAllText("ServerData/CharadeWords.json");
});
app.MapGet("/api/images/v4/room/{roomId}", (int roomId, int sort, int filter, int take, int skip) =>
{
app.Logger.LogWarning("(API) /api/images/v4/room/{{roomId}} STUB");
return "[]";
});
app.MapGet("/api/playerevents/v1/room/{roomId}", () =>
{
app.Logger.LogWarning("(API) /api/playerevents/v1/room/{{roomId}} STUB");
return "[]";
});
app.MapGet("/api/rooms/v1/filters", () =>
{
return File.ReadAllText("ServerData/RoomFilters.json");
});
app.MapGet("/api/images/v6", (string name) =>
{
app.Logger.LogWarning("(API) /api/images/v6 STUB");
return API.SuccessResponse;
});
}
}
+165
View File
@@ -0,0 +1,165 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
namespace asdfasdf.APIs;
public static class Accounts
{
public static BulkAccount account = JsonSerializer.Deserialize<BulkAccount>(File.ReadAllText("ServerData/Accounts/2/user.json"));
public static void CreateAccount(int accountId, string name)
{
if (!Directory.Exists("ServerData/Accounts/" + accountId))
{
Directory.CreateDirectory("ServerData/Accounts/" + accountId);
}
BulkAccount tAccount = new()
{
AvailableUsernameChanges = 1,
Email = "email@email.com",
Birthday = DateTime.MinValue,
IsFakeJuniorBirthday = false,
accountId = accountId,
username = name,
displayName = name,
displayEmoji = "",
profileImage = "DefaultProfileImage.png",
bannerImage = "DefaultProfileImage.png",
isJunior = false,
platforms = PlatformType.All,
personalPronouns = PersonalPronouns.None,
identityFlags = IdentityFlags.None,
createdAt = DateTime.UtcNow,
isMetaPlatformBlocked = false
};
File.WriteAllText("ServerData/Accounts/" + accountId + "/user.json", JsonSerializer.Serialize(tAccount));
File.WriteAllText("ServerData/Accounts/" + accountId + "/Outfits.json", "[]");
File.Copy("DefaultPlayerSettings.json", "ServerData/Accounts/" + accountId + "/PlayerSettings.json");
File.WriteAllText("ServerData/Accounts/" + accountId + "/avoidjuniors", "false");
File.Copy("DefaultAvatar.json", "ServerData/Accounts/" + accountId + "/Avatar.json");
}
public static void Init(WebApplication app)
{
app.MapGet("/account/me", (HttpRequest request) =>
{
app.Logger.LogInformation(request.Headers.Authorization[0]);
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
return Results.Ok(user.account);
}
}
return Results.NotFound();
});
app.MapPut("/account/me/displayname", ([FromForm] string displayName, HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
user.account.displayName = displayName;
File.WriteAllText("ServerData/Accounts/" + user.id + "/user.json", JsonSerializer.Serialize(user.account));
ApiResponse response = new()
{
success = true,
error = string.Empty
};
return Results.Ok(response);
}
}
return Results.NotFound();
}).DisableAntiforgery();
app.MapPut("/account/me/profileimage", ([FromForm] string imageName, HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
user.account.profileImage = imageName;
File.WriteAllText("ServerData/Accounts/" + user.id + "/user.json", JsonSerializer.Serialize(user.account));
ApiResponse response = new()
{
success = true,
error = string.Empty
};
return Results.Ok(response);
}
}
return Results.NotFound();
}).DisableAntiforgery();
app.MapPut("/account/me/username", ([FromForm] string username, HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
user.account.username = username;
File.WriteAllText("ServerData/Accounts/" + user.id + "/user.json", JsonSerializer.Serialize(user.account));
ApiResponse response = new()
{
success = true,
error = string.Empty
};
return Results.Ok(response);
}
}
return Results.NotFound();
}).DisableAntiforgery();
app.MapGet("/account/bulk", (int id) =>
{
List<BulkAccount> accounts = new();
accounts.Add(JsonSerializer.Deserialize<BulkAccount>(File.ReadAllText("ServerData/Accounts/" + id + "/user.json")));
return accounts;
});
app.MapGet("/role/developer/{id}", () =>
{
return true;
});
app.MapGet("/parentalcontrol/me", () =>
{
ParentalControl pc = new()
{
accountId = account.accountId,
disallowInAppPurchases = false
};
return pc;
});
app.MapGet("/accountprivacysettings/{id}", () =>
{
app.Logger.LogWarning("(Accounts) /accountprivacysettings/{{id}} STUB");
PrivacySettings privacySettings = new()
{
accountId = account.accountId,
isRecentHistoryVisible = true
};
return privacySettings;
});
}
}
+19
View File
@@ -0,0 +1,19 @@
namespace asdfasdf.APIs;
public static class Amplitude
{
public static void Init(WebApplication app)
{
// All of the stuff in amplitude is just to make the Rec Room logs less spammed
app.MapPost("/httpapi", () =>
{
return Results.Ok();
});
app.MapPost("/identify", () =>
{
return Results.Ok();
});
}
}
+255
View File
@@ -0,0 +1,255 @@
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
namespace asdfasdf.APIs;
public static class Auth
{
public static List<LoggedInUser> currentUsers;
public static void Init(WebApplication app)
{
currentUsers = new();
if (File.Exists("ServerData/LoggedInUsers.json"))
{
currentUsers = JsonSerializer.Deserialize<List<LoggedInUser>>(File.ReadAllText("ServerData/LoggedInUsers.json"));
}
app.MapPost("/connect/deviceauthorization", async (HttpRequest request) =>
{
var a = await request.ReadFormAsync();
var clientId = a.ElementAt(0);
var clientSecret = a.ElementAt(1);
app.Logger.LogWarning($"(Auth) /connect/deviceauthorization STUB\n{clientId}\n{clientSecret}");
DeviceAuthorizationResponse response = new()
{
device_code = "stub",
user_code = "stub",
verification_uri = "https://127.0.0.1/other/deviceauth.html",
verification_uri_complete = "https://127.0.0.1/other/deviceauth.html",
expires_in = 69420,
interval = 5
};
return Results.Created("/connect/deviceauthorization", response);
});
app.MapPost("/connect/token", ([FromForm] string? client_id, [FromForm] string? grant_type, [FromForm] string? platform_id, [FromForm] int? device_class, HttpRequest request) =>
{
if (!string.IsNullOrEmpty(client_id) && string.Equals(client_id, "recroom.studio"))
{
device_class = 0;
TokenResponse tokenrrs = new()
{
access_token = BuildJWTToken(),
expires_in = 43200,
key = "FFez0R2bkFhD60xs4h1Vz9IczHop8Y90xGfaQ7wVLGU=",
refresh_token = "1093F3F27DA152B7EB51E02D12193FE961B89A4D1953B1817FBC0CDEF5E6F47C",
scope = "offline_access rn",
token_type = "Bearer"
};
CachedAccount accountrrs = JsonSerializer.Deserialize<CachedAccount>(File.ReadAllText("ServerData/CachedAccounts/" + "76561198376170927" + ".json"));
currentUsers.Add(new()
{
token = "Bearer " + tokenrrs.access_token,
id = accountrrs.AccountId,
account = JsonSerializer.Deserialize<BulkAccount>(File.ReadAllText("ServerData/Accounts/" + accountrrs.AccountId + "/user.json")),
outfits = JsonSerializer.Deserialize<List<OutfitSaveRequest>>(File.ReadAllText("ServerData/Accounts/" + accountrrs.AccountId + "/Outfits.json")),
ps = JsonSerializer.Deserialize<List<PlayerSetting>>(File.ReadAllText("ServerData/Accounts/" + accountrrs.AccountId + "/PlayerSettings.json")),
deviceClass = device_class.Value
});
return Results.Created("/connect/token", tokenrrs);
}
if (grant_type.Equals("create_account"))
{
var response = new
{
error = "invalid_grant",
error_description = "Lemres"
};
return Results.BadRequest(response);
}
TokenResponse token = new()
{
access_token = BuildJWTToken(),
expires_in = 43200,
key = "FFez0R2bkFhD60xs4h1Vz9IczHop8Y90xGfaQ7wVLGU=",
refresh_token = "1093F3F27DA152B7EB51E02D12193FE961B89A4D1953B1817FBC0CDEF5E6F47C",
scope = "offline_access rn",
token_type = "Bearer"
};
CachedAccount account = JsonSerializer.Deserialize<CachedAccount>(File.ReadAllText("ServerData/CachedAccounts/" + platform_id + ".json"));
currentUsers.Add(new()
{
token = "Bearer " + token.access_token,
id = account.AccountId,
account = JsonSerializer.Deserialize<BulkAccount>(File.ReadAllText("ServerData/Accounts/" + account.AccountId + "/user.json")),
outfits = JsonSerializer.Deserialize<List<OutfitSaveRequest>>(File.ReadAllText("ServerData/Accounts/" + account.AccountId + "/Outfits.json")),
ps = JsonSerializer.Deserialize<List<PlayerSetting>>(File.ReadAllText("ServerData/Accounts/" + account.AccountId + "/PlayerSettings.json")),
deviceClass = device_class.Value
});
return Results.Created("/connect/token", token);
}).DisableAntiforgery();
app.MapGet("/cachedlogin/forplatformid/0/{steamId}", (string steamId) =>
{
if (!File.Exists("ServerData/CachedAccounts/" + steamId + ".json"))
{
app.Logger.LogInformation("Creating user for " + steamId);
int accountId = Directory.GetDirectories("ServerData/Accounts").Length + 1;
Accounts.CreateAccount(accountId, steamId);
CachedAccount cached = new()
{
AccountId = accountId,
LastLoginTime = DateTime.UtcNow,
Platform = PlatformType.All,
PlatformId = steamId,
RequirePassword = false
};
File.WriteAllText("ServerData/CachedAccounts/" + steamId + ".json", JsonSerializer.Serialize(cached));
}
List<CachedAccount> accounts = new();
CachedAccount cachedAccount = JsonSerializer.Deserialize<CachedAccount>(File.ReadAllText("ServerData/CachedAccounts/" + steamId + ".json"));
accounts.Add(cachedAccount);
return accounts;
});
app.MapPost("/cachedlogin/forplatformids", () =>
{
app.Logger.LogWarning("(Auth) /cachedlogin/forplatformids STUB");
return "[]";
});
app.MapGet("privileges/me/restrictions", () =>
{
app.Logger.LogWarning("(Auth) /privileges/me/restrictions STUB");
return "[]";
// AccountPrivilege privilege = new()
// {
// AccountId = 0,
// Name = "User",
// Description = "stub",
// EndDate = DateTime.UtcNow,
// AssociatedAccountid = 0,
// AssociatedAccountUsername = "stub",
// ReportCategory = ReportCategory.Moderator,
// DisplayReason = "Lemres"
// };
//
// return privilege;
});
app.MapGet("/eac/challenge", () =>
{
return "\"AQAAAOmBNw8TMlSZs9NsuyGxsU7WMoKVcieTW8IyoSMEGcbTIPg7DZ4JGZTCfg4b1h58FOOkM7r0LUhRVwlq8wo528o3LR9g/kHzlrVJA6H0+HaYTQzjKEe+zl5/VupqSXk8PXQ0BlNiRED3x5YMCGiM+F0fYmd0NU4K0d5hY+A=\"";
});
app.MapPost("/account/recoverpassword", () =>
{
app.Logger.LogWarning("(Auth) /account/recoverpassword STUB");
ApiResponseNoValue response = new()
{
error = "Lemres",
error_id = "id",
success = false
};
return Results.Created("/account/recoverpassword", response);
});
// Legacy?
app.MapGet("/api/settings/v2", () =>
{
app.Logger.LogWarning("(API) /api/settings/v2 STUB");
return File.ReadAllText("DefaultPlayerSettings.json");
});
// Legacy?
app.MapPost("/api/settings/v2/set", () =>
{
app.Logger.LogWarning("(API) /api/settings/v2/set STUB");
return File.ReadAllText("DefaultPlayerSettings.json");
});
app.MapPost("/api/images/v4/uploadsaved", async (HttpRequest request) =>
{
var file = request.Form.Files.FirstOrDefault();
string fileName = Guid.NewGuid() + ".jpg";
using (var stream = new FileStream("wwwroot/" + fileName, FileMode.Create))
{
await file.CopyToAsync(stream);
}
return Results.Ok(new {ImageName = fileName});
}).DisableAntiforgery();
}
private static string BuildJWTToken()
{
var roles = new List<string>
{
"influencer",
"developer",
"moderator",
"screenshare",
"keepsake",
"livekeepsakeeventroomsaveoverride",
"multiinstanceevent",
"betastudio",
"ugcloc"
};
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("SecretKeywqewqeqqqqqqqqqqqweeeeeeeeeeeeeeeeeeeqweqe"));
var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
var issuer = "reccc";
var claims = new[]
{
new Claim("sub", "0"),
new Claim("role", JsonSerializer.Serialize(roles), JsonClaimValueTypes.JsonArray),
new Claim(JwtRegisteredClaimNames.Iat, DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString(), ClaimValueTypes.Integer64)
};
var jwtValidity = DateTime.Now.AddDays(30);
var token = new JwtSecurityToken(issuer,
claims: claims,
expires: jwtValidity,
signingCredentials: creds);
return new JwtSecurityTokenHandler().WriteToken(token);
}
}
+64
View File
@@ -0,0 +1,64 @@
namespace asdfasdf.APIs;
public static class BugReporting
{
private static string CurrentADOGUID;
public static void Init(WebApplication app)
{
app.MapPost("/ado/bug", async (HttpRequest request) =>
{
CurrentADOGUID = Guid.NewGuid().ToString();
await SaveFileFromHttpRequest("ServerData/BugReports/" + "ado_" + CurrentADOGUID + ".txt", request);
return API.SuccessResponse;
});
app.MapPost("/ado/file", async (HttpRequest request) =>
{
var file = request.Form.Files.FirstOrDefault();
using (var stream = new FileStream("ServerData/BugReports/ado_" + CurrentADOGUID + "_" + file.FileName, FileMode.Create))
{
await file.CopyToAsync(stream);
}
return API.SuccessResponse;
});
app.MapPut("/reports/{id}", async (string id, HttpRequest request) =>
{
await SaveFileFromHttpRequest("ServerData/BugReports/" + id + ".json", request);
return API.SuccessResponse;
});
app.MapPut("/reports/{id}/attachments/{fileName}", async (string id, string fileName, HttpRequest request) =>
{
await SaveFileFromHttpRequest("ServerData/BugReports/" + id + "_" + fileName, request);
return API.SuccessResponse;
});
app.MapPut("/reports/{id}/userinfo", async (string id, HttpRequest request) =>
{
await SaveFileFromHttpRequest("ServerData/BugReports/" + id + "_userinfo.json", request);
return API.SuccessResponse;
});
app.MapPut("/reports/{id}/Complete", (string id) =>
{
return API.SuccessResponse;
});
}
private static async Task SaveFileFromHttpRequest(string path, HttpRequest request)
{
var body = new StreamReader(request.Body);
var requestBody = await body.ReadToEndAsync();
await File.WriteAllTextAsync(path, requestBody);
}
}
+14
View File
@@ -0,0 +1,14 @@
namespace asdfasdf.APIs;
public static class CDN
{
public static void Init(WebApplication app)
{
app.MapGet("/config/1b057e6e-979d-4f30-8856-a386f77c90da", () => File.ReadAllText("wwwroot/config/1b057e6e-979d-4f30-8856-a386f77c90da"));
app.MapGet("/config/LoadingScreenTipData", () =>
{
return File.ReadAllText("LoadingScreenTipData.json");
});
}
}
+21
View File
@@ -0,0 +1,21 @@
namespace asdfasdf.APIs;
public static class Chat
{
public static void Init(WebApplication app)
{
app.MapGet("/thread", (int maxCount, int mode) =>
{
app.Logger.LogWarning("(Chat) /thread STUB");
return "[]";
});
app.MapGet("/thread/party", (int maxCount, int mode) =>
{
app.Logger.LogWarning("(Chat) /thread/party STUB");
return "[]";
});
}
}
+67
View File
@@ -0,0 +1,67 @@
namespace asdfasdf.APIs;
public static class Clubs
{
public static void Init(WebApplication app)
{
app.MapGet("/club/home/me", () =>
{
app.Logger.LogWarning("(Clubs) /club/home/me STUB");
return Results.NotFound();
// Club club = new()
// {
// Name = "A club",
// Description = "A club description",
// MainImageName = "DefaultProfileImage.png",
// State = ClubState.Active,
// PrimaryTag = "Hangout",
// Visibility = ClubVisibility.Public,
// Joinability = ClubJoinability.Open,
// AllowJuniors = true,
// MinLevel = 1,
// MemberCount = 1,
// ClubhouseRoomId = 0,
// ClubType = ClubType.Generic
// };
//
// return club;
});
app.MapGet("/announcements/v2/mine/unread", () =>
{
app.Logger.LogWarning("(Clubs) /announcements/v2/mine/unread STUB");
return "[]";
});
app.MapGet("/club/mine/member", () =>
{
app.Logger.LogWarning("(Clubs) /club/mine/member STUB");
return "[]";
});
app.MapGet("/announcements/v2/subscription/mine/unread", () =>
{
app.Logger.LogWarning("(Clubs) /announcements/v2/subscription/mine/unread STUB");
return "[]";
});
app.MapGet("/subscription/mine/member", () =>
{
app.Logger.LogWarning("(Clubs) /subscription/mine/member STUB");
return "[]";
});
app.MapGet("/subscription/details/{id}", () =>
{
app.Logger.LogWarning("(Clubs) /subscription/details/{{id}} STUB");
return "{}";
});
}
}
+22
View File
@@ -0,0 +1,22 @@
namespace asdfasdf.APIs;
public static class Commerce
{
public static void Init(WebApplication app)
{
app.Map("/purchase/v1/hasspentmoney", () =>
{
return false;
});
app.MapGet("/purchasecampaign/allcurrent/v2", () =>
{
return "[]";
});
app.MapGet("/reminder/currentTokenBundles/v2", () =>
{
return "[]";
});
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace asdfasdf.APIs;
public static class Data
{
public static void Init(WebApplication app)
{
app.MapGet("/commonQuery/rrstudio/chiprecommendations", () =>
{
return File.ReadAllText("studio_chiprecommendations.json");
});
}
}
+17
View File
@@ -0,0 +1,17 @@
namespace asdfasdf.APIs;
public static class DataCollection
{
public static void Init(WebApplication app)
{
app.MapPost("/data/event", (HttpRequest request) =>
{
return Results.Created("/data/event", "");
});
app.MapPost("/data/heartbeat", () =>
{
return Results.Created("/data/heartbeat", "");
});
}
}
+428
View File
@@ -0,0 +1,428 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
namespace asdfasdf.APIs;
public static class Econ
{
private static List<OutfitSaveRequest> outfits;
public static void Init(WebApplication app)
{
if (!File.Exists("ServerData/Accounts/2/Outfits.json"))
{
File.WriteAllText("ServerData/Accounts/2/Outfits.json", "[]");
}
outfits = JsonSerializer.Deserialize<List<OutfitSaveRequest>>(File.ReadAllText("ServerData/Accounts/2/Outfits.json"));
app.MapGet("/api/avatar/v1/defaultunlocked", () =>
{
return File.ReadAllText("avataritems.json");
});
app.MapGet("/api/timeLimitedEvents/cbe9582c-6314-4ba3-ad0e-57d220b79aff", () =>
{
app.Logger.LogWarning("(econ) /api/timeLimitedEvents/cbe9582c-6314-4ba3-ad0e-57d220b79aff STUB");
Guid ReplicationId = Guid.NewGuid();
// TimedEventXpSource xpSource = new();
// TimedEventXpMultiplier xpMultiplier = new()
// {
// XpMultiplier = 2
// };
//
// TimeLimitedEvent limitedEvent = new()
// {
// TimeLimitedEventId = 0,
// ReplicationId = ReplicationId,
// Name = "An event",
// StartTime = DateTime.UtcNow,
// EndTime = DateTime.UtcNow.AddHours(24),
// Metadata = "stub",
// Config = new()
// {
// CurrencyGrant = new()
// {
// TimedCurrencyGrantId = 0
// },
// XpSinks = [new()
// {
// XpSources = new(new []{xpSource}),
// XpMultipliers = new( new []{xpMultiplier}),
// GiftMessage = "A Gift"
// }],
// TeamConfig = new()
// {
// TimeLimitedEventTeamConfigId = 0,
// TimeLimitedEventTeamConfig = new()
// {
// TimeLimitedEventTeamConfigId = 0,
// ReplicationId = ReplicationId,
// MaxPlayersPerTeam = 4,
// TeamRegistrationStartTime = DateTime.UtcNow,
// TeamRegistrationEndTime = DateTime.UtcNow.AddHours(24),
// ActiveExperiment = "experiment"
// }
// }
// }
// };
return File.ReadAllText("event_cbe9582c-6314-4ba3-ad0e-57d220b79aff.json");
});
app.MapGet("/api/avatar/v4/items", () => File.ReadAllText("avataritems.json"));
app.MapGet("/api/avatar/v1/defaultbaseavataritems", () => File.ReadAllText("defaultbaseavataritems.json"));
app.MapGet("/api/storefronts/v4/balance/{type}", (int type) =>
{
app.Logger.LogWarning("(econ) /api/storefronts/v4/balance/500 STUB");
List<BalanceResponse> responses = new();
BalanceResponse response = new()
{
Balance = 1000,
CurrencyType = -type,
BalanceType = StorefrontBalanceType.SteamPurchased
};
responses.Add(response);
return responses;
});
app.MapGet("/api/roomkeys/v1/room", (int roomId) =>
{
app.Logger.LogWarning("(econ) /api/roomkeys/v1/room STUB");
return "[]";
});
app.MapGet("/econ/customAvatarItems/v1/owned", (int skip, int take) =>
{
app.Logger.LogWarning("(econ) /econ/customAvatarItems/v1/owned STUB");
OwnedCustomAvatarItems owned = new()
{
TotalResults = 0,
Results = Array.Empty<object>()
};
return owned;
});
app.MapGet("/api/avatar/v2", (HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
return File.ReadAllText("ServerData/Accounts/" + user.id + "/Avatar.json");
}
}
return "{}";
// return Results.NotFound();
});
app.MapGet("/api/objectives/v1/myprogress", () =>
{
app.Logger.LogWarning("(econ) /api/objectives/v1/myprogress STUB");
List<ObjectiveGroup> objectiveGroups = new();
List<Objective> objectives = new();
ObjectiveGroup group = new()
{
ClearedAt = DateTime.Now.AddYears(1),
Group = 0,
IsCompleted = false,
RequiresCompleteOnServer = false
};
Objective objective = new()
{
Group = 0,
HasClaimedReward = false,
Index = 0,
IsCompleted = false,
IsRewarded = false,
Progress = 0,
VisualProgress = 0,
};
objectiveGroups.Add(group);
objectives.Add(objective);
MyProgress myProgress = new()
{
ObjectiveGroups = objectiveGroups,
Objectives = objectives
};
return myProgress;
});
app.MapPost("/api/objectives/v1/updateobjective", () =>
{
app.Logger.LogWarning("(econ) /api/objectives/v1/updateobjective STUB");
return "";
});
app.MapGet("/api/storefronts/v3/giftdropstore/{id}", () =>
{
app.Logger.LogWarning("(econ) /api/storefronts/v3/giftdropstore/3 STUB");
return File.ReadAllText("giftdrop.json");
});
app.MapGet("/api/checklist/v1/current", () =>
{
app.Logger.LogWarning("(econ) /api/checklist/v1/current STUB");
List<ChecklistObjective> objectives = new();
ChecklistObjective objective = new()
{
Order = 0,
Objective = ObjectiveType.AddAFriend,
Count = 1
};
ChecklistObjective objective2 = new()
{
Order = 1,
Objective = ObjectiveType.CheerARoom,
Count = 5
};
objectives.Add(objective);
objectives.Add(objective2);
return objectives;
});
app.MapGet("/api/challenge/v2/getCurrent", () =>
{
app.Logger.LogWarning("(econ) /api/challenge/v2/getCurrent STUB");
return File.ReadAllText("weeklychallenge.json");
});
app.MapGet("/api/avatar/v3/saved", (HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
return Results.Ok(user.outfits);
}
}
return Results.NotFound();
});
app.MapPost("/api/avatar/v3/saved/set", ([FromBody] OutfitSaveRequest request, HttpRequest hrequest) =>
{
List<OutfitSaveRequest> outfits = null;
int id = 0;
foreach (var user in Auth.currentUsers)
{
if (user.token == hrequest.Headers.Authorization[0])
{
outfits = user.outfits;
id = user.id;
}
}
if (outfits.Exists(x => x.Slot == request.Slot))
{
outfits.Remove(outfits.Find(x => x.Slot == request.Slot));
}
outfits.Add(request);
File.WriteAllText("ServerData/Accounts/" + id + "/Outfits.json", JsonSerializer.Serialize(outfits));
return Results.Created("/api/avatar/v3/saved/set", request);
});
app.MapPost("/api/avatar/v4/saved/set", ([FromBody] OutfitSaveRequest request, HttpRequest hrequest) =>
{
List<OutfitSaveRequest> outfits = null;
int id = 0;
foreach (var user in Auth.currentUsers)
{
if (user.token == hrequest.Headers.Authorization[0])
{
outfits = user.outfits;
id = user.id;
}
}
if (outfits.Exists(x => x.Slot == request.Slot))
{
outfits.Remove(outfits.Find(x => x.Slot == request.Slot));
}
outfits.Add(request);
File.WriteAllText("ServerData/Accounts/" + id + "/Outfits.json", JsonSerializer.Serialize(outfits));
var response = new
{
Success = true,
Slot = request.Slot
};
return Results.Created("/api/avatar/v4/saved/set", response);
});
app.MapPost("/api/avatar/v2/set", async (HttpRequest request) =>
{
var body = new StreamReader(request.Body);
var requestBody = await body.ReadToEndAsync();
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
await File.WriteAllTextAsync("ServerData/Accounts/" + user.id + "/Avatar.json", requestBody);
return Results.Ok();
}
}
return Results.NotFound();
}).DisableAntiforgery();
app.MapGet("/api/equipment/v2/getUnlocked", () =>
{
app.Logger.LogWarning("(econ) /api/equipment/v2/getUnlocked STUB");
return File.ReadAllText("equipment.json");
});
app.MapGet("/api/consumables/v2/getUnlocked", () =>
{
app.Logger.LogWarning("(econ) /api/consumables/v2/getUnlocked STUB");
return File.ReadAllText("consumables.json");
});
app.MapGet("/api/avatar/v2/gifts", () =>
{
app.Logger.LogWarning("(econ) /api/avatar/v2/gifts STUB");
List<GiftRow> rows = new();
GiftRow row = new()
{
id = 0,
data = null,
created_at = DateTime.Now
};
rows.Add(row);
return rows;
});
app.MapGet("/api/gamerewards/v1/pending", () =>
{
app.Logger.LogWarning("(econ) /api/gamerewards/v1/pending STUB");
return "[]";
});
app.MapGet("/api/roomkeys/v1/mine", () =>
{
app.Logger.LogWarning("(econ) /api/roomkeys/v1/mine STUB");
return "[]";
});
app.MapGet("/api/roomcurrencies/v1/currencies", () =>
{
app.Logger.LogWarning("(econ) /api/roomcurrencies/v1/currencies STUB");
return "[]";
});
app.MapGet("/api/roomcurrencies/v1/getAllBalances", () =>
{
app.Logger.LogWarning("(econ) /api/roomcurrencies/v1/getAllBalances STUB");
return "[]";
});
app.MapGet("/api/roomconsumables/v1/roomConsumable/room/{roomId}", () =>
{
app.Logger.LogWarning("/api/roomconsumables/v1/roomConsumable/room/{{roomId}} STUB");
return "[]";
});
app.MapGet("/api/roomconsumables/v1/roomConsumable/room/{roomId}/me", () =>
{
app.Logger.LogWarning("/api/roomconsumables/v1/roomConsumable/room/{{roomId}}/me STUB");
return "[]";
});
app.MapPost("/api/CampusCard/v1/UpdateAndGetSubscription", () =>
{
CampusCardSubscription value = new()
{
canBuySubscription = true,
subscription = new()
{
CreatedAt = DateTime.Now,
ExpirationDate = DateTime.UtcNow.AddDays(30),
IsActive = true,
IsAutoRenewing = true,
Level = 0,
ModifiedAt = DateTime.Now,
Period = 0,
PlatformId = "0",
PlatformPurchaseId = "0",
PlatformType = 0,
RecNetPlayerId = 0,
SubscriptionId = 0
},
platformAccountSubscribedPlayerId = 0
};
return Results.Created("/api/CampusCard/v1/UpdateAndGetSubscription", value);
});
app.MapGet("/api/itemWishlists/v1/wishlist/me", () =>
{
app.Logger.LogWarning("(econ) /api/itemWishlists/v1/wishlist/me STUB");
return "[]";
});
// app.MapGet("/api/subscriptionseasons/v1/seasons/current", () =>
// {
// app.Logger.LogWarning("(econ) /api/subscriptionseasons/v1/seasons STUB");
//
// return "{}";
// });
app.MapPost("/api/consumables/v1/consume", () =>
{
app.Logger.LogWarning("(econ) /api/consumables/v1/consume STUB");
return Results.Ok();
});
app.MapPost("/subscription/v1/cancel", () =>
{
return Results.Ok();
});
}
}
+28
View File
@@ -0,0 +1,28 @@
namespace asdfasdf.APIs;
public static class Images
{
public static void Init(WebApplication app)
{
app.MapGet("/img/{name}", async (string name, HttpContext context) =>
{
context.Response.Headers.Append("content-signature", "key-id=KEY:RSA:p1.rec.net; data=IWwe/pZ5vWWqNSkSM/54isgDxlZkdrP0sUrppKCbNktO2yCOTjq746xWiiLsueGuVcAGQqkjeRTimxolHckS/YXSYkEJxtiCXbLlsRia2DyAqtWVkGWsfczzFhp/56U66FVzolTspPCvjScOVlGO7dDIK7sJ+ndcRauWjsQsC6g3e7rUc6uwY099a6gy7sw6xr5BFZQSz8wg+fqyHYD/Sc4nQQVOTFZNNASqbJYhpNhEMXRnafCMuLl8a3mkGwvy3t4q2D/7SM48xrGZjEV47qNx1A91KCe28XVToFh4BzwEUU8nZ0d+KwV79MGarLo1cY8igc8FcoThKcovI4ClOg==");
if (File.Exists("wwwroot/" + name))
{
string mime = "image/png";
if (Path.GetExtension(name) == ".jpg")
{
mime = "image/jpeg";
}
return Results.File(await File.ReadAllBytesAsync("wwwroot/" + name), mime);
}
else
{
return Results.File(await File.ReadAllBytesAsync("wwwroot/lemres.png"), "image/png");
}
});
}
}
+430
View File
@@ -0,0 +1,430 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
namespace asdfasdf.APIs;
public static class Matchmaking
{
public static RoomInstance currentInstance = null;
private static string region = "us";
private static int currentStatusVisibility = 0;
private static DateTime lastOnline = DateTime.UtcNow;
public static void Init(WebApplication app)
{
if (File.Exists("ServerData/LastHeartbeat.json"))
{
currentInstance = JsonSerializer.Deserialize<Heartbeat>(File.ReadAllText("ServerData/LastHeartbeat.json")).roomInstance;
}
if (File.Exists("ServerData/LastPhotonRegion"))
{
region = File.ReadAllText("ServerData/LastPhotonRegion");
}
app.MapPost("/player/login", () =>
{
return Results.Ok();
});
app.MapPost("/player/logout", (HttpRequest request) =>
{
for (int i = 0; i < Auth.currentUsers.Count; i++)
{
if (Auth.currentUsers[i].token == request.Headers.Authorization[0])
{
Auth.currentUsers.RemoveAt(i);
break;
}
}
return Results.Ok();
});
app.MapGet("/player/qos", () =>
{
app.Logger.LogWarning("(Matchmaking) /player/qos STUB");
List<QosEndpoint> qosEndpoints = new();
QosEndpoint qos = new()
{
Id = "stub",
Address = "127.0.0.1"
};
qosEndpoints.Add(qos);
return qosEndpoints;
});
app.MapPost("/player/heartbeat", (HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
return user.heartbeat;
}
}
return null;
});
app.MapPut("/player/statusvisibility", ([FromForm] string statusVisibility, HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
user.currentStatusVisibility = int.Parse(statusVisibility);
}
}
return Results.Ok();
}).DisableAntiforgery();
app.MapGet("/player", (string id) =>
{
List<Heartbeat> players = new();
foreach (var user in Auth.currentUsers)
{
if (user.id == int.Parse(id))
{
players.Add(user.heartbeat);
}
}
return players;
});
app.MapPost("/player/exclusivelogin", () =>
{
var response = new
{
errorCode = 0
};
return response;
});
// Can't get the in (India?) param because of c# being c#
app.MapPut("/player/photonregionpings", ([FromForm] int ussc, [FromForm] int us, [FromForm] int cae, [FromForm] int usw, [FromForm] int eu, [FromForm] int sa, [FromForm] int ru, [FromForm] int tr, [FromForm] int jp, [FromForm] int rue, [FromForm] int au, [FromForm] int hk, [FromForm] int asia, [FromForm] int za, [FromForm] int kr, [FromForm] int uae) =>
{
List<RegionPing> regionPings = new();
regionPings.Add(new("ussc", ussc));
regionPings.Add(new("us", us));
regionPings.Add(new("cae", cae));
regionPings.Add(new("usw", usw));
regionPings.Add(new("eu", eu));
regionPings.Add(new("sa", sa));
regionPings.Add(new("ru", ru));
regionPings.Add(new("tr", tr));
regionPings.Add(new("jp", jp));
regionPings.Add(new("rue", rue));
regionPings.Add(new("au", au));
regionPings.Add(new("hk", hk));
regionPings.Add(new("asia", asia));
regionPings.Add(new("za", za));
regionPings.Add(new("kr", kr));
regionPings.Add(new("uae", uae));
RegionPing[] regionLowestPing = regionPings.Where((x) => x.Ping == regionPings.Min(y => y.Ping)).ToArray();
region = regionLowestPing[0].Name;
return Results.Ok();
}).DisableAntiforgery();
app.MapPost("/matchmake/none", () =>
{
return Results.NotFound();
});
app.MapPost("/matchmake/dorm", (HttpRequest request) =>
{
long instanceId = Random.Shared.Next(1000, 999999999);
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
currentInstance = new()
{
isPrivate = true,
location = "76d98498-60a1-430c-ab76-b54a29b7a163",
maxCapacity = 4,
name = "@" + user.account.username + "'s" + " DormRoom",
photonRegion = region,
photonRegionId = region,
photonRoomId = "Dorm-" + instanceId + "-room",
roomId = -1,
roomInstanceId = instanceId,
subRoomId = -1
};
user.currentInstance = currentInstance;
user.UpdateHeartbeat();
return Results.Ok(user.heartbeat);
}
}
return Results.NotFound();
});
app.MapPost("/matchmake/room/{id}", (HttpRequest request, long id, [FromQuery] long? subRoomId = null) =>
{
long instanceId;
string region;
if (!string.IsNullOrEmpty(ServerConfig.config.PhotonInstanceId))
{
instanceId = long.Parse(ServerConfig.config.PhotonInstanceId);
}
else
{
instanceId = Random.Shared.Next(1000, 999999999);
}
if (!string.IsNullOrEmpty(ServerConfig.config.PhotonRegion))
{
region = ServerConfig.config.PhotonRegion;
}
else
{
region = Matchmaking.region;
}
foreach (var user in Auth.currentUsers)
{
if (user.currentInstance != null)
{
if (user.currentInstance.roomId == id)
{
instanceId = user.currentInstance.roomInstanceId;
region = user.currentInstance.photonRegion;
}
}
}
string path = "ServerData/Rooms/" + id + "/info.json";
Room room = null;
for (int i = 0; i < Rooms.roomNamesToIds.names.Count; i++)
{
if (Rooms.roomNamesToIds.names[i].id == id)
{
room = JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + Rooms.roomNamesToIds.names[i].name + "/info.json"));
}
}
if (room == null)
{
return Results.NotFound();
}
SubRooms subRoom;
if (subRoomId != null)
{
subRoom = room.SubRooms.FirstOrDefault(s => s.SubRoomId == subRoomId.Value);
}
else
{
subRoom = room.SubRooms?.FirstOrDefault();
}
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
currentInstance = new()
{
name = "^" + room.Name,
isPrivate = false,
location = subRoom.UnitySceneId,
maxCapacity = subRoom.MaxPlayers,
photonRegion = region,
photonRegionId = region,
photonRoomId = "Room-" + room.Name + "-room",
roomId = room.RoomId,
roomInstanceId = instanceId,
subRoomId = subRoom.SubRoomId
};
user.currentInstance = currentInstance;
user.UpdateHeartbeat();
return Results.Ok(user.heartbeat);
}
}
return Results.NotFound();
});
app.MapPost("/matchmake/room/{roomId}/{subRoomId}", (long roomId, long subRoomId, HttpRequest request) =>
{
long instanceId;
string region;
if (!string.IsNullOrEmpty(ServerConfig.config.PhotonInstanceId))
{
instanceId = long.Parse(ServerConfig.config.PhotonInstanceId);
}
else
{
instanceId = Random.Shared.Next(1000, 999999999);
}
if (!string.IsNullOrEmpty(ServerConfig.config.PhotonRegion))
{
region = ServerConfig.config.PhotonRegion;
}
else
{
region = Matchmaking.region;
}
foreach (var user in Auth.currentUsers)
{
if (user.currentInstance != null)
{
if (user.currentInstance.roomId == roomId)
{
instanceId = user.currentInstance.roomInstanceId;
region = user.currentInstance.photonRegion;
}
}
}
string path = "ServerData/Rooms/" + roomId + "/info.json";
Room room = null;
for (int i = 0; i < Rooms.roomNamesToIds.names.Count; i++)
{
if (Rooms.roomNamesToIds.names[i].id == roomId)
{
room = JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + Rooms.roomNamesToIds.names[i].name + "/info.json"));
}
}
if (room == null)
{
return Results.NotFound();
}
SubRooms subRoom;
if (subRoomId != null)
{
subRoom = room.SubRooms.FirstOrDefault(s => s.SubRoomId == subRoomId);
}
else
{
subRoom = room.SubRooms?.FirstOrDefault();
}
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
currentInstance = new()
{
name = "^" + room.Name,
isPrivate = false,
location = subRoom.UnitySceneId,
maxCapacity = subRoom.MaxPlayers,
photonRegion = region,
photonRegionId = region,
photonRoomId = "Room-" + room.Name + "-room",
roomId = room.RoomId,
roomInstanceId = instanceId,
subRoomId = subRoom.SubRoomId
};
user.currentInstance = currentInstance;
user.UpdateHeartbeat();
return Results.Ok(user.heartbeat);
}
}
return Results.NotFound();
});
// 2020 cv2 update
app.MapPost("/goto/room/{roomName}", (string roomName, HttpRequest request) =>
{
long instanceId = Random.Shared.Next(1000, 999999999);
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
currentInstance = new()
{
isPrivate = true,
location = "76d98498-60a1-430c-ab76-b54a29b7a163",
maxCapacity = 4,
name = "@" + user.account.username + "'s" + " DormRoom",
photonRegion = region,
photonRegionId = region,
photonRoomId = "Dorm-" + instanceId + "-room",
roomId = -1,
roomInstanceId = instanceId,
subRoomId = -1
};
user.currentInstance = currentInstance;
user.UpdateHeartbeat();
return Results.Ok(user.heartbeat);
}
}
return Results.NotFound();
});
app.MapGet("/player/avoidjuniors", () =>
{
return bool.Parse(File.ReadAllText("ServerData/Accounts/2/avoidjuniors"));
});
app.MapPut("/player/avoidjuniors", ([FromForm] bool avoidJuniors, HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
File.WriteAllText("ServerData/Accounts/" + user.id + "/avoidjuniors", avoidJuniors.ToString());
return Results.Ok();
}
}
return Results.NotFound();
}).DisableAntiforgery();
app.MapGet("/rooms/requiring/rrplus", () =>
{
return "[]";
});
app.MapGet("/rooms/requiring/developer", () =>
{
return "[]";
});
app.MapPost("/roominstance/{instance}/reportjoinresult", () =>
{
return Results.Ok();
});
}
}
+16
View File
@@ -0,0 +1,16 @@
namespace asdfasdf.APIs;
public static class Moderation
{
public static void Init(WebApplication app)
{
app.MapGet("/voice/config", () =>
{
var result = new
{
enabled = false
};
return result;
});
}
}
+58
View File
@@ -0,0 +1,58 @@
using System.Text.Json;
namespace asdfasdf.APIs;
public static class NameServer
{
public static void Init(WebApplication app)
{
if (!File.Exists("ServerData/ns.json"))
{
string url = "https://127.0.0.1";
NameServerResponse ns = new()
{
Accounts = url,
AI = url,
API = url,
Auth = url,
BugReporting = url,
Cards = url,
CDN = url,
Chat = url,
Clubs = url,
CMS = url,
Commerce = url,
Data = url,
DataCollection = url,
Discovery = url,
Econ = url,
GameLogs = url,
Geo = url,
Images = url + "/img",
Leaderboard = url,
Link = url,
Lists = url,
Matchmaking = url,
Moderation = url,
Notifications = url,
PlatformNotifications = url,
PlayerSettings = url,
RoomComments = url,
RoomieIntegrations = url,
Rooms = url,
Storage = url,
Strings = url,
StringsCDN = url,
Studio = url,
StudioCDN = url,
Thorn = url,
Videos = url,
WWW = url
};
File.WriteAllText("ServerData/ns.json", JsonSerializer.Serialize(ns));
}
app.MapGet("/", () => File.ReadAllText("ServerData/ns.json"));
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace asdfasdf.APIs;
public static class PlatformNotifications
{
public static void Init(WebApplication app)
{
app.MapGet("/crm/me/config/v3", () =>
{
return File.ReadAllText("PlatformNotificationsConfigV3.json");
});
}
}
+57
View File
@@ -0,0 +1,57 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
namespace asdfasdf.APIs;
public static class PlayerSettingsAPI
{
public static void Init(WebApplication app)
{
app.MapGet("/playersettings", (HttpRequest request) =>
{
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
return user.ps;
}
}
return null;
});
app.MapPut("/playersettings", ([FromForm] string key, [FromForm] string value, HttpRequest request) =>
{
List<PlayerSetting> ps = null;
int id = 0;
foreach (var user in Auth.currentUsers)
{
if (user.token == request.Headers.Authorization[0])
{
ps = user.ps;
id = user.id;
}
}
if (ps.Exists(x => x.Key == key))
{
app.Logger.LogInformation("Removing setting " + key);
ps.Remove(ps.Find(x => x.Key == key));
}
app.Logger.LogInformation("Adding setting " + key + " with value " + value);
ps.Add(new(){Key = key, Value = value});
File.WriteAllText("ServerData/Accounts/" + id + "/PlayerSettings.json", JsonSerializer.Serialize(ps));
ApiResponseNoValue response = new()
{
success = true
};
return response;
}).DisableAntiforgery();
}
}
+618
View File
@@ -0,0 +1,618 @@
using System.Text.Json;
using Microsoft.AspNetCore.Mvc;
namespace asdfasdf.APIs;
public static class Rooms
{
public static NameToIds roomNamesToIds;
private static void UpdateRoomNamesToIds()
{
NameToIds newRoomNamesToIds = new();
newRoomNamesToIds.names = new();
string[] dirs = Directory.GetDirectories("ServerData/Rooms");
newRoomNamesToIds.count = dirs.Length;
foreach (var room in dirs)
{
Room roomJson = JsonSerializer.Deserialize<Room>(File.ReadAllText(room + "/info.json"));
newRoomNamesToIds.names.Add(new()
{
id = roomJson.RoomId,
name = roomJson.Name
});
}
File.WriteAllText("ServerData/RoomNamesToIds.json", JsonSerializer.Serialize(newRoomNamesToIds));
}
public static void Init(WebApplication app)
{
if (!File.Exists("ServerData/RoomNamesToIds.json"))
{
UpdateRoomNamesToIds();
}
roomNamesToIds = JsonSerializer.Deserialize<NameToIds>(File.ReadAllText("ServerData/RoomNamesToIds.json"));
if (roomNamesToIds.count != Directory.GetDirectories("ServerData/Rooms").Length)
{
UpdateRoomNamesToIds();
}
app.MapGet("/rooms/ownedby/me", () =>
{
List<RoomDTO> ownedRooms = new();
DirectoryInfo roomsDir = new("ServerData/Rooms");
foreach (DirectoryInfo roomDir in roomsDir.EnumerateDirectories())
{
RoomDTO room = JsonSerializer.Deserialize<RoomDTO>(File.ReadAllText(roomDir.FullName + "/info.json"));
ownedRooms.Add(room);
}
return ownedRooms;
});
app.MapGet("/rooms/createdby/me", () =>
{
List<RoomDTO> ownedRooms = new();
DirectoryInfo roomsDir = new("ServerData/Rooms");
foreach (DirectoryInfo roomDir in roomsDir.EnumerateDirectories())
{
RoomDTO room = JsonSerializer.Deserialize<RoomDTO>(File.ReadAllText(roomDir.FullName + "/info.json"));
ownedRooms.Add(room);
}
return ownedRooms;
});
app.MapGet("/rooms/visitedby/me", (int skip, int take) =>
{
List<RoomDTO> ownedRooms = new();
DirectoryInfo roomsDir = new("ServerData/Rooms");
foreach (DirectoryInfo roomDir in roomsDir.EnumerateDirectories())
{
RoomDTO room = JsonSerializer.Deserialize<RoomDTO>(File.ReadAllText(roomDir.FullName + "/info.json"));
ownedRooms.Add(room);
}
return ownedRooms;
});
app.MapPost("/rooms/create", async (HttpRequest request) =>
{
var a = await request.ReadFormAsync();
var name = a.ElementAt(0);
var ugcVersion = a.ElementAt(1);
app.Logger.LogWarning($"(Rooms) /rooms/create STUB\n{name}\n{ugcVersion}");
RoomDTO room = new()
{
Name = name.Value,
UgcVersion = byte.Parse(ugcVersion.Value),
CreatedAt = DateTime.Now
};
CreateFolder("ServerData/Rooms/" + name.Value);
File.WriteAllText("ServerData/Rooms/" + name.Value + "/info.json", JsonSerializer.Serialize(room));
return Results.Created("/rooms/create", room);
});
app.MapPost("/rooms/{id}/clone", (int id, [FromForm] string name, HttpRequest request) =>
{
LoggedInUser user = null;
foreach (var user2 in Auth.currentUsers)
{
if (user2.token == request.Headers.Authorization[0])
{
user = user2;
}
}
if (user == null)
{
return Results.NotFound();
}
Room room = null;
for (int i = 0; i < roomNamesToIds.names.Count; i++)
{
if (roomNamesToIds.names[i].id == id)
{
room = JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + roomNamesToIds.names[i].name + "/info.json"));
}
}
for (int i = 0; i < roomNamesToIds.names.Count; i++)
{
if (roomNamesToIds.names[i].name == name)
{
ApiResponse alreadyExistsResponse = new()
{
success = false,
error = "The room " + roomNamesToIds.names[i].name + " already exists."
};
return Results.Ok(alreadyExistsResponse);
}
}
if (room == null)
{
return Results.NotFound();
}
List<Tags> tags = new();
tags.Add(new("beta", 1));
tags.Add(new("community", 2));
tags.Add(new("screen", 2));
tags.Add(new("walkvr", 2));
tags.Add(new("teleportvr", 2));
tags.Add(new("junior", 2));
tags.Add(new("pickout", 2));
room.Name = name;
room.RoomId = roomNamesToIds.count + 5;
room.SubRooms[0].RoomId = room.RoomId;
room.SubRooms[0].SubRoomId = 0;
room.SubRooms[0].CreatorAccountId = user.id;
room.Tags = tags;
room.ImageName = "lemres.png";
room.CreatorAccountId = user.id;
room.Roles[1].AccountId = user.id;
Directory.CreateDirectory("ServerData/Rooms/" + name);
File.WriteAllText("ServerData/Rooms/" + name + "/info.json", JsonSerializer.Serialize(room));
UpdateRoomNamesToIds();
roomNamesToIds = JsonSerializer.Deserialize<NameToIds>(File.ReadAllText("ServerData/RoomNamesToIds.json"));
ApiResponse response = new()
{
success = true,
error = string.Empty,
value = room
};
return Results.Ok(response);
}).DisableAntiforgery();
app.MapGet("/rooms", (string name, int include) =>
{
if (!Directory.Exists("ServerData/Rooms/" + name))
{
// return Results.NotFound();
}
return File.ReadAllText("ServerData/Rooms/" + name + "/info.json");
});
app.MapGet("/rooms/bulk", (string name, bool? excludePrivateRooms) =>
{
if (!Directory.Exists("ServerData/Rooms/" + name))
{
return Results.NotFound();
}
List<Room> rooms = new();
rooms.Add(JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + name + "/info.json")));
return Results.Ok(rooms);
});
app.MapGet("/rooms/{id}", (int id, int include) =>
{
if (Directory.Exists("ServerData/Rooms/" + id))
{
return Results.Ok(JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + id + "/info.json")));
}
for (int i = 0; i < roomNamesToIds.names.Count; i++)
{
if (roomNamesToIds.names[i].id == id)
{
return Results.Ok(JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + roomNamesToIds.names[i].name + "/info.json")));
}
}
return Results.NotFound();
});
app.MapGet("/rooms/hot", (int skip, int take) =>
{
app.Logger.LogWarning("(Rooms) /rooms/hot STUB");
List<Room> rooms = new();
rooms.Add(JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/RecCenter/info.json")));
var pagedRooms = new
{
Results = rooms,
TotalResults = 1
};
return pagedRooms;
});
app.MapGet("/rooms/{id}/interactionby/me", () =>
{
app.Logger.LogWarning("(Rooms) /rooms/{{id}}/interactionby/me STUB");
var result = new
{
Cheered = true,
Favorited = true,
LastVisitedAt = DateTime.UtcNow
};
return result;
});
app.MapPut("/rooms/{id}/interactionby/me/favorite", () =>
{
app.Logger.LogWarning("(Rooms) /rooms/{{id}}/interactionby/me/favorite STUB");
return new { Favorited = true };
});
app.MapDelete("/rooms/{id}/interactionby/me/favorite", () =>
{
app.Logger.LogWarning("(Rooms) /rooms/{{id}}/interactionby/me/favorite STUB");
return new { Favorited = false };
});
app.MapPut("/rooms/{id}/interactionby/me/cheer", () =>
{
app.Logger.LogWarning("(Rooms) /rooms/{{id}}/interactionby/me/cheer STUB");
return new { Cheered = true };
});
app.MapDelete("/rooms/{id}/interactionby/me/cheer", () =>
{
app.Logger.LogWarning("(Rooms) /rooms/{{id}}/interactionby/me/cheer STUB");
return new { Cheered = false };
});
app.MapGet("/photon_access_token", () =>
{
app.Logger.LogWarning("(Rooms) /photon_access_token STUB");
List<PhotonPermission> permissions = new();
permissions.Add(new()
{
Permission = "CAN_USE_ROOM_RESET_BUTTON",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_USE_DELETE_ALL_BUTTON",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_SAVE_INVENTIONS",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_SPAWN_INVENTIONS",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_USE_PLAY_GIZMOS_TOGGLE",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_USE_MAKER_PEN",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_USE_ROOM_RESET_BUTTON",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_USE_DELETE_ALL_BUTTON",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_SAVE_INVENTIONS",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_SPAWN_INVENTIONS",
Role = 0,
Override = true
});
permissions.Add(new()
{
Permission = "CAN_USE_PLAY_GIZMOS_TOGGLE",
Role = 0,
Override = true
});
PhotonAccessTokenObject accessToken = new()
{
Permissions = permissions.ToArray(),
PhotonAccessToken = "",
RoomInstanceId = Matchmaking.currentInstance.roomInstanceId
};
return accessToken;
});
app.MapGet("/publishState/configs", () =>
{
app.Logger.LogWarning("(Rooms) /publishState/configs STUB");
RoomPublishStateConfig config = new()
{
UpdateMaxCount = 5,
UpdateRollingWindowInDays = 10,
UpdateExpirationInDays = 9,
UpdateCooldownInDays = 1
};
ApiResponse response = new()
{
success = true,
value = config
};
return response;
});
app.MapGet("/rooms/{roomId}/subrooms/{subroomId}/saves", (int roomId, int subroomId) =>
{
app.Logger.LogWarning("(Rooms) /rooms/id/subrooms/id/saves STUB");
Room room = null;
for (int i = 0; i < roomNamesToIds.names.Count; i++)
{
if (roomNamesToIds.names[i].id == roomId)
{
room = JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + roomNamesToIds.names[i].name + "/info.json"));
}
}
if (room == null)
{
return Results.NotFound();
}
SubRooms subRoom = room.SubRooms[0];
List<CurrentSave> saves = new();
if (subRoom.CurrentSave == null)
{
saves.Add(new()
{
SubRoomId = (int)room.SubRooms[0].SubRoomId,
SubRoomDataSaveId = 1001,
ReferencedUnityAssetIds = Array.Empty<object>(),
PersistenceVersion = 50,
OMVersion = 0,
CreatedAt = DateTime.Now,
UgcSubVersion = 0,
});
}
else
{
saves.Add(subRoom.CurrentSave);
}
return Results.Ok(saves[0]);
});
app.MapPost("/rooms/{roomId}/subrooms/{subroomId}/data", async (int roomId, int subroomId, HttpRequest request) =>
{
Room room = null;
for (int i = 0; i < roomNamesToIds.names.Count; i++)
{
if (roomNamesToIds.names[i].id == roomId)
{
room = JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + roomNamesToIds.names[i].name + "/info.json"));
}
}
if (room == null)
{
return Results.NotFound();
}
var body = new StreamReader(request.Body);
var requestBody = await body.ReadToEndAsync();
SaveRequest saveRequest = JsonSerializer.Deserialize<SaveRequest>(requestBody);
if (room.SubRooms[0].CurrentSave == null)
{
room.SubRooms[0].CurrentSave = new()
{
SubRoomId = (int)room.SubRooms[0].SubRoomId,
SubRoomDataSaveId = 1001,
ReferencedUnityAssetIds = Array.Empty<object>(),
PersistenceVersion = 50,
OMVersion = 0,
CreatedAt = DateTime.Now,
UgcSubVersion = 0,
};
}
room.SubRooms[0].CurrentSave.DataBlob = saveRequest.SubRoomData.Filename;
room.SubRooms[0].CurrentSave.PersistenceVersion = saveRequest.PersistenceVersion;
ApiResponse response = new()
{
error = string.Empty,
success = true,
value = new SubroomSaveResponse
{
room = room,
subRoomDataSave = room.SubRooms[0].CurrentSave
}
};
if (File.Exists("ServerData/Rooms/" + room.Name + "/info.json.bak"))
{
File.Delete("ServerData/Rooms/" + room.Name + "/info.json.bak");
}
File.Move("ServerData/Rooms/" + room.Name + "/info.json", "ServerData/Rooms/" + room.Name + "/info.json.bak");
await File.WriteAllTextAsync("ServerData/Rooms/" + room.Name + "/info.json", JsonSerializer.Serialize(room));
return Results.Ok(response);
}).DisableAntiforgery();
app.MapGet("/rooms/{roomId}/subrooms/{subroomId}/data", (int roomId, int subroomId) =>
{
Room room = null;
for (int i = 0; i < roomNamesToIds.names.Count; i++)
{
if (roomNamesToIds.names[i].id == roomId)
{
room = JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + roomNamesToIds.names[i].name + "/info.json"));
}
}
if (room == null)
{
return Results.NotFound();
}
return Results.Ok(room.SubRooms[0]);
}).DisableAntiforgery();
app.MapPost("/rooms/regennamestoids", () =>
{
UpdateRoomNamesToIds();
roomNamesToIds = JsonSerializer.Deserialize<NameToIds>(File.ReadAllText("ServerData/RoomNamesToIds.json"));
});
app.MapGet("/rooms/{roomId}/playerdata/me", () =>
{
app.Logger.LogWarning("(Rooms) /rooms/{{roomId}}/playerdata/me STUB");
RoomPlayerData playerData = new()
{
Data = string.Empty
};
return playerData;
});
app.MapGet("/room/{name}", async (string name, HttpContext context) =>
{
return Results.File(await File.ReadAllBytesAsync("wwwroot/room/" + name));
});
app.MapGet("/rooms/{roomId}/similar", (int roomId) =>
{
app.Logger.LogWarning("(Rooms) /rooms/{{roomId}}/similar STUB");
List<Room> rooms = new();
rooms.Add(JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/RecCenter/info.json")));
var pagedRooms = new
{
Results = rooms,
TotalResults = 1
};
return pagedRooms;
});
app.MapGet("/rooms/base", () =>
{
app.Logger.LogWarning("(Rooms) /rooms/base STUB");
List<Room> rooms = new();
rooms.Add(JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/MakerRoom/info.json")));
return rooms;
});
app.MapGet("/room/{roomId}/instances", (int roomId) =>
{
List<RoomInstance> instances = new();
foreach (var user in Auth.currentUsers)
{
if (user.currentInstance != null)
{
if (user.currentInstance.roomId == roomId)
{
instances.Add(user.currentInstance);
}
}
}
return instances;
});
// 2020
app.MapGet("/api/rooms/v4/details/{roomId}", (int roomId) =>
{
if (Directory.Exists("ServerData/Rooms/" + roomId))
{
return Results.Ok(JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + roomId + "/info.json")));
}
for (int i = 0; i < roomNamesToIds.names.Count; i++)
{
if (roomNamesToIds.names[i].id == roomId)
{
return Results.Ok(JsonSerializer.Deserialize<Room>(File.ReadAllText("ServerData/Rooms/" + roomNamesToIds.names[i].name + "/info.json")));
}
}
return Results.NotFound();
});
}
private static void CreateFolder(string dir)
{
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
}
}
+30
View File
@@ -0,0 +1,30 @@
namespace asdfasdf.APIs;
public static class Storage
{
public static void Init(WebApplication app)
{
app.MapPost("/upload", async (HttpRequest request) =>
{
var file = request.Form.Files.FirstOrDefault();
string fileName;
if (Matchmaking.currentInstance != null)
{
fileName = Matchmaking.currentInstance.roomId + "-" + Guid.NewGuid() + ".room";
}
else
{
fileName = Guid.NewGuid() + ".room";
}
using (var stream = new FileStream("wwwroot/room/" + fileName, FileMode.Create))
{
await file.CopyToAsync(stream);
}
return Results.Ok(new {Filename = fileName});
});
}
}
+61
View File
@@ -0,0 +1,61 @@
namespace asdfasdf.APIs;
public static class Studio
{
public static void Init(WebApplication app)
{
app.MapGet("/analytics/rudderstack-api-key", () =>
{
return "23NiJHIgu3koaGNCZIiuYvIQNCu";
});
app.MapGet("/access/override/0", () =>
{
app.Logger.LogWarning("(Studio) /access/override/0 STUB");
AccessOverrideDTO access = new()
{
AccountId = Accounts.account.accountId,
AvatarStudioAccess = AvatarStudioAccessFlags.Avatars | AvatarStudioAccessFlags.Roomie | AvatarStudioAccessFlags.Badges | AvatarStudioAccessFlags.Consumables,
CreatedAt = DateTime.Now,
ModifiedAt = DateTime.Now,
StudioAccess = StudioAccessType.AlwaysAllow
};
return access;
});
app.MapGet("/collaboration/owners-in-room", (int roomId, long subRoomId) =>
{
app.Logger.LogWarning("(Studio) /collaboration/owners-in-room STUB");
StudioOwnersInRoom ownersInRoom = new()
{
success = true,
};
return ownersInRoom;
});
app.MapGet("/cloud-builds/for-room", (int roomId, int subRoomId, int skip, int take) =>
{
return new CloudBuildDTO()
{
CloudBuildId = string.Empty,
StartedAt = DateTime.MinValue,
CompletedAt = DateTime.MinValue,
Error = string.Empty,
UnityAssetId = string.Empty,
CreatedByAccountId = 3
};
});
}
}