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
101 lines
3.7 KiB
C#
101 lines
3.7 KiB
C#
namespace decePubClient.Models.Mastodon;
|
|
|
|
/// <summary>A persona, a remote account or a community, as PrivaPub's Mastodon API sends it.</summary>
|
|
public class Account
|
|
{
|
|
public string Id { get; set; }
|
|
public string Username { get; set; }
|
|
/// <summary>username for a local account, username@host for a remote one.</summary>
|
|
public string Acct { get; set; }
|
|
public string DisplayName { get; set; }
|
|
public bool Locked { get; set; }
|
|
public bool Bot { get; set; }
|
|
public bool Group { get; set; }
|
|
public DateTime? CreatedAt { get; set; }
|
|
public string Note { get; set; }
|
|
public string Url { get; set; }
|
|
public string Uri { get; set; }
|
|
public string Avatar { get; set; }
|
|
public string AvatarStatic { get; set; }
|
|
public string Header { get; set; }
|
|
public string HeaderStatic { get; set; }
|
|
public int FollowersCount { get; set; }
|
|
public int FollowingCount { get; set; }
|
|
public int StatusesCount { get; set; }
|
|
public string LastStatusAt { get; set; }
|
|
public List<CustomEmoji> Emojis { get; set; } = [];
|
|
public List<AccountField> Fields { get; set; } = [];
|
|
/// <summary>Whether it is listed in the directory and suggested; null when its server does not say.</summary>
|
|
public bool? Discoverable { get; set; }
|
|
/// <summary>Whether its public posts may be found by full-text search.</summary>
|
|
public bool? Indexable { get; set; }
|
|
/// <summary>The persona's own account only (verify_credentials, update_credentials): its profile as written and its
|
|
/// posting defaults.</summary>
|
|
public AccountSource Source { get; set; }
|
|
|
|
/// <summary>The account's server: the host of its ActivityPub id.</summary>
|
|
public string Host => System.Uri.TryCreate(Uri, UriKind.Absolute, out var uri) ? uri.Host.ToLowerInvariant() : default;
|
|
|
|
/// <summary>The name to show: the display name, or the username when there is none.</summary>
|
|
public string Name => string.IsNullOrWhiteSpace(DisplayName) ? Username : DisplayName;
|
|
}
|
|
|
|
public class AccountSource
|
|
{
|
|
/// <summary>The biography as written, before PrivaPub renders it.</summary>
|
|
public string Note { get; set; }
|
|
public List<AccountField> Fields { get; set; } = [];
|
|
/// <summary>The default visibility of a new post: public, unlisted or private.</summary>
|
|
public string Privacy { get; set; }
|
|
public bool Sensitive { get; set; }
|
|
public string Language { get; set; }
|
|
/// <summary>Who may quote the persona's posts: public, followers or nobody.</summary>
|
|
public string QuotePolicy { get; set; }
|
|
public int FollowRequestsCount { get; set; }
|
|
}
|
|
|
|
/// <summary>A page of accounts (mutes, blocks), and the cursor of the next one: null at the end.</summary>
|
|
public class AccountPage
|
|
{
|
|
public List<Account> Accounts { get; set; } = [];
|
|
public string MaxId { get; set; }
|
|
}
|
|
|
|
public class AccountField
|
|
{
|
|
public string Name { get; set; }
|
|
public string Value { get; set; }
|
|
public DateTime? VerifiedAt { get; set; }
|
|
}
|
|
|
|
public class CustomEmoji
|
|
{
|
|
public string Shortcode { get; set; }
|
|
public string Url { get; set; }
|
|
public string StaticUrl { get; set; }
|
|
}
|
|
|
|
public class Relationship
|
|
{
|
|
public string Id { get; set; }
|
|
public bool Following { get; set; }
|
|
public bool FollowedBy { get; set; }
|
|
public bool Blocking { get; set; }
|
|
public bool BlockedBy { get; set; }
|
|
public bool Muting { get; set; }
|
|
public bool MutingNotifications { get; set; }
|
|
public bool ShowingReblogs { get; set; }
|
|
public bool Notifying { get; set; }
|
|
public bool Requested { get; set; }
|
|
public bool RequestedBy { get; set; }
|
|
public bool DomainBlocking { get; set; }
|
|
}
|
|
|
|
/// <summary>/api/v2/search: what matched, a remote handle or URL resolved by PrivaPub.</summary>
|
|
public class SearchResults
|
|
{
|
|
public List<Account> Accounts { get; set; } = [];
|
|
public List<Status> Statuses { get; set; } = [];
|
|
public List<StatusTag> Hashtags { get; set; } = [];
|
|
}
|