From: miniduikboot Date: Sun, 26 Jan 2025 17:00:03 +0000 (+0100) Subject: Add diagnostic http message (#663) X-Git-Tag: v1.10.3~12 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=495dc019489b14b80807b85f678c5e4ef8a66f6a;p=rhonda%2Fimpostor.git Add diagnostic http message (#663) * Add diagnostic message to test HTTP server This makes it possible to diagnose if the reverse proxy setup is working correctly or if the game configuration is wrong * Print console log as well Only print it once to prevent console spam * Update src/Impostor.Server/Http/HelloController.cs Co-authored-by: js6pak --------- Co-authored-by: js6pak --- diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index 8e974ae..ed257e7 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -47,6 +47,12 @@ Also check if the port Impostor (ListenPort) is listening on is correctly port-f Please check that you only have **working** plugins in the `plugins` folder. This error can be caused by non-plugin files or plugins that are not working correctly. +## Disconnected with `You disconnected from the server. If this happens often, check your network strength. This may also be a server issue` + +Usually this means that Among Us couldn't connect to Impostor's HTTP server. + +Open the address of your server in a web browser, it should show you a small page confirming that Impostor is available. + ## My question is not yet answered and I'm still having problems! That's unfortunate. Join the [Impostor Discord](https://discord.gg/Mk3w6Tb), ask your question there and we'll try to help you out. Note that we're not always available, so it may take some time to get an answer. To make answering your question easier, please add the following details: diff --git a/src/Impostor.Server/Http/HelloController.cs b/src/Impostor.Server/Http/HelloController.cs new file mode 100644 index 0000000..56f94d8 --- /dev/null +++ b/src/Impostor.Server/Http/HelloController.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace Impostor.Server.Http; + +/// +/// Generate a diagnostic page to show that the Impostor HTTP server is working. +/// +[Route("/")] +public sealed class HelloController : ControllerBase +{ + private static bool _shownHello = false; + private readonly ILogger _logger; + + public HelloController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IActionResult GetHello() + { + if (!_shownHello) + { + _shownHello = true; + _logger.LogInformation("Impostor's Http server is reachable (this message is only printed once per start)"); + } + + return Ok( + """ + Impostor is running, please configure your Among Us to connect to a game + To generate a region file, go to https://impostor.github.io/Impostor + """ + ); + } +}