Use pureimage instead of canvas

This commit is contained in:
syuilo
2019-04-15 22:58:04 +09:00
parent 8c872c6b22
commit 792ec23d7a
3 changed files with 12 additions and 9 deletions

View File

@ -26,6 +26,7 @@ import { program } from '../argv';
import { UserProfiles } from '../models';
import { networkChart } from '../services/chart';
import { genAvatar } from '../misc/gen-avatar';
import { createTemp } from '../misc/create-temp';
export const serverLogger = new Logger('server', 'gray', false);
@ -73,10 +74,11 @@ router.use(activityPub.routes());
router.use(nodeinfo.routes());
router.use(wellKnown.routes());
router.get('/avatar/:x', ctx => {
const avatar = genAvatar(ctx.params.x);
router.get('/avatar/:x', async ctx => {
const [temp] = await createTemp();
await genAvatar(ctx.params.x, fs.createWriteStream(temp));
ctx.set('Content-Type', 'image/png');
ctx.body = avatar;
ctx.body = fs.createReadStream(temp);
});
router.get('/verify-email/:code', async ctx => {