The project referenced ../SocialPub/SocialPub/SocialPub.ClientModels, a path that has not existed since the server became PrivaPub; it references ../SocialPub/PrivaPub.ClientModels now, and CI clones SocialPub beside it. Retargeted to net10.0 with the Microsoft packages at 10.0.9. BlazorDownloadFileFast moves to 1.0.0.1 because 0.2.0 used IJSUnmarshalledRuntime, which .NET 9 removed. The Visual Studio bundler and web compiler packages are gone; the bundle they produced, css/style.min.css, is committed and stays the stylesheet, and its stale .gz is deleted because .NET's static-asset compression writes that path itself. AppConfiguration.ApiBaseAddress (https://privapub.thepra.dev) is the API client's base address; the template's placeholder OIDC section and the Toolbelt.Blazor.HotKeys script tag, whose package is not referenced, are removed. The vhost sends noindex while the feed shows the prototype's mock posts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
69 lines
2.9 KiB
C#
69 lines
2.9 KiB
C#
using decePubClient;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
using System.Net.Http.Headers;
|
|
using System.Text.Json;
|
|
using Blazored.LocalStorage;
|
|
using decePubClient.Extensions;
|
|
using decePubClient.Models;
|
|
using decePubClient.Services;
|
|
using Toolbelt.Blazor.Extensions.DependencyInjection;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
using Microsoft.Extensions.Options;
|
|
using PrivaPub.ClientModels;
|
|
using collAnon.Client.Services;
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
builder.RootComponents.Add<App>("#app");
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
|
|
builder.Services.AddBlazorDownloadFile();
|
|
builder.Services.AddApiAuthorization();
|
|
builder.Services.AddOptions()
|
|
.AddAuthorizationCore(options =>
|
|
{
|
|
options.AddPolicy(Policies.IsAdmin, ExtensionMethods.IsAdminPolicy());
|
|
options.AddPolicy(Policies.IsUser, ExtensionMethods.IsUserPolicy());
|
|
options.AddPolicy(Policies.IsModerator, ExtensionMethods.IsUserModeratorPolicy());
|
|
})
|
|
.AddTransient<AppStatusService>();
|
|
builder.Services.TryAddEnumerable(
|
|
ServiceDescriptor.Singleton<IPostConfigureOptions<RemoteAuthenticationOptions<ApiAuthorizationProviderOptions>>,
|
|
ApiAuthorizationOptionsConfiguration>());
|
|
builder.Services.AddBlazoredLocalStorage(config =>
|
|
{
|
|
config.JsonSerializerOptions.WriteIndented = false;
|
|
config.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
|
config.JsonSerializerOptions.IgnoreReadOnlyProperties = true;
|
|
config.JsonSerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip;
|
|
config.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
|
})
|
|
.AddScoped<TokenAuthStateProvider>()
|
|
.AddScoped<MessagesService>()
|
|
.AddScoped<AuthenticationStateProvider>(provider => provider.GetRequiredService<TokenAuthStateProvider>())
|
|
.AddSingleton(typeof(CoalescingStringLocalizer))
|
|
//.AddTransient<IHttpService, HttpService>()
|
|
.AddHeadElementHelper(options => options.DisableClientScriptAutoInjection = true)
|
|
.AddLocalization()
|
|
.AddTransient<IStorage, Storage>()
|
|
.AddLogging(lb => lb.SetMinimumLevel(LogLevel.Debug))
|
|
.AddIndexedDb();
|
|
|
|
var apiBaseAddress = builder.Configuration["AppConfiguration:ApiBaseAddress"];
|
|
builder.Services.AddHttpClient("default", client =>
|
|
{
|
|
client.BaseAddress = new Uri(string.IsNullOrEmpty(apiBaseAddress) ? builder.HostEnvironment.BaseAddress : apiBaseAddress.TrimEnd('/') + "/");
|
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
});
|
|
|
|
builder.Services.AddSingleton(serviceProvider =>
|
|
{
|
|
var conf = serviceProvider.GetRequiredService<IConfiguration>();
|
|
return conf.GetSection(nameof(AppConfiguration)).Get<AppConfiguration>();
|
|
});
|
|
|
|
var host = builder.Build();
|
|
await host.SetDefaultCulture();
|
|
await host.RunAsync(); |