From f9c44a89b3e035b88c452bf99e389e0f47c75c6e Mon Sep 17 00:00:00 2001 From: neckfire Date: Thu, 16 Jul 2026 10:35:37 +0200 Subject: [PATCH] game-server: catch-all request capture for squad-invite RE Log every unrouted POST at Warning [CAPTURE UNROUTED] (reveals native PlayFab endpoints the emulator doesn't implement, e.g. /Group/CreateGroup, /Lobby/*) and every social/squad/invite/friend/matchmaking call (path or body) at Information [CAPTURE SOCIAL]. Lets us pin the exact invite mechanism when reproduced in game. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Middleware/RequestLoggerMiddleware.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/Prospect.Server.Api/Middleware/RequestLoggerMiddleware.cs b/src/Prospect.Server.Api/Middleware/RequestLoggerMiddleware.cs index 9c9f9d7..7da8ab2 100644 --- a/src/Prospect.Server.Api/Middleware/RequestLoggerMiddleware.cs +++ b/src/Prospect.Server.Api/Middleware/RequestLoggerMiddleware.cs @@ -9,6 +9,14 @@ public class RequestLoggerMiddleware private readonly ILogger _logger; private readonly RequestDelegate _next; + // Keywords used to surface social/squad/invite traffic while reverse-engineering the + // squad-invite flow (see SQUAD-EMULATION.md). Matched against the path AND the body + // (the CloudScript function name lives in the body of /Client/ExecuteFunction). + private static readonly string[] SocialKeywords = + { + "group", "party", "lobby", "squad", "invite", "friend", "social", "matchmak", + }; + public RequestLoggerMiddleware(ILogger logger, RequestDelegate next) { _logger = logger; @@ -32,6 +40,27 @@ public class RequestLoggerMiddleware } await _next(context); + + // ── Capture pass (squad-invite RE, see SQUAD-EMULATION.md) ────────────── + // Runs AFTER the pipeline so we know whether the request was actually routed. + if (context.Request.Method == "POST") + { + var path = context.Request.Path.Value ?? ""; + var haystack = (path + " " + body).ToLowerInvariant(); + + // Any POST that fell through to a 404 = an endpoint the emulator does NOT implement + // (e.g. a native PlayFab /Group/CreateGroup or /Lobby/* the client tried to call). + if (context.Response.StatusCode == 404) + { + _logger.LogWarning("[CAPTURE UNROUTED] {Method} {Url} -> 404 | Body {Body}", + context.Request.Method, context.Request.GetDisplayUrl(), body); + } + else if (SocialKeywords.Any(k => haystack.Contains(k))) + { + _logger.LogInformation("[CAPTURE SOCIAL] {Url} ({Status}) | Body {Body}", + context.Request.GetDisplayUrl(), context.Response.StatusCode, body); + } + } } private static async Task RequestAsync(HttpRequest request)