using Microsoft.AspNetCore.Mvc; namespace PowderCoating.Web.Controllers; /// /// Sets the surface theme preference cookie server-side so it survives page navigation reliably. /// Client-side document.cookie writes can silently fail on some browser/HTTPS configurations. /// public class ThemeController : Controller { [HttpPost] [IgnoreAntiforgeryToken] public IActionResult Set([FromForm] string surface) { var value = surface == "ink" ? "ink" : "paper"; Response.Cookies.Append("pcl_surface", value, new CookieOptions { Path = "/", MaxAge = TimeSpan.FromDays(365), SameSite = SameSiteMode.Lax, HttpOnly = false }); return Ok(); } }