R8 the Mastodon API made real in decePub: featured tags, notify, languages, recommendations, notes, suggestions, the direct stream

A profile shows the hashtags an account features as chips opening their feed; under another account's header is what the
persona keeps of it for itself alone: for one it follows, a bell (follow with notify), the languages of its posts that
reach the home feed (follow with languages[]) and Recommend (endorsements, private here), and for any account a private
note saved on blur or with Save. Settings edits the persona's featured hashtags (added by name or from those used lately,
10 at most) and its reading preferences (/clientapi/avatar/private/preferences), which CascadingState keeps per persona
and the card applies to sensitive media and content warnings. A hashtag's tab features it on the profile. Explore has Who
to follow (/api/v2/suggestions, dismissed for good after asking); Administration has Staff picks. The Direct tab follows
the direct stream's conversation events; status notifications show the post. The follows CSV carries notify and languages.

Verified: Release build, 0 errors (the 3 warnings were there before). Not run against PrivaPub or in the pasture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-10-18 08:58:30 +02:00
1 parent 566b0e33ea
commit d33697e3fc
28 files changed
+1784 -52

No files matched your search

+34 -1
View File
@@ -1,13 +1,15 @@
namespace decePubClient.Models.Mastodon;
/// <summary>A hashtag as PrivaPub describes it: its last week of use in public posts it holds, and whether the persona
/// follows it (null when nobody is signed in).</summary>
/// follows it and features it on its profile (both null when nobody is signed in).</summary>
public class Tag
{
public string Name { get; set; }
public string Url { get; set; }
public List<TagDay> History { get; set; } = [];
public bool? Following { get; set; }
/// <summary>Featured on the persona's profile (Mastodon 4.4's `featuring`).</summary>
public bool? Featuring { get; set; }
public int WeekUses => History.Sum(h => h.UsesCount);
public int TodayAccounts => History.FirstOrDefault()?.AccountsCount ?? 0;
@@ -31,3 +33,34 @@ public class TrendLink : PreviewCard
public int WeekAccounts => History.Sum(h => h.AccountsCount);
}
/// <summary>A hashtag an account features on its profile (Mastodon's FeaturedTag): public, so it federates. Mastodon sends
/// the count as a string and the last use as a day (yyyy-MM-dd), counted from the account's public and unlisted posts
/// PrivaPub holds.</summary>
public class FeaturedTag
{
public string Id { get; set; }
/// <summary>The hashtag as the account wrote it (its case kept), without the #.</summary>
public string Name { get; set; }
public string Url { get; set; }
public string StatusesCount { get; set; }
public string LastStatusAt { get; set; }
public int Posts => int.TryParse(StatusesCount, out var n) ? n : 0;
/// <summary>The day it was last used, or null when never.</summary>
public DateTime? LastStatusDay =>
DateTime.TryParseExact(LastStatusAt, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out var day)
? day
: null;
}
/// <summary>/api/v2/suggestions: an account to follow and why. Source is staff (picked by the server's staff),
/// past_interactions (the persona favourited, boosted or answered it lately) or global (popular here); Sources names the
/// reasons (featured, most_followed, most_interactions, past_interactions).</summary>
public class Suggestion
{
public string Source { get; set; }
public List<string> Sources { get; set; } = [];
public Account Account { get; set; }
}