@* No : it is an inline script, and the content security policy allows none (no JS modules yet). *@ @code { [CascadingParameter] private HttpContext HttpContext { get; set; } = default!; private IReadOnlyDictionary RootAttributes { get; set; } = new Dictionary(); // The sign-in pages are static server-rendered forms (they set the cookie); everything else is interactive. private IComponentRenderMode? PageRenderMode => HttpContext.AcceptsInteractiveRouting() ? InteractiveServer : null; [Inject] private UserSettingsService Settings { get; set; } = default!; /// protected override async Task OnInitializedAsync() { // The theme of the signed-in user is written on the server, so the first paint already has the right colours; // before sign-in the system theme applies (data-theme="auto"). var actor = SessionCookie.ActorOf(HttpContext.User); var preferences = actor is null ? null : await Settings.GetPreferencesAsync(actor, HttpContext.RequestAborted); RootAttributes = ThemeService.RootAttributes(preferences).ToDictionary(a => a.Key, a => (object)a.Value); } }