diff options
author | Chocobozzz <me@florianbigard.com> | 2021-01-26 10:23:21 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-01-26 10:29:57 +0100 |
commit | e08ff02a9f1fb1cfbdfa8f0f602eda9419ba6cc3 (patch) | |
tree | aea8add5a1a93edb0a5aab63588bd358aa9960a3 /server/lib | |
parent | d223dca0cd50010d1c4455e5eec1736b1c591aed (diff) | |
download | PeerTube-e08ff02a9f1fb1cfbdfa8f0f602eda9419ba6cc3.tar.gz PeerTube-e08ff02a9f1fb1cfbdfa8f0f602eda9419ba6cc3.tar.zst PeerTube-e08ff02a9f1fb1cfbdfa8f0f602eda9419ba6cc3.zip |
Allow webp image uploads
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/avatar.ts | 9 |
1 files changed, 5 insertions, 4 deletions
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' | |||
13 | import { downloadImage } from '../helpers/requests' | 13 | import { downloadImage } from '../helpers/requests' |
14 | import { MAccountDefault, MChannelDefault } from '../types/models' | 14 | import { MAccountDefault, MChannelDefault } from '../types/models' |
15 | 15 | ||
16 | async function updateActorAvatarFile ( | 16 | async function updateLocalActorAvatarFile ( |
17 | accountOrChannel: MAccountDefault | MChannelDefault, | 17 | accountOrChannel: MAccountDefault | MChannelDefault, |
18 | avatarPhysicalFile: Express.Multer.File | 18 | avatarPhysicalFile: Express.Multer.File |
19 | ) { | 19 | ) { |
20 | const extension = extname(avatarPhysicalFile.filename) | 20 | const extension = extname(avatarPhysicalFile.filename) |
21 | |||
21 | const avatarName = uuidv4() + extension | 22 | const avatarName = uuidv4() + extension |
22 | const destination = join(CONFIG.STORAGE.AVATARS_DIR, avatarName) | 23 | const destination = join(CONFIG.STORAGE.AVATARS_DIR, avatarName) |
23 | await processImage(avatarPhysicalFile.path, destination, AVATARS_SIZE) | 24 | await processImage(avatarPhysicalFile.path, destination, AVATARS_SIZE) |
@@ -40,7 +41,7 @@ async function updateActorAvatarFile ( | |||
40 | }) | 41 | }) |
41 | } | 42 | } |
42 | 43 | ||
43 | async function deleteActorAvatarFile ( | 44 | async function deleteLocalActorAvatarFile ( |
44 | accountOrChannel: MAccountDefault | MChannelDefault | 45 | accountOrChannel: MAccountDefault | MChannelDefault |
45 | ) { | 46 | ) { |
46 | return retryTransactionWrapper(() => { | 47 | return retryTransactionWrapper(() => { |
@@ -78,7 +79,7 @@ const avatarPathUnsafeCache = new LRUCache<string, string>({ max: LRU_CACHE.AVAT | |||
78 | 79 | ||
79 | export { | 80 | export { |
80 | avatarPathUnsafeCache, | 81 | avatarPathUnsafeCache, |
81 | updateActorAvatarFile, | 82 | updateLocalActorAvatarFile, |
82 | deleteActorAvatarFile, | 83 | deleteLocalActorAvatarFile, |
83 | pushAvatarProcessInQueue | 84 | pushAvatarProcessInQueue |
84 | } | 85 | } |