fix (backend): generated icons sometimes not showing

This commit is contained in:
naskya 2024-07-30 00:29:27 +09:00
parent a5f950b468
commit 1109fd6248
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C

View file

@ -118,9 +118,8 @@ router.get("/avatar/@:acct", async (ctx) => {
router.get("/identicon/:x", async (ctx) => {
const instanceMeta = await fetchMeta();
if (instanceMeta.enableIdenticonGeneration) {
const identicon = await genIdenticon(ctx.params.x);
const [temp, cleanup] = await createTemp();
fs.createWriteStream(temp).write(identicon);
fs.writeFileSync(temp, await genIdenticon(ctx.params.x));
ctx.set("Content-Type", "image/png");
ctx.body = fs.createReadStream(temp).on("close", () => cleanup());
} else {