0.3.0: Freunde und Lobby, Server-Browser entfernt

- Seite Freunde: hinzufuegen, annehmen, online-Anzeige, Lobby erstellen/einladen/beitreten, Server starten
- SPIELEN in der Lobby: Ticket fuer die Lobby + Relay-Adresse in BSO.json
- Knopf 'Mod herunterladen' holt jederzeit die neueste Mod

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 19:30:22 +01:00
co-authored by Claude Opus 5.5
parent bcc85a51de
commit 3281468bee
10 changed files with 219 additions and 165 deletions
+3 -13
View File
@@ -71,20 +71,10 @@ 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>();
}
// --- Freunde und Lobby (alles mit dem Konto-Token)
public static Task<Result> Get(string path, string token) => Send(HttpMethod.Get, path, null, token);
public static Task<Result> Post(string path, string token, object? body = null) => Send(HttpMethod.Post, path, body ?? new { }, token);
public static async Task<Release?> Latest(string product)
{
var r = await Send(HttpMethod.Get, "/api/releases/latest?product=" + product, null, null);