The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/server/startup/migrations/v036.coffee

27 lines
762 B

url = Npm.require 'url'
RocketChat.Migrations.add
version: 36
up: ->
loginHeader = RocketChat.models.Settings.findOne _id: 'Layout_Login_Header'
if not loginHeader?.value?
return
match = loginHeader.value.match(/<img\ssrc=['"]([^'"]+)/)
if match? and match.length is 2
requestUrl = match[1]
if requestUrl[0] is '/'
requestUrl = url.resolve(Meteor.absoluteUrl(), requestUrl)
try
Meteor.startup ->
Meteor.setTimeout ->
result = HTTP.get requestUrl, npmRequestOptions: {encoding: 'binary'}
if result.statusCode is 200
RocketChat.Assets.setAsset(result.content, result.headers['content-type'], 'logo')
, 30000
catch e
console.log e
RocketChat.models.Settings.remove _id: 'Layout_Login_Header'