Adds comments.

This commit is contained in:
BinaryAlley committed 2026-08-20 23:38:50 -07:00
1 parent 4ef8570854
commit fd64cbd6ba
13 files changed
+17

No files matched your search

@@ -49,6 +49,7 @@ public sealed class RazorViewToStringRenderer
/// <returns>The rendered HTML of the partial.</returns>
public async Task<string> RenderPartialAsync(string partialName, CancellationToken cancellationToken = default)
{
// the theme shell reuses the application's Razor chrome as strings, so the same markup stays in one place
HttpContext httpContext = _httpContextAccessor.HttpContext ?? throw new InvalidOperationException("The current HTTP context is unavailable.");
ActionContext actionContext = new(httpContext, httpContext.GetRouteData() ?? new RouteData(), new ActionDescriptor());
IView view = _viewEngine.FindView(actionContext, partialName, isMainPage: false).View
@@ -60,6 +60,8 @@ public sealed class ThemeNavBuilder
string returnUrl = Uri.EscapeDataString(GetCurrentRequestUrl());
ThemeNavEntryDto[] languages = CreateLanguageEntries(returnUrl);
// the mobile and desktop menus arrange the same sections differently, notably the language switcher, which is
// its own mobile heading but a submenu under Tools on the desktop, so each menu gets its own section list
List<ThemeNavSectionDto> mobileSections = [];
mobileSections.Add(CreateSiteSection());
mobileSections.Add(CreateAccountSection(isAuthenticated));
@@ -17,6 +17,7 @@ public static class ThemePageDataFactory
/// <returns>The localized strings keyed by their resource names.</returns>
public static Dictionary<string, object?> CreateLocalizedStrings(IStringLocalizer localizer)
{
// expose the page's full resource set, so templates can pull any localized string without the page enumerating keys
Dictionary<string, object?> strings = [];
foreach (LocalizedString localizedString in localizer.GetAllStrings(includeParentCultures: true))
strings[localizedString.Name] = localizedString.Value;
@@ -40,6 +40,7 @@ public class ThemePageRenderer
model.ThemeId = document.Theme.Id;
model.AssetBase = $"/theme-assets/{document.Theme.Id}/assets";
// a fresh script id per render lets the AJAX navigator unload this view's script when navigating away
model.ScriptId = ScriptIdentifierHelper.GenerateScriptId();
return _templateEngine.RenderPage(document.Template, model);
@@ -18,6 +18,7 @@ namespace Lumina.Presentation.Web.Core.Themes;
/// </summary>
public sealed class ThemeTemplateEngine
{
// bound template nesting and rendered output, so a single theme cannot exhaust the server memory
private const int MAX_NESTING_DEPTH = 32;
private const int MAX_RENDERED_CHARACTERS = 4 * 1024 * 1024;