ServerApi.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. using System.Linq;
  2. using System.Net;
  3. using System.Net.Http;
  4. using System.Security.Cryptography;
  5. using System.Text;
  6. using System.Text.Json;
  7. using System.Text.Json.Nodes;
  8. using System.Threading.Tasks;
  9. using Content.Server.Administration.Systems;
  10. using Content.Server.GameTicking;
  11. using Content.Server.GameTicking.Presets;
  12. using Content.Server.GameTicking.Rules.Components;
  13. using Content.Server.Maps;
  14. using Content.Server.RoundEnd;
  15. using Content.Shared.Administration.Managers;
  16. using Content.Shared.CCVar;
  17. using Content.Shared.GameTicking.Components;
  18. using Content.Shared.Prototypes;
  19. using Robust.Server.ServerStatus;
  20. using Robust.Shared.Asynchronous;
  21. using Robust.Shared.Configuration;
  22. using Robust.Shared.Network;
  23. using Robust.Shared.Player;
  24. using Robust.Shared.Prototypes;
  25. using Robust.Shared.Utility;
  26. namespace Content.Server.Administration;
  27. /// <summary>
  28. /// Exposes various admin-related APIs via the game server's <see cref="StatusHost"/>.
  29. /// </summary>
  30. public sealed partial class ServerApi : IPostInjectInit
  31. {
  32. private const string SS14TokenScheme = "SS14Token";
  33. private static readonly HashSet<string> PanicBunkerCVars =
  34. [
  35. CCVars.PanicBunkerEnabled.Name,
  36. CCVars.PanicBunkerDisableWithAdmins.Name,
  37. CCVars.PanicBunkerEnableWithoutAdmins.Name,
  38. CCVars.PanicBunkerCountDeadminnedAdmins.Name,
  39. CCVars.PanicBunkerShowReason.Name,
  40. CCVars.PanicBunkerMinAccountAge.Name,
  41. CCVars.PanicBunkerMinOverallMinutes.Name,
  42. CCVars.PanicBunkerCustomReason.Name,
  43. ];
  44. [Dependency] private readonly IStatusHost _statusHost = default!;
  45. [Dependency] private readonly IConfigurationManager _config = default!;
  46. [Dependency] private readonly ISharedPlayerManager _playerManager = default!;
  47. [Dependency] private readonly ISharedAdminManager _adminManager = default!;
  48. [Dependency] private readonly IGameMapManager _gameMapManager = default!;
  49. [Dependency] private readonly IServerNetManager _netManager = default!;
  50. [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
  51. [Dependency] private readonly IComponentFactory _componentFactory = default!;
  52. [Dependency] private readonly ITaskManager _taskManager = default!;
  53. [Dependency] private readonly EntityManager _entityManager = default!;
  54. [Dependency] private readonly ILogManager _logManager = default!;
  55. [Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
  56. [Dependency] private readonly ILocalizationManager _loc = default!;
  57. private string _token = string.Empty;
  58. private ISawmill _sawmill = default!;
  59. void IPostInjectInit.PostInject()
  60. {
  61. _sawmill = _logManager.GetSawmill("serverApi");
  62. // Get
  63. RegisterActorHandler(HttpMethod.Get, "/admin/info", InfoHandler);
  64. RegisterHandler(HttpMethod.Get, "/admin/game_rules", GetGameRules);
  65. RegisterHandler(HttpMethod.Get, "/admin/presets", GetPresets);
  66. // Post
  67. RegisterActorHandler(HttpMethod.Post, "/admin/actions/round/start", ActionRoundStart);
  68. RegisterActorHandler(HttpMethod.Post, "/admin/actions/round/end", ActionRoundEnd);
  69. RegisterActorHandler(HttpMethod.Post, "/admin/actions/round/restartnow", ActionRoundRestartNow);
  70. RegisterActorHandler(HttpMethod.Post, "/admin/actions/kick", ActionKick);
  71. RegisterActorHandler(HttpMethod.Post, "/admin/actions/add_game_rule", ActionAddGameRule);
  72. RegisterActorHandler(HttpMethod.Post, "/admin/actions/end_game_rule", ActionEndGameRule);
  73. RegisterActorHandler(HttpMethod.Post, "/admin/actions/force_preset", ActionForcePreset);
  74. RegisterActorHandler(HttpMethod.Post, "/admin/actions/set_motd", ActionForceMotd);
  75. RegisterActorHandler(HttpMethod.Patch, "/admin/actions/panic_bunker", ActionPanicPunker);
  76. }
  77. public void Initialize()
  78. {
  79. _config.OnValueChanged(CCVars.AdminApiToken, UpdateToken, true);
  80. }
  81. public void Shutdown()
  82. {
  83. _config.UnsubValueChanged(CCVars.AdminApiToken, UpdateToken);
  84. }
  85. private void UpdateToken(string token)
  86. {
  87. _token = token;
  88. }
  89. #region Actions
  90. /// <summary>
  91. /// Changes the panic bunker settings.
  92. /// </summary>
  93. private async Task ActionPanicPunker(IStatusHandlerContext context, Actor actor)
  94. {
  95. var request = await ReadJson<JsonObject>(context);
  96. if (request == null)
  97. return;
  98. var toSet = new Dictionary<string, object>();
  99. foreach (var (cVar, value) in request)
  100. {
  101. if (!PanicBunkerCVars.Contains(cVar))
  102. {
  103. await RespondBadRequest(context, $"Invalid panic bunker CVar: '{cVar}'");
  104. return;
  105. }
  106. if (value == null)
  107. {
  108. await RespondBadRequest(context, $"Value is null: '{cVar}'");
  109. return;
  110. }
  111. if (value is not JsonValue jsonValue)
  112. {
  113. await RespondBadRequest(context, $"Value is not valid: '{cVar}'");
  114. return;
  115. }
  116. object castValue;
  117. var cVarType = _config.GetCVarType(cVar);
  118. if (cVarType == typeof(bool))
  119. {
  120. if (!jsonValue.TryGetValue(out bool b))
  121. {
  122. await RespondBadRequest(context, $"CVar '{cVar}' must be of type bool.");
  123. return;
  124. }
  125. castValue = b;
  126. }
  127. else if (cVarType == typeof(int))
  128. {
  129. if (!jsonValue.TryGetValue(out int i))
  130. {
  131. await RespondBadRequest(context, $"CVar '{cVar}' must be of type int.");
  132. return;
  133. }
  134. castValue = i;
  135. }
  136. else if (cVarType == typeof(string))
  137. {
  138. if (!jsonValue.TryGetValue(out string? s))
  139. {
  140. await RespondBadRequest(context, $"CVar '{cVar}' must be of type string.");
  141. return;
  142. }
  143. castValue = s;
  144. }
  145. else
  146. {
  147. throw new NotSupportedException("Unsupported CVar type");
  148. }
  149. toSet[cVar] = castValue;
  150. }
  151. await RunOnMainThread(() =>
  152. {
  153. foreach (var (cVar, value) in toSet)
  154. {
  155. _config.SetCVar(cVar, value);
  156. _sawmill.Info(
  157. $"Panic bunker property '{cVar}' changed to '{value}' by {FormatLogActor(actor)}.");
  158. }
  159. });
  160. await RespondOk(context);
  161. }
  162. /// <summary>
  163. /// Sets the current MOTD.
  164. /// </summary>
  165. private async Task ActionForceMotd(IStatusHandlerContext context, Actor actor)
  166. {
  167. var motd = await ReadJson<MotdActionBody>(context);
  168. if (motd == null)
  169. return;
  170. _sawmill.Info($"MOTD changed to \"{motd.Motd}\" by {FormatLogActor(actor)}.");
  171. await RunOnMainThread(() => _config.SetCVar(CCVars.MOTD, motd.Motd));
  172. // A hook in the MOTD system sends the changes to each client
  173. await RespondOk(context);
  174. }
  175. /// <summary>
  176. /// Forces the next preset-
  177. /// </summary>
  178. private async Task ActionForcePreset(IStatusHandlerContext context, Actor actor)
  179. {
  180. var body = await ReadJson<PresetActionBody>(context);
  181. if (body == null)
  182. return;
  183. await RunOnMainThread(async () =>
  184. {
  185. var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
  186. if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
  187. {
  188. await RespondError(
  189. context,
  190. ErrorCode.InvalidRoundState,
  191. HttpStatusCode.Conflict,
  192. "Game must be in pre-round lobby");
  193. return;
  194. }
  195. var preset = ticker.FindGamePreset(body.PresetId);
  196. if (preset == null)
  197. {
  198. await RespondError(
  199. context,
  200. ErrorCode.GameRuleNotFound,
  201. HttpStatusCode.UnprocessableContent,
  202. $"Game rule '{body.PresetId}' doesn't exist");
  203. return;
  204. }
  205. ticker.SetGamePreset(preset);
  206. _sawmill.Info($"Forced the game to start with preset {body.PresetId} by {FormatLogActor(actor)}.");
  207. await RespondOk(context);
  208. });
  209. }
  210. /// <summary>
  211. /// Ends an active game rule.
  212. /// </summary>
  213. private async Task ActionEndGameRule(IStatusHandlerContext context, Actor actor)
  214. {
  215. var body = await ReadJson<GameRuleActionBody>(context);
  216. if (body == null)
  217. return;
  218. await RunOnMainThread(async () =>
  219. {
  220. var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
  221. var gameRule = ticker
  222. .GetActiveGameRules()
  223. .FirstOrNull(rule =>
  224. _entityManager.MetaQuery.GetComponent(rule).EntityPrototype?.ID == body.GameRuleId);
  225. if (gameRule == null)
  226. {
  227. await RespondError(context,
  228. ErrorCode.GameRuleNotFound,
  229. HttpStatusCode.UnprocessableContent,
  230. $"Game rule '{body.GameRuleId}' not found or not active");
  231. return;
  232. }
  233. _sawmill.Info($"Ended game rule {body.GameRuleId} by {FormatLogActor(actor)}.");
  234. ticker.EndGameRule(gameRule.Value);
  235. await RespondOk(context);
  236. });
  237. }
  238. /// <summary>
  239. /// Adds a game rule to the current round.
  240. /// </summary>
  241. private async Task ActionAddGameRule(IStatusHandlerContext context, Actor actor)
  242. {
  243. var body = await ReadJson<GameRuleActionBody>(context);
  244. if (body == null)
  245. return;
  246. await RunOnMainThread(async () =>
  247. {
  248. var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
  249. if (!_prototypeManager.HasIndex<EntityPrototype>(body.GameRuleId))
  250. {
  251. await RespondError(context,
  252. ErrorCode.GameRuleNotFound,
  253. HttpStatusCode.UnprocessableContent,
  254. $"Game rule '{body.GameRuleId}' not found or not active");
  255. return;
  256. }
  257. var ruleEntity = ticker.AddGameRule(body.GameRuleId);
  258. _sawmill.Info($"Added game rule {body.GameRuleId} by {FormatLogActor(actor)}.");
  259. if (ticker.RunLevel == GameRunLevel.InRound)
  260. {
  261. ticker.StartGameRule(ruleEntity);
  262. _sawmill.Info($"Started game rule {body.GameRuleId} by {FormatLogActor(actor)}.");
  263. }
  264. await RespondOk(context);
  265. });
  266. }
  267. /// <summary>
  268. /// Kicks a player.
  269. /// </summary>
  270. private async Task ActionKick(IStatusHandlerContext context, Actor actor)
  271. {
  272. var body = await ReadJson<KickActionBody>(context);
  273. if (body == null)
  274. return;
  275. await RunOnMainThread(async () =>
  276. {
  277. if (!_playerManager.TryGetSessionById(new NetUserId(body.Guid), out var player))
  278. {
  279. await RespondError(
  280. context,
  281. ErrorCode.PlayerNotFound,
  282. HttpStatusCode.UnprocessableContent,
  283. "Player not found");
  284. return;
  285. }
  286. var reason = body.Reason ?? "No reason supplied";
  287. reason += " (kicked by admin)";
  288. _netManager.DisconnectChannel(player.Channel, reason);
  289. await RespondOk(context);
  290. _sawmill.Info($"Kicked player {player.Name} ({player.UserId}) for {reason} by {FormatLogActor(actor)}");
  291. });
  292. }
  293. private async Task ActionRoundStart(IStatusHandlerContext context, Actor actor)
  294. {
  295. await RunOnMainThread(async () =>
  296. {
  297. var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
  298. if (ticker.RunLevel != GameRunLevel.PreRoundLobby)
  299. {
  300. await RespondError(
  301. context,
  302. ErrorCode.InvalidRoundState,
  303. HttpStatusCode.Conflict,
  304. "Round already started");
  305. return;
  306. }
  307. ticker.StartRound();
  308. _sawmill.Info($"Forced round start by {FormatLogActor(actor)}");
  309. await RespondOk(context);
  310. });
  311. }
  312. private async Task ActionRoundEnd(IStatusHandlerContext context, Actor actor)
  313. {
  314. await RunOnMainThread(async () =>
  315. {
  316. var roundEndSystem = _entitySystemManager.GetEntitySystem<RoundEndSystem>();
  317. var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
  318. if (ticker.RunLevel != GameRunLevel.InRound)
  319. {
  320. await RespondError(
  321. context,
  322. ErrorCode.InvalidRoundState,
  323. HttpStatusCode.Conflict,
  324. "Round is not active");
  325. return;
  326. }
  327. roundEndSystem.EndRound();
  328. _sawmill.Info($"Forced round end by {FormatLogActor(actor)}");
  329. await RespondOk(context);
  330. });
  331. }
  332. private async Task ActionRoundRestartNow(IStatusHandlerContext context, Actor actor)
  333. {
  334. await RunOnMainThread(async () =>
  335. {
  336. var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
  337. ticker.RestartRound();
  338. _sawmill.Info($"Forced instant round restart by {FormatLogActor(actor)}");
  339. await RespondOk(context);
  340. });
  341. }
  342. #endregion
  343. #region Fetching
  344. /// <summary>
  345. /// Returns an array containing all available presets.
  346. /// </summary>
  347. private async Task GetPresets(IStatusHandlerContext context)
  348. {
  349. var presets = await RunOnMainThread(() =>
  350. {
  351. var presets = new List<PresetResponse.Preset>();
  352. foreach (var preset in _prototypeManager.EnumeratePrototypes<GamePresetPrototype>())
  353. {
  354. presets.Add(new PresetResponse.Preset
  355. {
  356. Id = preset.ID,
  357. ModeTitle = _loc.GetString(preset.ModeTitle),
  358. Description = _loc.GetString(preset.Description)
  359. });
  360. }
  361. return presets;
  362. });
  363. await context.RespondJsonAsync(new PresetResponse
  364. {
  365. Presets = presets
  366. });
  367. }
  368. /// <summary>
  369. /// Returns an array containing all game rules.
  370. /// </summary>
  371. private async Task GetGameRules(IStatusHandlerContext context)
  372. {
  373. var gameRules = new List<string>();
  374. foreach (var gameRule in _prototypeManager.EnumeratePrototypes<EntityPrototype>())
  375. {
  376. if (gameRule.Abstract)
  377. continue;
  378. if (gameRule.HasComponent<GameRuleComponent>(_componentFactory))
  379. gameRules.Add(gameRule.ID);
  380. }
  381. await context.RespondJsonAsync(new GameruleResponse
  382. {
  383. GameRules = gameRules
  384. });
  385. }
  386. /// <summary>
  387. /// Handles fetching information.
  388. /// </summary>
  389. private async Task InfoHandler(IStatusHandlerContext context, Actor actor)
  390. {
  391. /*
  392. Information to display
  393. Round number
  394. Connected players
  395. Active admins
  396. Active game rules
  397. Active game preset
  398. Active map
  399. MOTD
  400. Panic bunker status
  401. */
  402. var info = await RunOnMainThread<InfoResponse>(() =>
  403. {
  404. var ticker = _entitySystemManager.GetEntitySystem<GameTicker>();
  405. var adminSystem = _entitySystemManager.GetEntitySystem<AdminSystem>();
  406. var players = new List<InfoResponse.Player>();
  407. foreach (var player in _playerManager.Sessions)
  408. {
  409. var adminData = _adminManager.GetAdminData(player, true);
  410. players.Add(new InfoResponse.Player
  411. {
  412. UserId = player.UserId.UserId,
  413. Name = player.Name,
  414. IsAdmin = adminData != null,
  415. IsDeadminned = !adminData?.Active ?? false
  416. });
  417. }
  418. InfoResponse.MapInfo? mapInfo = null;
  419. if (_gameMapManager.GetSelectedMap() is { } mapPrototype)
  420. {
  421. mapInfo = new InfoResponse.MapInfo
  422. {
  423. Id = mapPrototype.ID,
  424. Name = mapPrototype.MapName
  425. };
  426. }
  427. var gameRules = new List<string>();
  428. foreach (var addedGameRule in ticker.GetActiveGameRules())
  429. {
  430. var meta = _entityManager.MetaQuery.GetComponent(addedGameRule);
  431. gameRules.Add(meta.EntityPrototype?.ID ?? meta.EntityPrototype?.Name ?? "Unknown");
  432. }
  433. var panicBunkerCVars = PanicBunkerCVars.ToDictionary(c => c, c => _config.GetCVar(c));
  434. return new InfoResponse
  435. {
  436. Players = players,
  437. RoundId = ticker.RoundId,
  438. Map = mapInfo,
  439. PanicBunker = panicBunkerCVars,
  440. GamePreset = ticker.CurrentPreset?.ID,
  441. GameRules = gameRules,
  442. MOTD = _config.GetCVar(CCVars.MOTD)
  443. };
  444. });
  445. await context.RespondJsonAsync(info);
  446. }
  447. #endregion
  448. private async Task<bool> CheckAccess(IStatusHandlerContext context)
  449. {
  450. var auth = context.RequestHeaders.TryGetValue("Authorization", out var authToken);
  451. if (!auth)
  452. {
  453. await RespondError(
  454. context,
  455. ErrorCode.AuthenticationNeeded,
  456. HttpStatusCode.Unauthorized,
  457. "Authorization is required");
  458. return false;
  459. }
  460. var authHeaderValue = authToken.ToString();
  461. var spaceIndex = authHeaderValue.IndexOf(' ');
  462. if (spaceIndex == -1)
  463. {
  464. await RespondBadRequest(context, "Invalid Authorization header value");
  465. return false;
  466. }
  467. var authScheme = authHeaderValue[..spaceIndex];
  468. var authValue = authHeaderValue[spaceIndex..].Trim();
  469. if (authScheme != SS14TokenScheme)
  470. {
  471. await RespondBadRequest(context, "Invalid Authorization scheme");
  472. return false;
  473. }
  474. if (_token == "")
  475. {
  476. _sawmill.Debug("No authorization token set for admin API");
  477. }
  478. else if (CryptographicOperations.FixedTimeEquals(
  479. Encoding.UTF8.GetBytes(authValue),
  480. Encoding.UTF8.GetBytes(_token)))
  481. {
  482. return true;
  483. }
  484. await RespondError(
  485. context,
  486. ErrorCode.AuthenticationInvalid,
  487. HttpStatusCode.Unauthorized,
  488. "Authorization is invalid");
  489. // Invalid auth header, no access
  490. _sawmill.Info($"Unauthorized access attempt to admin API from {context.RemoteEndPoint}");
  491. return false;
  492. }
  493. private async Task<Actor?> CheckActor(IStatusHandlerContext context)
  494. {
  495. // The actor is JSON encoded in the header
  496. var actor = context.RequestHeaders.TryGetValue("Actor", out var actorHeader) ? actorHeader.ToString() : null;
  497. if (actor == null)
  498. {
  499. await RespondBadRequest(context, "Actor must be supplied");
  500. return null;
  501. }
  502. Actor? actorData;
  503. try
  504. {
  505. actorData = JsonSerializer.Deserialize<Actor>(actor);
  506. if (actorData == null)
  507. {
  508. await RespondBadRequest(context, "Actor is null");
  509. return null;
  510. }
  511. }
  512. catch (JsonException exception)
  513. {
  514. await RespondBadRequest(context, "Actor field JSON is invalid", ExceptionData.FromException(exception));
  515. return null;
  516. }
  517. return actorData;
  518. }
  519. #region From Client
  520. private sealed class Actor
  521. {
  522. public required Guid Guid { get; init; }
  523. public required string Name { get; init; }
  524. }
  525. private sealed class KickActionBody
  526. {
  527. public required Guid Guid { get; init; }
  528. public string? Reason { get; init; }
  529. }
  530. private sealed class GameRuleActionBody
  531. {
  532. public required string GameRuleId { get; init; }
  533. }
  534. private sealed class PresetActionBody
  535. {
  536. public required string PresetId { get; init; }
  537. }
  538. private sealed class MotdActionBody
  539. {
  540. public required string Motd { get; init; }
  541. }
  542. #endregion
  543. #region Responses
  544. private record BaseResponse(
  545. string Message,
  546. ErrorCode ErrorCode = ErrorCode.None,
  547. ExceptionData? Exception = null);
  548. private record ExceptionData(string Message, string? StackTrace = null)
  549. {
  550. public static ExceptionData FromException(Exception e)
  551. {
  552. return new ExceptionData(e.Message, e.StackTrace);
  553. }
  554. }
  555. private enum ErrorCode
  556. {
  557. None = 0,
  558. AuthenticationNeeded = 1,
  559. AuthenticationInvalid = 2,
  560. InvalidRoundState = 3,
  561. PlayerNotFound = 4,
  562. GameRuleNotFound = 5,
  563. BadRequest = 6,
  564. }
  565. #endregion
  566. #region Misc
  567. /// <summary>
  568. /// Record used to send the response for the info endpoint.
  569. /// </summary>
  570. private sealed class InfoResponse
  571. {
  572. public required int RoundId { get; init; }
  573. public required List<Player> Players { get; init; }
  574. public required List<string> GameRules { get; init; }
  575. public required string? GamePreset { get; init; }
  576. public required MapInfo? Map { get; init; }
  577. public required string? MOTD { get; init; }
  578. public required Dictionary<string, object> PanicBunker { get; init; }
  579. public sealed class Player
  580. {
  581. public required Guid UserId { get; init; }
  582. public required string Name { get; init; }
  583. public required bool IsAdmin { get; init; }
  584. public required bool IsDeadminned { get; init; }
  585. }
  586. public sealed class MapInfo
  587. {
  588. public required string Id { get; init; }
  589. public required string Name { get; init; }
  590. }
  591. }
  592. private sealed class PresetResponse
  593. {
  594. public required List<Preset> Presets { get; init; }
  595. public sealed class Preset
  596. {
  597. public required string Id { get; init; }
  598. public required string Description { get; init; }
  599. public required string ModeTitle { get; init; }
  600. }
  601. }
  602. private sealed class GameruleResponse
  603. {
  604. public required List<string> GameRules { get; init; }
  605. }
  606. #endregion
  607. }