IW4M-Admin/WebfrontCore/Controllers/HomeController.cs
RaidMax 9665d2d457 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
2019-07-24 10:36:37 -05:00

41 lines
1.6 KiB
C#

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 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";
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()
{
var exceptionFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
Manager.GetLogger(0).WriteError($"[Webfront] {exceptionFeature.Error.Message}");
Manager.GetLogger(0).WriteDebug(exceptionFeature.Path);
Manager.GetLogger(0).WriteDebug(exceptionFeature.Error.StackTrace);
ViewBag.Description = Localization["WEBFRONT_ERROR_DESC"];
ViewBag.Title = Localization["WEBFRONT_ERROR_TITLE"];
return View();
}
}
}