using System.Globalization; using Blazored.LocalStorage; using Iceshrimp.Frontend; using Iceshrimp.Frontend.Core.InMemoryLogger; using Iceshrimp.Frontend.Core.Miscellaneous; using Iceshrimp.Frontend.Core.Services; using Ljbc1994.Blazor.IntersectionObserver; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); builder.Services.AddSingleton(_ => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Services.AddLocalization(); builder.Logging.AddInMemoryLogger(builder.Configuration); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddIntersectionObserver(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddAuthorizationCore(); builder.Services.AddCascadingAuthenticationState(); builder.Services.AddBlazoredLocalStorageAsSingleton(); // Culture information (locale) has to be set before run. var host = builder.Build(); var helper = new LocaleHelper(host.Services.GetRequiredService()); var culture = helper.LoadCulture(); CultureInfo.DefaultThreadCurrentCulture = culture; CultureInfo.DefaultThreadCurrentUICulture = culture; var logger = host.Services.GetRequiredService() .CreateLogger(); logger.LogInformation("Starting Iceshrimp.Frontend"); await host.RunAsync();