1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 23:31:13 -05:00

fixed misc issues and added stats page to webfront

This commit is contained in:
RaidMax
2017-10-03 18:17:35 -05:00
parent 4cddefd542
commit 9758e72f6b
26 changed files with 677 additions and 69 deletions

View File

@ -50,21 +50,27 @@ namespace IW4MAdmin
{
SharedLibrary.HttpResponse requestedPage = WebService.GetPage(request.Path, querySet, request.Headers);
bool binaryContent = requestedPage.BinaryContent != null;
if (requestedPage.content != null && requestedPage.content.GetType() != typeof(string))
requestedPage.content = Newtonsoft.Json.JsonConvert.SerializeObject(requestedPage.content);
var headers = new HttpResponseHead()
{
Status = "200 OK",
Headers = new Dictionary<string, string>()
{
{ "Content-Type", requestedPage.contentType },
{ "Content-Length", requestedPage.content.Length.ToString() },
{ "Content-Length", binaryContent ? requestedPage.BinaryContent.Length.ToString() : requestedPage.content.ToString().Length.ToString() },
{ "Access-Control-Allow-Origin", "*" },
}
};
foreach (var key in requestedPage.additionalHeaders.Keys)
headers.Headers.Add(key, requestedPage.additionalHeaders[key]);
response.OnResponse(headers, new BufferedProducer(requestedPage.content));
if (!binaryContent)
response.OnResponse(headers, new BufferedProducer((string)requestedPage.content));
else
response.OnResponse(headers, new BufferedProducer(requestedPage.BinaryContent));
}
catch (Exception e)