This repository has been archived on 2024-03-29. You can view files and clone it, but cannot push or open issues or pull requests.
FreeSR/FreeSR.Admin/Handlers/ExecuteCommandRequestHandler.cs
2024-01-27 21:06:07 +08:00

23 lines
654 B
C#

namespace FreeSR.Admin.Handlers
{
using Ceen;
using FreeSR.Admin.Command;
using FreeSR.Shared.Command;
internal class ExecuteCommandRequestHandler : IHttpModule
{
public async Task<bool> HandleAsync(IHttpContext context)
{
var query = context.Request.QueryString;
string command = query["command"];
var ctx = new AdminCommandContext();
CommandManager.Instance.Invoke(ctx, command);
context.Response.StatusCode = HttpStatusCode.OK;
await context.Response.WriteAllAsync(ctx.Message, "text/plain");
return true;
}
}
}