Settings, which held only the theme, now belong to the persona too: - its profile (update_credentials, a new PATCH in IHttpService): pictures, name, biography and fields as written, locked, bot, discoverable, indexable, and how its posts start (visibility, language, sensitive media, who may quote them); the composer starts at that visibility; - the root's personas, each used in turn, and a new one made; - the accounts it muted or blocked and the servers it blocked, each undone there, a server blocked from a pasted address or handle; - its follows, lists, blocks, mutes, blocked servers and bookmarks exported and imported as the CSV files Mastodon writes (PortabilityService): an import resolves each row through PrivaPub, one at a time, and can stop. Administration opens to moderators: reports, resolved there; and for administrators the servers blocked for everyone and the federation statistics (traffic by server, delivery success and latency, the crawler). The Direct tab pages conversations, badges the unread ones, and a card marks one read or takes it off the list; opening one reads it. A remote thread is read again 4 and 15 seconds after it opens, since PrivaPub then fetches the replies its servers hold. A thread its community locked shows a lock instead of a reply button, reactions stay visible below a content warning, and a searched handle opens its account's profile whatever else matched. The e2e tests cover each: the profile saved and read back, a persona made, servers blocked and imported, follows exported, an instance block and the statistics as the pasture's admin, a conversation read and removed, and a reply only Mastodon held appearing in its thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
81 lines
3.1 KiB
C#
81 lines
3.1 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.Helpers;
|
|
using decePubClient.Models;
|
|
using decePubClient.Services;
|
|
using Toolbelt.Blazor.Extensions.DependencyInjection;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
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.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.AddBlazoredLocalStorage(config =>
|
|
{
|
|
config.JsonSerializerOptions.WriteIndented = false;
|
|
config.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
|
config.JsonSerializerOptions.IgnoreReadOnlyProperties = true;
|
|
config.JsonSerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip;
|
|
config.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
|
config.JsonSerializerOptions.TypeInfoResolver = SUtility.DefaultSerializer.TypeInfoResolver;
|
|
})
|
|
.AddScoped<TokenAuthStateProvider>()
|
|
.AddScoped<AuthenticationStateProvider>(provider => provider.GetRequiredService<TokenAuthStateProvider>())
|
|
.AddScoped<RequestStats>()
|
|
.AddScoped<AuthService>()
|
|
.AddScoped<TimelineService>()
|
|
.AddScoped<StatusService>()
|
|
.AddScoped<AccountService>()
|
|
.AddScoped<PortabilityService>()
|
|
.AddScoped<AdminService>()
|
|
.AddScoped<ListService>()
|
|
.AddScoped<FilterService>()
|
|
.AddScoped<DiscoveryService>()
|
|
.AddScoped<StreamingService>()
|
|
.AddScoped<PublicNoticeService>()
|
|
.AddScoped<MediaService>()
|
|
.AddScoped<GroupService>()
|
|
.AddScoped<InstanceService>()
|
|
.AddScoped<ProvenanceService>()
|
|
.AddScoped<ILoggingService, LoggingService>()
|
|
.AddScoped<ToastService>()
|
|
.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(); |