fix resolve of emoji's

This commit is contained in:
Luna 2023-07-28 15:19:40 +05:30 committed by Laura Hausmann
parent 748bbdf6a3
commit 8737e2fa71
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -143,7 +143,6 @@ router.get("/apple-touch-icon.png", async (ctx) => {
router.get("/twemoji/(.*)", async (ctx) => { router.get("/twemoji/(.*)", async (ctx) => {
const path = ctx.path.replace("/twemoji/", ""); const path = ctx.path.replace("/twemoji/", "");
if (!path.match(/^[0-9a-f-]+\.svg$/)) { if (!path.match(/^[0-9a-f-]+\.svg$/)) {
ctx.status = 404; ctx.status = 404;
return; return;
@ -155,7 +154,7 @@ router.get("/twemoji/(.*)", async (ctx) => {
); );
await send(ctx as any, path, { await send(ctx as any, path, {
root: `${_dirname}/../../../.yarn/unplugged/@discordapp-twemoji-npm-14.1.2-3097b95b97/dist/svg/`, root: `${_dirname}../../../../../../.yarn/unplugged/@discordapp-twemoji-npm-14.1.2-3097b95b97/node_modules/@discordapp/twemoji/dist/svg/`,
maxage: 30 * DAY, maxage: 30 * DAY,
}); });
}); });
@ -169,7 +168,7 @@ router.get("/twemoji-badge/(.*)", async (ctx) => {
} }
const mask = await sharp( const mask = await sharp(
`${_dirname}/../../../.yarn/unplugged/@discordapp-twemoji-npm-14.1.2-3097b95b97/dist/svg/${path.replace( `${_dirname}../../../../../../.yarn/unplugged/@discordapp-twemoji-npm-14.1.2-3097b95b97/node_modules/@discordapp/twemoji/dist/svg/${path.replace(
".png", ".png",
"", "",
)}.svg`, )}.svg`,