0.2.0: Server-Browser und Spiel-Ticket

- Seite Server: Liste der Website, Ping/Spieler direkt abgefragt, BEITRETEN und Direkt verbinden
- Holt beim Spielen ein Spiel-Ticket und schreibt es in BSO.json

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 18:10:55 +01:00
co-authored by Claude Opus 5.5
parent 077e39fa8a
commit fb8d6d6844
8 changed files with 174 additions and 7 deletions
+14
View File
@@ -71,6 +71,20 @@ public static class Api
public static Task<Result> Logout(string token) => Send(HttpMethod.Post, "/api/auth/logout", new { }, token);
/// <summary>Spiel-Ticket fuer die Mod (signiert, 24 h) -> { ticket, username, expiresUtc }</summary>
public static Task<Result> Ticket(string token) => Send(HttpMethod.Post, "/api/auth/ticket", new { }, token);
public sealed record ServerEntry(string name, string description, string address, string host, int port, int players, int maxPlayers,
string version, int protocol, string onlineSinceUtc);
/// <summary>Oeffentliche, erreichbare Server (Serverliste der Website).</summary>
public static async Task<List<ServerEntry>> Servers()
{
var r = await Send(HttpMethod.Get, "/api/servers", null, null);
if (!r.Ok) throw new Exception(r.Error ?? "Serverliste nicht verfuegbar");
return r.Json.GetProperty("servers").Deserialize<List<ServerEntry>>() ?? new List<ServerEntry>();
}
public static async Task<Release?> Latest(string product)
{
var r = await Send(HttpMethod.Get, "/api/releases/latest?product=" + product, null, null);