PrivaPub's own types are read through the shared ClientModels context, and a type without generated metadata no longer falls back to reflection silently: it fails at once in development and on the pasture, and is reported on the console elsewhere. Startup outside production checks that every PrivaPub and Mastodon type the client knows has its metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
This commit is contained in:
1 parent
3bc511421e
commit
dca046e27d
6 files changed
+70
-105
No files matched your search
+3
-97
@@ -2,20 +2,13 @@
|
||||
|
||||
using decePubClient.Models;
|
||||
|
||||
using PrivaPub.ClientModels;
|
||||
using PrivaPub.ClientModels.Admin;
|
||||
using PrivaPub.ClientModels.Group;
|
||||
using PrivaPub.ClientModels.Post;
|
||||
using PrivaPub.ClientModels.User;
|
||||
using PrivaPub.ClientModels.User.Avatar;
|
||||
|
||||
namespace decePubClient;
|
||||
|
||||
/// <summary>
|
||||
/// Source-generated JSON metadata for the client's own types, used first by SUtility.DefaultSerializer (HTTP) and by
|
||||
/// Blazored.LocalStorage (Program.cs). Register every type that crosses HTTP or is stored in localStorage here; types
|
||||
/// missing from it still work through the reflection fallback. Names stay camelCase: wwwroot/js/theme.js reads
|
||||
/// PublicCacheData.pageSettings straight from localStorage.
|
||||
/// Blazored.LocalStorage (Program.cs); PrivaPub.ClientModels' types come from ClientModelsJsonContext. A type missing
|
||||
/// from both fails in Development and the pasture, and is reported on the console elsewhere. Names stay camelCase:
|
||||
/// wwwroot/js/theme.js reads PublicCacheData.pageSettings straight from localStorage.
|
||||
/// </summary>
|
||||
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
IgnoreReadOnlyProperties = true)]
|
||||
@@ -30,96 +23,9 @@ namespace decePubClient;
|
||||
[JsonSerializable(typeof(PushDevice))]
|
||||
[JsonSerializable(typeof(UploadMedia))]
|
||||
[JsonSerializable(typeof(ValidationErrors))]
|
||||
[JsonSerializable(typeof(WebResult))]
|
||||
[JsonSerializable(typeof(LoginForm))]
|
||||
[JsonSerializable(typeof(SetupForm))]
|
||||
[JsonSerializable(typeof(InvitationLoginForm))]
|
||||
[JsonSerializable(typeof(ViewServerSetup))]
|
||||
[JsonSerializable(typeof(UserPasswordForm))]
|
||||
[JsonSerializable(typeof(RemoveSelfForm))]
|
||||
[JsonSerializable(typeof(PasswordRecoveryForm))]
|
||||
[JsonSerializable(typeof(NewPasswordForm))]
|
||||
[JsonSerializable(typeof(ViewAccount))]
|
||||
[JsonSerializable(typeof(EmailChangeForm))]
|
||||
[JsonSerializable(typeof(EmailCodeForm))]
|
||||
[JsonSerializable(typeof(PasswordForm))]
|
||||
[JsonSerializable(typeof(TotpCodeForm))]
|
||||
[JsonSerializable(typeof(TotpDisableForm))]
|
||||
[JsonSerializable(typeof(ViewTotpSetup))]
|
||||
[JsonSerializable(typeof(ViewTotpEnabled))]
|
||||
[JsonSerializable(typeof(ViewUserSettings))]
|
||||
// recover/valid takes the code as a JSON string ([FromBody] string) and answers a JSON bool
|
||||
[JsonSerializable(typeof(string))]
|
||||
[JsonSerializable(typeof(bool))]
|
||||
[JsonSerializable(typeof(JwtUser))]
|
||||
[JsonSerializable(typeof(ViewAvatar))]
|
||||
[JsonSerializable(typeof(List<ViewAvatar>))]
|
||||
[JsonSerializable(typeof(InsertAvatarForm))]
|
||||
[JsonSerializable(typeof(ViewPersonaPreferences))]
|
||||
[JsonSerializable(typeof(PersonaPreferencesForm))]
|
||||
[JsonSerializable(typeof(ViewGroup))]
|
||||
[JsonSerializable(typeof(List<ViewGroup>))]
|
||||
[JsonSerializable(typeof(ViewGroupMember))]
|
||||
[JsonSerializable(typeof(List<ViewGroupMember>))]
|
||||
[JsonSerializable(typeof(InsertGroupForm))]
|
||||
[JsonSerializable(typeof(UpdateGroupForm))]
|
||||
[JsonSerializable(typeof(JoinGroupForm))]
|
||||
[JsonSerializable(typeof(GroupMembershipForm))]
|
||||
[JsonSerializable(typeof(ViewPost))]
|
||||
[JsonSerializable(typeof(List<ViewPost>))]
|
||||
[JsonSerializable(typeof(InsertPostForm))]
|
||||
[JsonSerializable(typeof(DeletePostForm))]
|
||||
[JsonSerializable(typeof(ViewReport))]
|
||||
[JsonSerializable(typeof(List<ViewReport>))]
|
||||
[JsonSerializable(typeof(DomainBlockForm))]
|
||||
[JsonSerializable(typeof(ViewDomainBlock))]
|
||||
[JsonSerializable(typeof(List<ViewDomainBlock>))]
|
||||
[JsonSerializable(typeof(ViewStatisticsOverview))]
|
||||
[JsonSerializable(typeof(ViewHostsPage))]
|
||||
[JsonSerializable(typeof(ViewCrawler))]
|
||||
[JsonSerializable(typeof(ViewHostDetail))]
|
||||
[JsonSerializable(typeof(ViewHostInstance))]
|
||||
[JsonSerializable(typeof(ViewHostDay))]
|
||||
[JsonSerializable(typeof(ViewInteractionEvent))]
|
||||
[JsonSerializable(typeof(List<ViewInteractionEvent>))]
|
||||
[JsonSerializable(typeof(ViewServerDay))]
|
||||
[JsonSerializable(typeof(List<ViewServerDay>))]
|
||||
[JsonSerializable(typeof(ViewBackups))]
|
||||
[JsonSerializable(typeof(ViewBackup))]
|
||||
[JsonSerializable(typeof(BackupPasswordForm))]
|
||||
[JsonSerializable(typeof(RestoreBackupForm))]
|
||||
[JsonSerializable(typeof(ViewBackupTicket))]
|
||||
[JsonSerializable(typeof(ViewBackupUpload))]
|
||||
[JsonSerializable(typeof(ViewPersonaArchive))]
|
||||
[JsonSerializable(typeof(ImportPersonaArchiveForm))]
|
||||
[JsonSerializable(typeof(ViewArchiveTicket))]
|
||||
[JsonSerializable(typeof(ViewArchiveUpload))]
|
||||
[JsonSerializable(typeof(ViewServerSettings))]
|
||||
[JsonSerializable(typeof(ServerSettingsForm))]
|
||||
[JsonSerializable(typeof(ViewAnnouncement))]
|
||||
[JsonSerializable(typeof(List<ViewAnnouncement>))]
|
||||
[JsonSerializable(typeof(AnnouncementForm))]
|
||||
[JsonSerializable(typeof(ViewRelay))]
|
||||
[JsonSerializable(typeof(List<ViewRelay>))]
|
||||
[JsonSerializable(typeof(RelayForm))]
|
||||
[JsonSerializable(typeof(ViewStaffPick))]
|
||||
[JsonSerializable(typeof(List<ViewStaffPick>))]
|
||||
[JsonSerializable(typeof(StaffPickForm))]
|
||||
[JsonSerializable(typeof(ViewAdminActionsPage))]
|
||||
[JsonSerializable(typeof(UsersIds))]
|
||||
[JsonSerializable(typeof(ModerateAccountForm))]
|
||||
[JsonSerializable(typeof(RemovePostForm))]
|
||||
[JsonSerializable(typeof(ResolveReportForm))]
|
||||
[JsonSerializable(typeof(ViewModeratedAccount))]
|
||||
[JsonSerializable(typeof(ViewModeratedAccountsPage))]
|
||||
[JsonSerializable(typeof(ViewAdminRoot))]
|
||||
[JsonSerializable(typeof(ViewAdminRootsPage))]
|
||||
[JsonSerializable(typeof(RootRoleForm))]
|
||||
[JsonSerializable(typeof(AdminPasswordForm))]
|
||||
[JsonSerializable(typeof(DeletePersonaForm))]
|
||||
[JsonSerializable(typeof(DeleteGroupForm))]
|
||||
[JsonSerializable(typeof(ViewLocalEmoji))]
|
||||
[JsonSerializable(typeof(List<ViewLocalEmoji>))]
|
||||
public partial class ClientJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
Reference in new issue
Block a user