Make media analyze optional (disabled by default)

This commit is contained in:
Alex Gleason
2024-11-07 11:18:39 -06:00
parent 721fe52142
commit f987effc15
2 changed files with 10 additions and 1 deletions

View File

@@ -57,7 +57,9 @@ export async function uploadFile(
tags.push(['m', file.type]);
}
if (!blurhash || !dim) {
// If the uploader didn't already, try to get a blurhash and media dimensions.
// This requires `MEDIA_ANALYZE=true` to be configured because it comes with security tradeoffs.
if (Conf.mediaAnalyze && (!blurhash || !dim)) {
try {
const bytes = await new Response(file.stream()).bytes();
const img = sharp(bytes);