Files
SocialPub/PrivaPub/Models/ServerSettings.cs
T
thepraandClaude Opus 5.5 87529bca49 R8 the Mastodon API made real: featured tags, endorsements, notes, notify and languages, suggestions, the direct stream
Featured tags per persona (/api/v1/featured_tags, suggestions, tags/:name/feature, accounts' featured tags, max 10),
listed at /tattoos as Hashtags and sent as Add/Remove{Hashtag} to followers on the featured collection, as Mastodon
sends them; remote accounts' tags received and read from featuredTags. Endorsements (pin/endorse) and private notes
(PersonaNote) kept per persona and never federated; the relationship's notifying, languages, endorsed and note, with
follow's notify (status notifications) and languages (home filter). Reading preferences set on /clientapi. Suggestions
v1/v2 with dismissals and staff picks, never the persona or a sibling. conversation events on the direct stream.
translate, annual reports and the admin API answer. New collections backed up and removed with their persona.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
2026-10-18 08:38:11 +02:00

66 lines
3.8 KiB
C#

using MongoDB.Entities;
namespace PrivaPub.Models
{
// The server's own settings (completion program R5), edited from the administrator's page: one document with the fixed
// id `settings`, read through IInstanceSettings (Domain/Instance/InstanceSettings.cs). While none exists, Defaults() is
// what PrivaPub served and sent before the settings existed, word for word, so nothing changes until an administrator
// saves. A backup holds it, and a restore keeps the live one (ProtectiveMerge).
public class ServerSettings : Entity
{
public const string Name = "settings";
public const string DefaultTitle = "PrivaPub";
public const string DefaultDescription = "A small ActivityPub server where one private login keeps several unlinkable public personas.";
public const string DefaultThumbnailPath = "/media/missing-header.png";
public static readonly DateTime DefaultPrivacyPolicyUpdatedAt = new(2026, 10, 4, 0, 0, 0, DateTimeKind.Utc);
// the privacy policy PrivaPub served before it could be edited, as Markdown: it renders to the same paragraph
public const string DefaultPrivacyPolicy = "One private login owns several public personas, and nobody but this server's admin can tell they belong "
+ "together. What a persona posts is shared as its visibility says; a located post never leaves this server. "
+ "Uploads lose their metadata. Statistics name servers, never people: see /stargazing.";
public string Title { get; set; } = DefaultTitle;
public string ShortDescription { get; set; } = DefaultDescription;
public string Description { get; set; } = DefaultDescription;//Markdown
public DateTime? DescriptionUpdatedAt { get; set; }//null: the description was never edited (it then answers today)
public string ContactEmail { get; set; }
public string ContactAccountId { get; set; }//a local persona the administrator chose: publicly tied to running the server
public string ThumbnailMediaId { get; set; }//its MediaAttachment (ServerUse "thumbnail")
public string ThumbnailUrl { get; set; }//null: /media/missing-header.png
public string PrivacyPolicy { get; set; } = DefaultPrivacyPolicy;//Markdown
public DateTime? PrivacyPolicyUpdatedAt { get; set; } = DefaultPrivacyPolicyUpdatedAt;
public string TermsOfService { get; set; }//Markdown; null: the server has none (the API answers 404)
public DateTime? TermsEffectiveAt { get; set; }
public List<ServerRule> Rules { get; set; } = new();//soft-deleted ones stay, so old reports keep their meaning
public List<string> Relays { get; set; } = new();//besides Federation:Relays
public ServerMediaLimits Media { get; set; } = new();
public List<string> StaffPicks { get; set; } = new();//Mastodon account ids (Avatar.ID, ForeignAvatar.ID) suggested first to every persona (R8)
public bool PublishActivity { get; set; }//GET /api/v1/instance/activity; off by default
public DateTime? UpdatedAt { get; set; }//null: never saved
public string UpdatedBy { get; set; }//the administrator's root id, or "cli"
public static ServerSettings Defaults() => new() { ID = Name };
/// <summary>The rules shown to everyone: those not deleted, in their order.</summary>
public IEnumerable<ServerRule> ListedRules() => Rules.Where(r => r.DeletedAt == null).OrderBy(r => r.Position);
}
public class ServerRule
{
public string Id { get; set; } = Guid.NewGuid().ToString("N");
public string Text { get; set; }
public string Hint { get; set; }
public int Position { get; set; }
public DateTime? DeletedAt { get; set; }
}
// what the administrator changed of Media:* (MediaOptions); null keeps the configured value. Applied by
// Domain/Instance/MediaLimitsFromSettings within hard caps.
public class ServerMediaLimits
{
public long? QuotaBytesPerRoot { get; set; }
public long? MaxImageBytes { get; set; }
public long? MaxVideoBytes { get; set; }
public int? MaxSeconds { get; set; }
}
}