mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-03 08:28:54 -04:00
Move letter-avatars into own request
To prevent further weakening of our CSP policies, moving the Avatars into a non-inline version is the way to go. This implementation probably needs some beautification. But already fixes the bug. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
parent
f23f403bcb
commit
69aed93282
3 changed files with 23 additions and 11 deletions
|
@ -6,7 +6,7 @@ var scrypt = require('scrypt')
|
|||
|
||||
// core
|
||||
var logger = require('../logger')
|
||||
var letterAvatars = require('../letter-avatars')
|
||||
var {generateAvatarURL} = require('../letter-avatars')
|
||||
|
||||
module.exports = function (sequelize, DataTypes) {
|
||||
var User = sequelize.define('User', {
|
||||
|
@ -108,7 +108,7 @@ module.exports = function (sequelize, DataTypes) {
|
|||
if (bigger) photo = photo.replace(/(\?s=)\d*$/i, '$1400')
|
||||
else photo = photo.replace(/(\?s=)\d*$/i, '$196')
|
||||
} else {
|
||||
photo = letterAvatars(profile.username)
|
||||
photo = generateAvatarURL(profile.username)
|
||||
}
|
||||
break
|
||||
case 'mattermost':
|
||||
|
@ -117,7 +117,7 @@ module.exports = function (sequelize, DataTypes) {
|
|||
if (bigger) photo = photo.replace(/(\?s=)\d*$/i, '$1400')
|
||||
else photo = photo.replace(/(\?s=)\d*$/i, '$196')
|
||||
} else {
|
||||
photo = letterAvatars(profile.username)
|
||||
photo = generateAvatarURL(profile.username)
|
||||
}
|
||||
break
|
||||
case 'dropbox':
|
||||
|
@ -140,7 +140,7 @@ module.exports = function (sequelize, DataTypes) {
|
|||
if (bigger) photo += '?s=400'
|
||||
else photo += '?s=96'
|
||||
} else {
|
||||
photo = letterAvatars(profile.username)
|
||||
photo = generateAvatarURL(profile.username)
|
||||
}
|
||||
break
|
||||
case 'saml':
|
||||
|
@ -149,7 +149,7 @@ module.exports = function (sequelize, DataTypes) {
|
|||
if (bigger) photo += '?s=400'
|
||||
else photo += '?s=96'
|
||||
} else {
|
||||
photo = letterAvatars(profile.username)
|
||||
photo = generateAvatarURL(profile.username)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue