summary refs log tree commit diff
path: root/MxApiExtensions/Controllers/Extensions
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-11-09 07:36:02 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-11-09 07:36:02 +0100
commit2e8aa30daa4a33fa33622bccb344dfc24483e320 (patch)
treeee08ce4e83382b81a1fbabaac85c763971408bbe /MxApiExtensions/Controllers/Extensions
parentFix some null checks (diff)
downloadMxApiExtensions-2e8aa30daa4a33fa33622bccb344dfc24483e320.tar.xz
Fix sync
Diffstat (limited to 'MxApiExtensions/Controllers/Extensions')
-rw-r--r--MxApiExtensions/Controllers/Extensions/DebugController.cs23
1 files changed, 7 insertions, 16 deletions
diff --git a/MxApiExtensions/Controllers/Extensions/DebugController.cs b/MxApiExtensions/Controllers/Extensions/DebugController.cs

index c65df56..ae9ecc5 100644 --- a/MxApiExtensions/Controllers/Extensions/DebugController.cs +++ b/MxApiExtensions/Controllers/Extensions/DebugController.cs
@@ -7,24 +7,17 @@ namespace MxApiExtensions.Controllers.Extensions; [ApiController] [Route("/")] -public class DebugController : ControllerBase { - private readonly ILogger _logger; - private readonly MxApiExtensionsConfiguration _config; - private readonly AuthenticationService _authenticationService; +public class DebugController(ILogger<ProxyConfigurationController> logger, MxApiExtensionsConfiguration config, UserContextService userContextService) + : ControllerBase { + private readonly ILogger _logger = logger; private static ConcurrentDictionary<string, RoomInfoEntry> _roomInfoCache = new(); - public DebugController(ILogger<ProxyConfigurationController> logger, MxApiExtensionsConfiguration config, AuthenticationService authenticationService, - AuthenticatedHomeserverProviderService authenticatedHomeserverProviderService) { - _logger = logger; - _config = config; - _authenticationService = authenticationService; - } - [HttpGet("debug")] public async Task<object?> GetDebug() { - var mxid = await _authenticationService.GetMxidFromToken(); - if(!_config.Admins.Contains(mxid)) { + var user = await userContextService.GetCurrentUserContext(); + var mxid = user.Homeserver.UserId; + if(!config.Admins.Contains(mxid)) { _logger.LogWarning("Got debug request for {user}, but they are not an admin", mxid); Response.StatusCode = StatusCodes.Status403Forbidden; Response.ContentType = "application/json"; @@ -38,8 +31,6 @@ public class DebugController : ControllerBase { } _logger.LogInformation("Got debug request for {user}", mxid); - return new { - SyncStates = SyncController.SyncStates - }; + return UserContextService.UserContextStore; } }