diff options
author | Christoph (Sheogorath) Kern | 2018-04-17 22:29:37 +0200 |
---|---|---|
committer | GitHub | 2018-04-17 22:29:37 +0200 |
commit | 763479bea8603b9bd18133b0534314edebc50777 (patch) | |
tree | 73eaee79c74d451954b221a676411bb1284fcfdc /lib/web | |
parent | 43fa5cf57fe84e9a859466d4080ad5936b22a9e2 (diff) | |
parent | 69aed932820ab6175b3cdc778b152703bab81961 (diff) |
Merge pull request #803 from SISheogorath/fix/letterAvatarCSP
Move letter-avatars into own request
Diffstat (limited to 'lib/web')
-rw-r--r-- | lib/web/userRouter.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/web/userRouter.js b/lib/web/userRouter.js index ecfbaf8b..963961c7 100644 --- a/lib/web/userRouter.js +++ b/lib/web/userRouter.js @@ -5,6 +5,7 @@ const Router = require('express').Router const response = require('../response') const models = require('../models') const logger = require('../logger') +const {generateAvatar} = require('../letter-avatars') const UserRouter = module.exports = Router() @@ -34,3 +35,9 @@ UserRouter.get('/me', function (req, res) { }) } }) + +UserRouter.get('/user/:username/avatar.svg', function (req, res, next) { + res.setHeader('Content-Type', 'image/svg+xml') + res.setHeader('Cache-Control', 'public, max-age=86400') + res.send(generateAvatar(req.params.username)) +}) |