A login's storage is counted, and can have a quota
MediaAttachment.Size was stored and never summed: nobody, the administrator included, could tell what media took, and nothing bounded it. Counted.Media and MediaOfRoot sum what is kept (not trashed). A login sees what its personas' uploads and pictures take at /clientapi/user/storage (ViewStorage), with its quota when the server sets one; Media:QuotaBytesPerRoot (0, no quota, by default) refuses an upload or a picture over it with 422, whichever persona sends it; the statistics overview gains the media totals, the proxy cache and the trash (ViewMediaTotals). Tests: a login's storage counts what its personas keep and forgets what is trashed; two uploads from two personas of one login are refused together past the quota. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
5252b8f320
commit
dc63fa57b8
11 files changed
+134
-3
No files matched your search
@@ -74,10 +74,18 @@ namespace PrivaPub.Domain.Statistics
|
||||
Written = server.Sum(d => d.LedgerWritten),
|
||||
Dropped = server.Sum(d => d.LedgerDropped),
|
||||
Failed = server.Sum(d => d.LedgerFailed)
|
||||
}
|
||||
},
|
||||
Media = await MediaTotals(token)
|
||||
};
|
||||
}
|
||||
|
||||
// the media rows kept; the disk's caches are added by whoever knows where they are
|
||||
static async Task<ViewMediaTotals> MediaTotals(CancellationToken token)
|
||||
{
|
||||
var (bytes, files) = await Domain.Privacy.Counted.Media(m => true, token);
|
||||
return new ViewMediaTotals { MediaBytes = bytes, MediaFiles = files };
|
||||
}
|
||||
|
||||
public async Task<ViewHostsPage> Hosts(int days, string sort, string software, int page, int limit, CancellationToken token)
|
||||
{
|
||||
var hostDays = await Days(days, default, token);
|
||||
|
||||
Reference in new issue
Block a user