summary refs log tree commit diff
path: root/ModAS.Server/Controllers
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-12-23 12:07:34 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-12-23 12:07:34 +0100
commita847c172069c27fccd95fc593a1b0c630a620d4f (patch)
tree78fe3f1d20af02738421eb020cedd417b51b8305 /ModAS.Server/Controllers
parentBasic test (diff)
downloadModAS-a847c172069c27fccd95fc593a1b0c630a620d4f.tar.xz
Transactions test
Diffstat (limited to 'ModAS.Server/Controllers')
-rw-r--r--ModAS.Server/Controllers/DebugController.cs2
-rw-r--r--ModAS.Server/Controllers/TransactionsController.cs15
2 files changed, 16 insertions, 1 deletions
diff --git a/ModAS.Server/Controllers/DebugController.cs b/ModAS.Server/Controllers/DebugController.cs

index 39bff65..d3c7ad0 100644 --- a/ModAS.Server/Controllers/DebugController.cs +++ b/ModAS.Server/Controllers/DebugController.cs
@@ -40,7 +40,7 @@ public class DebugController(ModASConfiguration config, AuthenticatedHomeserverP await ahs.GetJoinedRooms(); } catch (MatrixException e) { - if(e is {ErrorCode: "M_FORBIDDEN"}) continue; + if (e is { ErrorCode: "M_FORBIDDEN" }) continue; throw; } diff --git a/ModAS.Server/Controllers/TransactionsController.cs b/ModAS.Server/Controllers/TransactionsController.cs new file mode 100644
index 0000000..8e4e018 --- /dev/null +++ b/ModAS.Server/Controllers/TransactionsController.cs
@@ -0,0 +1,15 @@ +using System.IO.Pipelines; +using Microsoft.AspNetCore.Mvc; +using ModAS.Server; + +namespace WebApplication1.Controllers; + +[ApiController] +public class TransactionsController(AppServiceRegistration asr) : ControllerBase { + [HttpPut(" /_matrix/app/v1/transactions/{txnId}")] + public async Task<IActionResult> PutTransactions(string txnId) { + if(!Request.Headers.ContainsKey("Authorization") || Request.Headers["Authorization"] != asr.HomeserverToken) return Unauthorized(); + await Request.Body.CopyToAsync(Console.OpenStandardOutput()); + return Ok(new{}); + } +} \ No newline at end of file