start work to allow custom accent colors
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
37
WebfrontCore/Controllers/DynamicFileController.cs
Normal file
37
WebfrontCore/Controllers/DynamicFileController.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user