mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-26 07:29:00 -07:00
92 lines
2.9 KiB
C#
92 lines
2.9 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using RadicadeServer.DB;
|
|
using RadicadeServer.RecNet.Config;
|
|
using RadicadeServer.RecNet.Keepsakes;
|
|
|
|
namespace RadicadeServer.API.Config
|
|
{
|
|
[Route("api/gameconfigs/")]
|
|
public class GameConfigAPI : Controller
|
|
{
|
|
private static readonly Dictionary<string, string> Local2023Overrides = new()
|
|
{
|
|
["RRUI.UseRRUIHomeScreen"] = "true",
|
|
["USE_NEW_HOME_SCREEN"] = "true",
|
|
["new_watch_architecture_enabled"] = "true",
|
|
["watch_layer.new_watch_architecture_enabled"] = "true",
|
|
["HAS_SEEN_HOME_SCREEN_CHOICE"] = "true",
|
|
["AntiHile.QD"] = "false",
|
|
["Radicade.Invites.UseRRUIDialog"] = "true",
|
|
["Radicade.Invites.ShowOnlineFriendsBeforeJoining"] = "true",
|
|
["Lifecycle.PSF.FriendRoomInviteRateLimitingCount"] = "2147483647",
|
|
["AndroidMobile.enforceFileWatcher"] = "0",
|
|
["AndroidMobile.enforceHashCheck"] = "0",
|
|
["AndroidMobile.runFileWatcher"] = "0",
|
|
["AndroidMobile.runHashCheck"] = "0",
|
|
["Desktop_Oculus.enforceFileWatcher"] = "0",
|
|
["Desktop_Oculus.enforceHashCheck"] = "0",
|
|
["Desktop_Oculus.runFileWatcher"] = "0",
|
|
["Desktop_Oculus.runHashCheck"] = "0",
|
|
["Desktop_Steam.enforceFileWatcher"] = "0",
|
|
["Desktop_Steam.enforceHashCheck"] = "0",
|
|
["Desktop_Steam.runFileWatcher"] = "0",
|
|
["Desktop_Steam.runHashCheck"] = "0",
|
|
["OculusQuest.enforceFileWatcher"] = "0",
|
|
["OculusQuest.enforceHashCheck"] = "0",
|
|
["OculusQuest.runFileWatcher"] = "0",
|
|
["OculusQuest.runHashCheck"] = "0",
|
|
["Steam.enforceFileWatcher"] = "0",
|
|
["Steam.enforceHashCheck"] = "0",
|
|
["Steam.runFileWatcher"] = "0",
|
|
["Steam.runHashCheck"] = "0",
|
|
};
|
|
|
|
private readonly RecDBContext db;
|
|
|
|
public GameConfigAPI(RecDBContext context)
|
|
{
|
|
db = context;
|
|
}
|
|
|
|
private static IEnumerable<KeyValuePair<string, string>> KeepsakeConfigValues()
|
|
{
|
|
var enabled = KeepsakeFeature.Enabled;
|
|
yield return new("KeepsakeFeatureEnabled", enabled ? "true" : "false");
|
|
yield return new("KeepsakeRoomLimit", enabled ? "100" : "0");
|
|
yield return new("ProgressionEvents.EnableKeepsakeManager", enabled ? "true" : "false");
|
|
}
|
|
|
|
[HttpGet("v1/all")]
|
|
public IActionResult GetAllGameConfigs()
|
|
{
|
|
var overrides = new Dictionary<string, string>(Local2023Overrides);
|
|
foreach (var (key, value) in KeepsakeConfigValues()) overrides[key] = value;
|
|
|
|
var configs = db.GameConfig
|
|
.AsEnumerable()
|
|
.Select(x => new ConfigVal(
|
|
x.Key,
|
|
overrides.TryGetValue(x.Key, out var value)
|
|
? value
|
|
: SplitTestConfigs.FilterHardOverridesFor2023Client(x.Key, x.Value)))
|
|
.GroupBy(x => x.Key)
|
|
.Select(group =>
|
|
{
|
|
if (overrides.TryGetValue(group.Key, out var value))
|
|
return new ConfigVal(group.Key, value);
|
|
|
|
return group.Last();
|
|
})
|
|
.ToList();
|
|
|
|
foreach (var (key, value) in overrides)
|
|
{
|
|
if (!configs.Any(x => x.Key == key))
|
|
configs.Add(new ConfigVal(key, value));
|
|
}
|
|
|
|
return Ok(configs);
|
|
}
|
|
}
|
|
}
|