From 9347797435874bc419ba225c15690999221b7319 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 3 Mar 2020 09:31:39 +0800 Subject: [PATCH] vnc --- app/controllers/games_controller.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index cfcf92e4c..7015cca40 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -963,7 +963,7 @@ class GamesController < ApplicationController begin shixun = game.myshixun.shixun shixun_tomcat = edu_setting('cloud_bridge') - #service_host = edu_setting('vnc_url') + service_host = edu_setting('vnc_url') tpiGitURL = "#{edu_setting('git_address_domain')}/#{game.myshixun.repo_path}" uri = "#{shixun_tomcat}/bridge/vnc/getvnc" @@ -973,14 +973,15 @@ class GamesController < ApplicationController if res && res['code'].to_i != 0 raise("实训云平台繁忙(繁忙等级:99)") end - @vnc_url = res['showServer'] - # if request.subdomain == "pre-newweb" || request.subdomain == "test-newweb" - # # 无域名版本 - # "http://#{service_host}:#{res['port']}/vnc_lite.html?password=headless" - # else - # # 有域名版本 - # "https://#{res['port']}.#{service_host}/vnc_lite.html?password=headless" - # end + # @vnc_url = res['showServer'] + @vnc_url = + if request.subdomain == "pre-newweb" || request.subdomain == "test-newweb" + # 无域名版本 + "http://#{service_host}:#{res['port']}/vnc_lite.html?password=headless" + else + # 有域名版本 + "https://#{res['port']}.#{service_host}/vnc_lite.html?password=headless" + end @vnc_evaluate = shixun.vnc_evaluate rescue Exception => e Rails.logger.error(e.message)