23 lines
667 B
C#
23 lines
667 B
C#
using System.Text.Json;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Moonlight.Shared.Http.Requests.Admin.Sys;
|
|
|
|
namespace Moonlight.ApiServer.Http.Controllers.Admin.Sys;
|
|
|
|
[ApiController]
|
|
[Route("api/admin/system/theme")]
|
|
public class ThemeController : Controller
|
|
{
|
|
[HttpPatch]
|
|
[Authorize(Policy = "permissions:admin.system.theme.update")]
|
|
public async Task Patch([FromBody] UpdateThemeRequest request)
|
|
{
|
|
var themePath = Path.Combine("storage", "theme.json");
|
|
|
|
await System.IO.File.WriteAllTextAsync(
|
|
themePath,
|
|
JsonSerializer.Serialize(request.Variables)
|
|
);
|
|
}
|
|
} |