1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-09 20:22:47 +01:00

Support apng & webm

This commit is contained in:
TomatoCake 2024-07-16 17:44:39 +02:00 committed by Madeline
parent 0096938d36
commit 2f679fda5d

View File

@ -125,6 +125,7 @@ router.post(
const user = await User.findOneOrFail({ where: { id: req.user_id } }); const user = await User.findOneOrFail({ where: { id: req.user_id } });
body.image = (await handleFile(`/emojis/${id}`, body.image)) as string; body.image = (await handleFile(`/emojis/${id}`, body.image)) as string;
const mimeType = body.image.split(":")[1].split(";")[0];
const emoji = await Emoji.create({ const emoji = await Emoji.create({
id: id, id: id,
guild_id: guild_id, guild_id: guild_id,
@ -132,7 +133,10 @@ router.post(
require_colons: body.require_colons ?? undefined, // schema allows nulls, db does not require_colons: body.require_colons ?? undefined, // schema allows nulls, db does not
user: user, user: user,
managed: false, managed: false,
animated: body.image.split(":")[1].split(";")[0] == "image/gif", animated:
mimeType == "image/gif" ||
mimeType == "image/apng" ||
mimeType == "video/webm",
available: true, available: true,
roles: [], roles: [],
}).save(); }).save();