start work to allow custom accent colors

This commit is contained in:
RaidMax
2019-07-27 08:18:49 -05:00
parent ab4ce41015
commit 3b9b99a07e
20 changed files with 499 additions and 285 deletions

View File

@ -12,7 +12,7 @@ namespace WebfrontCore.Controllers
{
public IActionResult Edit()
{
if (Client.Level != SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
if (Client.Level < SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
{
return Unauthorized();
}
@ -23,7 +23,7 @@ namespace WebfrontCore.Controllers
[HttpPost]
public async Task<IActionResult> Edit(ApplicationConfiguration newConfiguration, bool addNewServer = false, bool shouldSave = false)
{
if (Client.Level != SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
if (Client.Level < SharedLibraryCore.Database.Models.EFClient.Permission.Owner)
{
return Unauthorized();
}

View File

@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WebfrontCore.Controllers
{
[Route("dynamic")]
public class DynamicFileController : BaseController
{
private static readonly IDictionary<string, string> _fileCache = new Dictionary<string, string>();
[Route("css/{fileName}")]
public async Task<IActionResult> Css(string fileName)
{
if (fileName.EndsWith(".css"))
{
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);
}
return Content(_fileCache[fileName], "text/css");
}
return StatusCode(400);
}
}
}