fix some error
This commit is contained in:
parent
fdac822036
commit
0f0c4aae48
|
@ -70,9 +70,11 @@ class Admin::RegisteredSitesController < OrbitAdminController
|
|||
end
|
||||
if urls.nil?
|
||||
tp1.status = 'domain is blank'
|
||||
tp1.can_login = false
|
||||
elsif urls == [nil,nil]
|
||||
tp1.status = 'domain not found'
|
||||
tp1.href = 'http://'+site.site_domain
|
||||
tp1.can_login = false
|
||||
elsif !urls[0].to_s.empty? || !urls[1].to_s.empty?
|
||||
tp1.status = 'ok'
|
||||
if !urls[0].empty?
|
||||
|
@ -82,7 +84,7 @@ class Admin::RegisteredSitesController < OrbitAdminController
|
|||
end
|
||||
tp1.href = root_url
|
||||
uri = URI(root_url)
|
||||
Net::HTTP.start(uri.host, uri.port,:use_ssl => uri.scheme == 'https',open_timeout: 30,read_timeout: 30) do |http|
|
||||
Net::HTTP.start(uri.host, uri.port,:use_ssl => uri.scheme == 'https',open_timeout: 30,read_timeout: 30,verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
|
||||
r3 = login_reomote(http,root_url)
|
||||
if r3.code != '200'
|
||||
tp1.can_login = true
|
||||
|
@ -125,6 +127,7 @@ class Admin::RegisteredSitesController < OrbitAdminController
|
|||
else
|
||||
tp1.href = 'http://'+site.site_domain
|
||||
tp1.status = 'bad gateway'
|
||||
tp1.can_login = false
|
||||
end
|
||||
tp1.save!
|
||||
end
|
||||
|
@ -218,7 +221,7 @@ class Admin::RegisteredSitesController < OrbitAdminController
|
|||
uri = URI(root_url)
|
||||
puts 'starting'
|
||||
begin
|
||||
Net::HTTP.start(uri.host, uri.port,:use_ssl => uri.scheme == 'https',open_timeout: 30,read_timeout: 30) do |http|
|
||||
Net::HTTP.start(uri.host, uri.port,:use_ssl => uri.scheme == 'https',open_timeout: 30,read_timeout: 30,verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
|
||||
r3 = login_reomote(http,root_url)
|
||||
r4 = get_website(uri,http,r3)
|
||||
uri2 = URI ("#{root_url}/admin/playground")
|
||||
|
@ -226,10 +229,8 @@ class Admin::RegisteredSitesController < OrbitAdminController
|
|||
if r5.code.to_s != '200'
|
||||
not_login_flag = true
|
||||
end
|
||||
puts '1'
|
||||
if !not_login_flag
|
||||
not_accept_flag = true
|
||||
puts '2'
|
||||
uri3 = URI ("#{root_url}/admin/playground/command")
|
||||
doc = Nokogiri::HTML(r5.body) rescue nil
|
||||
csrf_data = doc.search("meta[name='csrf-token']")[0].attributes['content'].value rescue nil
|
||||
|
@ -237,7 +238,6 @@ class Admin::RegisteredSitesController < OrbitAdminController
|
|||
count = 0
|
||||
flag = false
|
||||
res = JSON.parse(r6.body) rescue ''
|
||||
puts ['3',res.inspect]
|
||||
if (res == {"success"=>true} || r6.code.to_s != '200')
|
||||
not_accept_flag = false
|
||||
last_length = 0
|
||||
|
@ -320,29 +320,24 @@ class Admin::RegisteredSitesController < OrbitAdminController
|
|||
#log.save!
|
||||
end
|
||||
rescue => e
|
||||
not_accept_flag = true
|
||||
timeout_flag = true
|
||||
puts e
|
||||
end
|
||||
puts 'out'
|
||||
if not_accept_flag || not_login_flag
|
||||
log.status = 'failed'
|
||||
log.last_message = "can't login to admin"
|
||||
elsif !timeout_flag
|
||||
system('sleep 5')
|
||||
if sel_flag || site.is_alive?
|
||||
puts 'finish2'
|
||||
log.status = 'finish'
|
||||
else
|
||||
log.status = 'failed'
|
||||
end
|
||||
else
|
||||
puts 'timeout_flag'
|
||||
system('sleep 10')
|
||||
puts 'sleep finish'
|
||||
if site.is_alive?
|
||||
puts 'finish'
|
||||
log.status = 'finish'
|
||||
else
|
||||
puts 'failed'
|
||||
log.status = 'failed'
|
||||
#update_flags = UpdateFlags.first
|
||||
#update_flags.bundle_update_flag = false
|
||||
|
@ -393,6 +388,7 @@ class Admin::RegisteredSitesController < OrbitAdminController
|
|||
site = RegisteredSite.find(site_id) rescue nil
|
||||
if !site.nil? && (site.site_statuses.first.can_login rescue true)
|
||||
bundle_update_remote(site)
|
||||
system('sleep 5')
|
||||
elsif !site.nil?
|
||||
if site.bundle_update_logs.first.nil?
|
||||
log = site.bundle_update_logs.create()
|
||||
|
|
|
@ -60,7 +60,7 @@ class RegisteredSite
|
|||
urls = types.collect do |type|
|
||||
root_url = "#{type}://#{domain}"
|
||||
uri0 = URI(root_url)
|
||||
r = Net::HTTP.start(uri0.host, uri0.port,:use_ssl => uri0.scheme == 'https',open_timeout: 20,read_timeout: 20) do |http|
|
||||
r = Net::HTTP.start(uri0.host, uri0.port,:use_ssl => uri0.scheme == 'https',open_timeout: 20,read_timeout: 20,verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
|
||||
req = Net::HTTP::Get.new(uri0)
|
||||
req['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'
|
||||
http.request req
|
||||
|
|
|
@ -312,20 +312,25 @@ fail only
|
|||
var val = $(this).val()
|
||||
if (val=='show_all'){
|
||||
$('#detail_div').attr('class','show_ok show_fail')
|
||||
$('.table tr').show()
|
||||
}else if (val=='show_ok_only'){
|
||||
$('#detail_div').attr('class','show_ok')
|
||||
$('.table tr.success').show()
|
||||
$('.table tr.error').hide()
|
||||
}else{
|
||||
$('#detail_div').attr('class','show_fail')
|
||||
$('.table tr.success').hide()
|
||||
$('.table tr.error').show()
|
||||
}
|
||||
})
|
||||
$('th.s0 > input[type=checkbox]').change(function(){
|
||||
if ($(this).prop('checked')){
|
||||
$('td.s0 > input[type=checkbox]').prop('checked',true)
|
||||
$('td.s0 > input[type=checkbox]').parents('tr').addClass('idle')
|
||||
$('td:visible.s0 > input[type=checkbox]').prop('checked',true)
|
||||
$('td:visible.s0 > input[type=checkbox]').parents('tr').addClass('idle')
|
||||
}
|
||||
else{
|
||||
$('td.s0 > input[type=checkbox]').prop('checked',false)
|
||||
$('td.s0 > input[type=checkbox]').parents('tr').removeClass('idle')
|
||||
$('td:visible.s0 > input[type=checkbox]').prop('checked',false)
|
||||
$('td:visible.s0 > input[type=checkbox]').parents('tr').removeClass('idle')
|
||||
}
|
||||
})
|
||||
$('td.s0 > input[type=checkbox]').change(function(){
|
||||
|
|
Loading…
Reference in New Issue