Create a user rocket.cat and set avatar on system initialization

pull/1625/head
Rodrigo Nascimento 10 years ago
parent c3cfb051e8
commit e9aa6650b6
  1. BIN
      private/avatars/rocketcat.png
  2. 19
      server/startup/initialData.coffee

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

@ -5,6 +5,25 @@ Meteor.startup ->
RocketChat.models.Rooms.createWithIdTypeAndName 'GENERAL', 'c', 'general',
default: true
if not RocketChat.models.Users.findOneByUsername('rocket.cat')?
userId = RocketChat.models.Users.create
name: "Rocket.Cat"
username: 'rocket.cat'
status: "offline"
statusDefault: "offline"
utcOffset: 0
active: true
bot: true
rs = RocketChatFile.bufferToStream new Buffer(Assets.getBinary('avatars/rocketcat.png'), 'utf8')
RocketChatFileAvatarInstance.deleteFile "rocket.cat.jpg"
ws = RocketChatFileAvatarInstance.createWriteStream "rocket.cat.jpg", 'image/png'
ws.on 'end', Meteor.bindEnvironment ->
RocketChat.models.Users.setAvatarOrigin userId, 'local'
rs.pipe(ws)
if process.env.ADMIN_EMAIL? and process.env.ADMIN_PASS?
re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if re.test process.env.ADMIN_EMAIL

Loading…
Cancel
Save