1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

made the graphs load faster

fixed issues with stats page
made the pages json request faster
This commit is contained in:
RaidMax
2017-10-04 18:01:04 -05:00
parent 9758e72f6b
commit d8b19f289a
11 changed files with 137 additions and 129 deletions

View File

@ -206,8 +206,6 @@ namespace IW4MAdmin
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
{
var info = new List<ServerInfo>();
int i = 0;
foreach (Server S in ApplicationManager.GetInstance().Servers)
{
ServerInfo eachServer = new ServerInfo()
@ -220,11 +218,9 @@ namespace IW4MAdmin
currentPlayers = S.GetPlayersAsList().Count,
chatHistory = S.ChatHistory,
players = new List<PlayerInfo>(),
ID = i
PlayerHistory = S.PlayerHistory.ToArray()
};
i++;
bool authed = ApplicationManager.GetInstance().GetPrivilegedClients()
.Where(x => x.IP == querySet["IP"])
.Where(x => x.Level > Player.Permission.Trusted).Count() > 0
@ -253,7 +249,7 @@ namespace IW4MAdmin
return resp;
}
public string GetContentType()
public string GetContentType()
{
return "application/json";
}
@ -701,26 +697,18 @@ namespace IW4MAdmin
public HttpResponse GetPage(System.Collections.Specialized.NameValueCollection querySet, IDictionary<string, string> headers)
{
List<PageInfo> pages = new List<PageInfo>();
foreach (var p in SharedLibrary.WebService.PageList.Where(x => x.Visible()))
var pages = SharedLibrary.WebService.PageList.Select(p => new
{
if (p == this)
continue;
PageInfo pi = new PageInfo()
{
pagePath = p.GetPath(),
pageName = p.GetName(),
visible = p.Visible()
};
pages.Add(pi);
}
pagePath = p.GetPath(),
pageName = p.GetName(),
visible = p.Visible(),
});
HttpResponse resp = new HttpResponse()
{
contentType = GetContentType(),
content = Newtonsoft.Json.JsonConvert.SerializeObject(pages),
content = Newtonsoft.Json.JsonConvert.SerializeObject(pages.ToArray()),
additionalHeaders = new Dictionary<string, string>()
};
return resp;
@ -846,6 +834,7 @@ namespace IW4MAdmin
public int maxPlayers;
public List<Chat> chatHistory;
public List<PlayerInfo> players;
public SharedLibrary.Helpers.PlayerHistory[] PlayerHistory;
public int ID;
}