finish color code support (I think)

This commit is contained in:
RaidMax
2019-08-02 18:04:34 -05:00
parent dfecb99d07
commit bb42861a92
35 changed files with 990 additions and 70 deletions

View File

@ -25,7 +25,7 @@ namespace WebfrontCore.Controllers
try
{
var privilegedClient = await Manager.GetClientService().Get(clientId);
var privilegedClient = await Manager.GetClientService().GetClientForLogin(clientId);
bool loginSuccess = false;
#if DEBUG
loginSuccess = clientId == 1;

View File

@ -52,6 +52,7 @@ namespace WebfrontCore.Controllers
ViewBag.Version = Manager.Version;
ViewBag.IsFluid = false;
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
}
public override void OnActionExecuting(ActionExecutingContext context)
@ -113,6 +114,7 @@ namespace WebfrontCore.Controllers
ViewBag.Pages = Pages;
ViewBag.Localization = Utilities.CurrentLocalization.LocalizationIndex;
ViewBag.CustomBranding = Manager.GetApplicationSettings().Configuration().WebfrontCustomBranding ?? "IW4MAdmin";
ViewBag.EnableColorCodes = Manager.GetApplicationSettings().Configuration().EnableColorCodes;
base.OnActionExecuting(context);
}

View File

@ -90,12 +90,13 @@ namespace WebfrontCore.Controllers
clientDto.Meta.AddRange(Authorized ? meta : meta.Where(m => !m.Sensitive));
ViewBag.Title = clientDto.Name.Substring(clientDto.Name.Length - 1).ToLower()[0] == 's' ?
clientDto.Name + "'" :
clientDto.Name + "'s";
string strippedName = clientDto.Name.StripColors();
ViewBag.Title = strippedName.Substring(strippedName.Length - 1).ToLower()[0] == 's' ?
strippedName + "'" :
strippedName + "'s";
ViewBag.Title += " " + Localization["WEBFRONT_CLIENT_PROFILE_TITLE"];
ViewBag.Description = $"Client information for {clientDto.Name}";
ViewBag.Keywords = $"IW4MAdmin, client, profile, {clientDto.Name}";
ViewBag.Description = $"Client information for {strippedName}";
ViewBag.Keywords = $"IW4MAdmin, client, profile, {strippedName}";
return View("Profile/Index", clientDto);
}
@ -130,7 +131,6 @@ namespace WebfrontCore.Controllers
return View("Privileged/Index", adminsDict);
}
public async Task<IActionResult> FindAsync(string clientName)
{
if (string.IsNullOrWhiteSpace(clientName))

View File

@ -16,16 +16,18 @@ namespace WebfrontCore.Controllers
{
if (fileName.EndsWith(".css"))
{
#if DEBUG
string cssData = await System.IO.File.ReadAllTextAsync($"X:\\IW4MAdmin\\WebfrontCore\\wwwroot\\css\\{fileName}");
cssData = await Manager.MiddlewareActionHandler.Execute(cssData, "custom_css_accent");
return Content(cssData, "text/css");
#endif
if (!_fileCache.ContainsKey(fileName))
{
#if DEBUG
string path = $"X:\\IW4MAdmin\\WebfrontCore\\wwwroot\\css\\{fileName}";
#else
string path = $"wwwroot\\css\\{fileName}";
#endif
string cssData = await System.IO.File.ReadAllTextAsync(path);
cssData = await Manager.MiddlewareActionHandler.Execute(cssData, "custom_css_accent");
_fileCache.Add(fileName, cssData);
string data = await System.IO.File.ReadAllTextAsync(path);
data = await Manager.MiddlewareActionHandler.Execute(data, "custom_css_accent");
_fileCache.Add(fileName, data);
}
return Content(_fileCache[fileName], "text/css");