vpn check updates, fixed some issues,

"masked" status is now sensitive
discord link in webfront if configured
This commit is contained in:
RaidMax
2018-03-13 16:30:22 -05:00
parent 5c0aa7d14f
commit e974de8e63
27 changed files with 235 additions and 119 deletions

View File

@ -21,6 +21,8 @@ namespace WebfrontCore.Controllers
Authorized = context.HttpContext.Connection.RemoteIpAddress.ToString() == "127.0.0.1" ||
Manager.AdministratorIPs.Contains(context.HttpContext.Connection.RemoteIpAddress.ToString().ConvertToIP());
ViewBag.Authorized = Authorized;
ViewBag.Url = Startup.Configuration["Web:Address"];
ViewBag.DiscordLink = Startup.Configuration["Discord:InviteLink"];
base.OnActionExecuting(context);
}
}

View File

@ -50,7 +50,7 @@ namespace WebfrontCore.Controllers
{
Key = "Masked",
Value = client.Masked ? "Is" : "Is not",
Sensitive = false,
Sensitive = true,
When = DateTime.MinValue
});
@ -61,7 +61,12 @@ namespace WebfrontCore.Controllers
.OrderByDescending(m => m.When)
.ToList();
ViewBag.Title = clientDto.Name;
ViewBag.Title = clientDto.Name.Substring(clientDto.Name.Length - 1).ToLower()[0] == 's' ?
clientDto.Name + "'" :
clientDto.Name + "'s";
ViewBag.Title += " Profile";
ViewBag.Description = $"Client information for {clientDto.Name}";
ViewBag.Keywords = $"IW4MAdmin, client, profile, {clientDto.Name}";
return View("Profile/Index", clientDto);
}
@ -84,7 +89,10 @@ namespace WebfrontCore.Controllers
});
}
ViewBag.Title = "Current Privileged Users";
ViewBag.Title = "Privileged Clients";
ViewBag.Description = "List of all privileged clients on IW4MAdmin";
ViewBag.Keywords = "IW4MAdmin, privileged, admins, clients, administrators";
return View("Privileged/Index", adminsDict);
}
@ -102,7 +110,7 @@ namespace WebfrontCore.Controllers
})
.ToList();
ViewBag.Name = $"Clients Matching \"{clientName}\"";
ViewBag.Title = $"Clients Matching \"{clientName}\"";
return View("Find/Index", clientsDto);
}
}

View File

@ -19,7 +19,10 @@ namespace WebfrontCore.Controllers
ID = s.GetHashCode(),
});
ViewBag.Description = "Use the IW4MAdmin web console to execute commands";
ViewBag.Title = "Web Console";
ViewBag.Keywords = "IW4MAdmin, console, execute, commands";
return View(activeServers);
}

View File

@ -12,14 +12,18 @@ namespace WebfrontCore.Controllers
{
public IActionResult Index()
{
ViewBag.Description = "IW4MAdmin is a complete server administration tool for IW4x.";
ViewBag.Title = "Server Overview";
ViewBag.Keywords = "IW4MAdmin, server, administration, IW4x, MW2, Modern Warfare 2";
return View();
}
public IActionResult Error()
{
// return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
return null;
ViewBag.Description = "IW4MAdmin encountered and error";
ViewBag.Title = "Error!";
return View();
}
}
}

View File

@ -1,6 +1,8 @@
using Microsoft.AspNetCore.Mvc;
using SharedLibrary;
using SharedLibrary.Database.Models;
using SharedLibrary.Dtos;
using SharedLibrary.Services;
using System;
using System.Collections.Generic;
using System.Linq;
@ -13,7 +15,10 @@ namespace WebfrontCore.Controllers
{
public IActionResult List()
{
ViewBag.Title = "Penalty List";
ViewBag.Description = "List of all the recent penalties (bans, kicks, warnings) on IW4MAdmin";
ViewBag.Title = "Client Penalties";
ViewBag.Keywords = "IW4MAdmin, penalties, ban, kick, warns";
return View();
}
@ -21,5 +26,23 @@ namespace WebfrontCore.Controllers
{
return View("_List", offset);
}
public async Task<IActionResult> PublicAsync()
{
var penalties = await (new GenericRepository<EFPenalty>())
.FindAsync(p => p.Type == SharedLibrary.Objects.Penalty.PenaltyType.Ban && p.Active);
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
{
OffenderId = p.OffenderId,
Offense = p.Offense,
PunisherId = p.PunisherId,
Type = p.Type.ToString(),
TimePunished = p.When.ToString(),
TimeRemaining = p.Expires.ToString()
}).ToList();
return Json(penaltiesDto);
}
}
}