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

fix issue with duplicate js function names for loader

hide flagged status of users on webfront unless logged in (will still show the level if they report someone because cba to update the view component w/out auth status)
add terminal to the radar maps
This commit is contained in:
RaidMax
2019-07-24 10:36:37 -05:00
parent 21cda0123b
commit ba86810d4f
13 changed files with 126 additions and 24 deletions

View File

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static SharedLibraryCore.Database.Models.EFClient;
using static SharedLibraryCore.Database.Models.EFPenalty;
namespace WebfrontCore.Controllers
@ -25,11 +26,20 @@ namespace WebfrontCore.Controllers
var activePenalties = (await Manager.GetPenaltyService().GetActivePenaltiesAsync(client.AliasLinkId, client.IPAddress))
.Where(_penalty => _penalty.Type != PenaltyType.Flag);
int displayLevelInt = (int)client.Level;
string displayLevel = client.Level.ToLocalizedLevelName();
if (!Authorized && client.Level.ShouldHideLevel())
{
displayLevelInt = (int)Permission.User;
displayLevel = Permission.User.ToLocalizedLevelName();
}
var clientDto = new PlayerInfo()
{
Name = client.Name,
Level = client.Level.ToLocalizedLevelName(),
LevelInt = (int)client.Level,
Level = displayLevel,
LevelInt = displayLevelInt,
ClientId = client.ClientId,
IPAddress = client.IPAddressString,
NetworkId = client.NetworkId,
@ -129,6 +139,15 @@ namespace WebfrontCore.Controllers
}
var clientsDto = await Manager.GetClientService().FindClientsByIdentifier(clientName);
foreach(var client in clientsDto)
{
if (!Authorized && ((Permission)Enum.Parse(typeof(Permission), client.Level)).ShouldHideLevel())
{
client.LevelInt = (int)Permission.User;
client.Level = Permission.User.ToLocalizedLevelName();
}
}
ViewBag.Title = $"{clientsDto.Count} {Localization["WEBFRONT_CLIENT_SEARCH_MATCHING"]} \"{clientName}\"";
return View("Find/Index", clientsDto);

View File

@ -1,17 +1,28 @@
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore.Dtos;
using System.Linq;
using System.Threading.Tasks;
namespace WebfrontCore.Controllers
{
public class HomeController : BaseController
{
public IActionResult Index()
public async Task<IActionResult> Index()
{
ViewBag.Description = "IW4MAdmin is a complete server administration tool for IW4x.";
ViewBag.Title = Localization["WEBFRONT_HOME_TITLE"];
ViewBag.Keywords = "IW4MAdmin, server, administration, IW4x, MW2, Modern Warfare 2";
return View();
var model = new IW4MAdminInfo()
{
TotalAvailableClientSlots = Manager.GetServers().Sum(_server => _server.MaxClients),
TotalOccupiedClientSlots = Manager.GetActiveClients().Count,
TotalClientCount = await Manager.GetClientService().GetTotalClientsAsync(),
RecentClientCount = await Manager.GetClientService().GetRecentClientCount()
};
return View(model);
}
public IActionResult Error()

View File

@ -45,7 +45,6 @@ namespace WebfrontCore.Controllers
using (var ctx = new DatabaseContext(disableTracking: true))
{
// todo: this seems like it's pulling unnecessary info from LINQ to entities.
var iqPenalties = ctx.Penalties
.AsNoTracking()
.Where(p => p.Type == PenaltyType.Ban && p.Active)