mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 07:13:58 -05:00
update stats
change server id fIx change log server complaining when empty read
This commit is contained in:
@ -25,7 +25,7 @@ namespace WebfrontCore.Controllers.API
|
||||
var serverInfo = Manager.GetServers()
|
||||
.Select(server => new
|
||||
{
|
||||
Id = server.GetHashCode(),
|
||||
Id = server.EndPoint,
|
||||
Name = server.Hostname,
|
||||
MaxPlayers = server.MaxClients,
|
||||
CurrentPlayers = server.GetClientsAsList().Count,
|
||||
|
@ -79,7 +79,7 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
return await Task.FromResult(RedirectToAction("ExecuteAsync", "Console", new
|
||||
{
|
||||
serverId = server.GetHashCode(),
|
||||
serverId = server.EndPoint,
|
||||
command
|
||||
}));
|
||||
}
|
||||
@ -110,7 +110,7 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
return await Task.FromResult(RedirectToAction("ExecuteAsync", "Console", new
|
||||
{
|
||||
serverId = server.GetHashCode(),
|
||||
serverId = server.EndPoint,
|
||||
command = $"!unban @{targetId} {Reason}"
|
||||
}));
|
||||
}
|
||||
@ -162,7 +162,7 @@ namespace WebfrontCore.Controllers
|
||||
Values = Enum.GetValues(typeof(Permission)).OfType<Permission>()
|
||||
.Where(p => p <= Client.Level)
|
||||
.Where(p => p != Permission.Banned)
|
||||
.Where(p => p != Permission.Flagged)
|
||||
.Where(p => p != Permission.Flagged)
|
||||
.ToDictionary(p => p.ToString(), p=> p.ToLocalizedLevelName())
|
||||
},
|
||||
},
|
||||
@ -178,7 +178,7 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
return await Task.FromResult(RedirectToAction("ExecuteAsync", "Console", new
|
||||
{
|
||||
serverId = server.GetHashCode(),
|
||||
serverId = server.EndPoint,
|
||||
command = $"!setlevel @{targetId} {level}"
|
||||
}));
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -17,7 +15,7 @@ namespace WebfrontCore.Controllers
|
||||
var activeServers = Manager.GetServers().Select(s => new ServerInfo()
|
||||
{
|
||||
Name = s.Hostname,
|
||||
ID = s.GetHashCode(),
|
||||
ID = s.EndPoint,
|
||||
});
|
||||
|
||||
ViewBag.Description = "Use the IW4MAdmin web console to execute commands";
|
||||
@ -27,9 +25,10 @@ namespace WebfrontCore.Controllers
|
||||
return View(activeServers);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> ExecuteAsync(int serverId, string command)
|
||||
public async Task<IActionResult> ExecuteAsync(long serverId, string command)
|
||||
{
|
||||
var server = Manager.GetServers().First(s => s.GetHashCode() == serverId);
|
||||
var server = Manager.GetServers().First(s => s.EndPoint == serverId);
|
||||
|
||||
var client = new EFClient()
|
||||
{
|
||||
ClientId = Client.ClientId,
|
||||
|
@ -1,10 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
@ -12,16 +9,19 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
[HttpGet]
|
||||
[ResponseCache(NoStore = true, Duration = 0)]
|
||||
public IActionResult ClientActivity(int id)
|
||||
public IActionResult ClientActivity(long id)
|
||||
{
|
||||
var s = Manager.GetServers().FirstOrDefault(s2 => s2.GetHashCode() == id);
|
||||
var s = Manager.GetServers().FirstOrDefault(s2 => s2.EndPoint == id);
|
||||
|
||||
if (s == null)
|
||||
{
|
||||
return View("Error", "Invalid server!");
|
||||
}
|
||||
|
||||
var serverInfo = new ServerInfo()
|
||||
{
|
||||
Name = s.Hostname,
|
||||
ID = s.GetHashCode(),
|
||||
ID = s.EndPoint,
|
||||
Port = s.GetPort(),
|
||||
Map = s.CurrentMap.Alias,
|
||||
ClientCount = s.ClientNum,
|
||||
|
Reference in New Issue
Block a user