R5 the server's own settings: instance, rules, announcements, relays, media limits, the staff's log
Build / Build (push) Successful in 1m3s
Build / Build (push) Successful in 1m3s
A singleton ServerSettings (title, descriptions, contact, thumbnail, privacy policy, terms, rules, relays, media overrides, PublishActivity), cached by InstanceSettings and read by the instance API, NodeInfo, the instance actor, the web pages and the mailer; its defaults are the old literals, so nothing changes until an administrator edits. /clientapi/admin/settings (and /thumbnail), /announcements, /relays for administrators; /clientapi/moderator/log, the staff's log (AdminAction, written by domain blocks, backups, settings and the CLI; no IP, never a root paired with its personas). The Mastodon API's rules, extended description, privacy policy, terms of service, domain blocks (Published, Obfuscate), announcements (dismiss, reactions, streaming) and activity (only when published). Reports carry rule ids. Media overrides clamped to hard caps. Relays named by the settings reconcile next to the configured ones. Verified: interop.sh instance accounts relay with mastodon, relay, aoderelay and mailpit, 119 passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
This commit is contained in:
1 parent
f67e2ae35e
commit
70d1ffe9a2
46 files changed
+2223
-107
No files matched your search
@@ -88,5 +88,30 @@ namespace PrivaPub.Domain.Privacy
|
||||
var barred = await BarredPersonas(token);
|
||||
return await DB.Default.CountAsync<PostEntity>(f => f.Where(p => !p.IsFederatedCopy && !barred.Contains(p.GroupUserId)) & f.Where(Post), token);
|
||||
}
|
||||
|
||||
// Mastodon's instance activity, week by week (from Monday 00:00 UTC), this week first: the local posts made in it,
|
||||
// counted as LocalPosts counts them (by their ids, which carry when they were made, so the _id index serves it), and
|
||||
// the logins made in it (RootUser.CreatedAt). Never personas by their creation: their dates are spread on purpose.
|
||||
public static async Task<List<(DateTime Week, long Posts, long Registrations)>> Weekly(int weeks, CancellationToken token)
|
||||
{
|
||||
var barred = await BarredPersonas(token);
|
||||
var today = DateTime.UtcNow.Date;
|
||||
var monday = DateTime.SpecifyKind(today.AddDays(-(((int)today.DayOfWeek + 6) % 7)), DateTimeKind.Utc);
|
||||
var counted = new List<(DateTime, long, long)>();
|
||||
for (var i = 0; i < weeks; i++)
|
||||
{
|
||||
var start = monday.AddDays(-7 * i);
|
||||
var end = start.AddDays(7);
|
||||
var (low, high) = (IdAt(start), IdAt(end));
|
||||
var posts = await DB.Default.CountAsync<PostEntity>(f => f.Gte(p => p.ID, low) & f.Lt(p => p.ID, high)
|
||||
& f.Where(p => !p.IsFederatedCopy && !barred.Contains(p.GroupUserId)) & f.Where(Post), token);
|
||||
var registrations = await DB.Default.CountAsync<RootUser>(u => u.CreatedAt >= start && u.CreatedAt < end, token);
|
||||
counted.Add((start, posts, registrations));
|
||||
}
|
||||
return counted;
|
||||
}
|
||||
|
||||
// the smallest ObjectId of a moment
|
||||
static string IdAt(DateTime at) => ((uint)new DateTimeOffset(at, TimeSpan.Zero).ToUnixTimeSeconds()).ToString("x8") + "0000000000000000";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user