Current libraries: the database, media, sanitizer, mail and sign-in libraries are on their latest versions
Build / Build (push) Successful in 35s
Build / Build (push) Successful in 35s
- MongoDB.Entities 26, FFMpegCore 6, HtmlSanitizer 11, Serilog's MongoDB sink 8, OpenIddict 7.8, MailKit 4.18.2, Markdig 1.6, Swashbuckle 10.3, QRCoder 1.8.1 and the .NET 10.0.14 sign-in library; the build uses SDK 10.0.403. The two packages with known vulnerabilities in the old set are gone. - Stored records are read and written exactly as before: ids keep their form, personas and groups still get ids that carry their published day, and an older version can still read what this one writes. - Videos are probed, transcoded and given a poster frame as before. - Federated posts are cleaned exactly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W4YtEJrgxG12Pc39Fai8Bd
This commit is contained in:
1 parent
739a1603ca
commit
8a1e4e419b
9 files changed
+88
-26
No files matched your search
@@ -601,7 +601,7 @@ namespace PrivaPub.Domain.Media
|
||||
await _processing.WaitAsync(token);
|
||||
try
|
||||
{
|
||||
var probe = await FFProbe.AnalyseAsync(input, default, token, "-protocol_whitelist file");
|
||||
var probe = await FFProbe.AnalyseAsync(input, customArguments: "-protocol_whitelist file", cancellationToken: token);
|
||||
if (probe.Duration > TimeSpan.FromSeconds(options.MaxSeconds))
|
||||
return MediaOutcome.Fail(StatusCodes.Status422UnprocessableEntity, "Validation failed: The file is too long");
|
||||
var video = attachment.ContentType.StartsWith("video/", StringComparison.Ordinal) ? probe.PrimaryVideoStream : default;
|
||||
@@ -614,7 +614,7 @@ namespace PrivaPub.Domain.Media
|
||||
if (video == default)
|
||||
arguments = "-map 0:a:0 -vn -dn -sn -map_metadata -1 -map_chapters -1 -c copy" + (extension == "m4a" ? " -movflags +faststart" : string.Empty);
|
||||
else if (video.CodecName is "h264" or "vp8" or "vp9" or "av1" && (long)video.Width * video.Height <= options.MaxVideoPixels
|
||||
&& video.FrameRate <= options.MaxFrameRate + 0.5)
|
||||
&& video.RealFrameRate <= options.MaxFrameRate + 0.5)
|
||||
arguments = "-map 0:v:0 -map 0:a:0? -dn -sn -map_metadata -1 -map_chapters -1 -c copy" + (extension == "mp4" ? " -movflags +faststart" : string.Empty);
|
||||
else
|
||||
{
|
||||
@@ -631,13 +631,15 @@ namespace PrivaPub.Domain.Media
|
||||
.CancellableThrough(token)
|
||||
.ProcessAsynchronously();
|
||||
|
||||
var made = await FFProbe.AnalyseAsync(output, default, token, "-protocol_whitelist file");
|
||||
var made = await FFProbe.AnalyseAsync(output, customArguments: "-protocol_whitelist file", cancellationToken: token);
|
||||
byte[] poster = default;
|
||||
if (video != default)
|
||||
{
|
||||
attachment.Width = made.PrimaryVideoStream?.Width;
|
||||
attachment.Height = made.PrimaryVideoStream?.Height;
|
||||
await FFMpeg.SnapshotAsync(output, frame, captureTime: TimeSpan.FromSeconds(Math.Min(1, made.Duration.TotalSeconds / 2)), cancellationToken: token);
|
||||
await FFMpeg.Snapshot(made, frame, captureTime: TimeSpan.FromSeconds(Math.Min(1, made.Duration.TotalSeconds / 2)))
|
||||
.CancellableThrough(token)
|
||||
.ProcessAsynchronously();
|
||||
var still = ProcessImage(await File.ReadAllBytesAsync(frame, token), 640, options.PreviewSide);
|
||||
poster = still.Preview;
|
||||
attachment.Blurhash = still.Blurhash;
|
||||
|
||||
Reference in new issue
Block a user