From e08ff02a9f1fb1cfbdfa8f0f602eda9419ba6cc3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 26 Jan 2021 10:23:21 +0100 Subject: Allow webp image uploads --- server/lib/avatar.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'server/lib/avatar.ts') diff --git a/server/lib/avatar.ts b/server/lib/avatar.ts index 9d59a4966..e79cd1546 100644 --- a/server/lib/avatar.ts +++ b/server/lib/avatar.ts @@ -13,11 +13,12 @@ import { queue } from 'async' import { downloadImage } from '../helpers/requests' import { MAccountDefault, MChannelDefault } from '../types/models' -async function updateActorAvatarFile ( +async function updateLocalActorAvatarFile ( accountOrChannel: MAccountDefault | MChannelDefault, avatarPhysicalFile: Express.Multer.File ) { const extension = extname(avatarPhysicalFile.filename) + const avatarName = uuidv4() + extension const destination = join(CONFIG.STORAGE.AVATARS_DIR, avatarName) await processImage(avatarPhysicalFile.path, destination, AVATARS_SIZE) @@ -40,7 +41,7 @@ async function updateActorAvatarFile ( }) } -async function deleteActorAvatarFile ( +async function deleteLocalActorAvatarFile ( accountOrChannel: MAccountDefault | MChannelDefault ) { return retryTransactionWrapper(() => { @@ -78,7 +79,7 @@ const avatarPathUnsafeCache = new LRUCache({ max: LRU_CACHE.AVAT export { avatarPathUnsafeCache, - updateActorAvatarFile, - deleteActorAvatarFile, + updateLocalActorAvatarFile, + deleteLocalActorAvatarFile, pushAvatarProcessInQueue } -- cgit v1.2.3