summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-04-15 22:58:04 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-04-15 22:58:04 +0900
commit792ec23d7a353939679f2c03c8669a04e879d263 (patch)
tree4c7e4df58ac749b53aaff13954e7d85a1a809dc8 /src/server
parent11.1.1 (diff)
downloadsharkey-792ec23d7a353939679f2c03c8669a04e879d263.tar.gz
sharkey-792ec23d7a353939679f2c03c8669a04e879d263.tar.bz2
sharkey-792ec23d7a353939679f2c03c8669a04e879d263.zip
Use pureimage instead of canvas
Diffstat (limited to 'src/server')
-rw-r--r--src/server/index.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/index.ts b/src/server/index.ts
index 7d8938d584..b3ca47f232 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -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 => {