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
22 lines
1.1 KiB
C#
22 lines
1.1 KiB
C#
namespace PrivaPub.Domain.Media
|
|
{
|
|
public class MediaOptions
|
|
{
|
|
public string Root { get; set; }
|
|
public long MaxImageBytes { get; set; } = 16 * 1024 * 1024;
|
|
public long MaxVideoBytes { get; set; } = 99 * 1024 * 1024;
|
|
public long MaxProxiedBytes { get; set; } = 40 * 1024 * 1024;
|
|
public long ProxyCacheBytes { get; set; } = 5L * 1024 * 1024 * 1024;
|
|
public int MaxImageSide { get; set; } = 4096;
|
|
public int PreviewSide { get; set; } = 640;
|
|
public long MaxPixels { get; set; } = 40_000_000;//an image (or a GIF's frames together) may not decode to more
|
|
public int MaxFrames { get; set; } = 500;
|
|
public int MaxGifSide { get; set; } = 1280;//a GIF becomes an mp4 at most this wide
|
|
public int Concurrency { get; set; } = 2;//uploads processed at once
|
|
public long MaxVideoPixels { get; set; } = 2_304_000;//a larger video is made smaller (as Mastodon's video_matrix_limit)
|
|
public double MaxFrameRate { get; set; } = 60;
|
|
public int MaxSeconds { get; set; } = 3600;//audio or video may not last longer
|
|
public long QuotaBytesPerRoot { get; set; }//what a login's media may take (0: no quota)
|
|
}
|
|
}
|