pull/87/head
liuzheng712 2016-02-25 20:42:35 +08:00
parent 4f75f76db8
commit 9c93d5a8d2
4 changed files with 6 additions and 5 deletions

View File

@ -344,7 +344,7 @@ def download(request):
def exec_cmd(request):
role = request.GET.get('role')
check_assets = request.GET.get('check_assets', '')
web_terminal_uri = '%s/exec?role=%s' % (WEB_SOCKET_HOST, role)
web_terminal_uri = '/ws/exec?role=%s' % (role)
return my_render('exec_cmd.html', locals(), request)
@ -356,7 +356,8 @@ def web_terminal(request):
if asset:
print asset
hostname = asset.hostname
web_terminal_uri = '%s/ws/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
# web_terminal_uri = '%s/ws/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
web_terminal_uri = '/ws/terminal?id=%s&role=%s' % (asset_id, role_name)
return render_to_response('jlog/web_terminal.html', locals())

View File

@ -442,7 +442,7 @@ def main():
(r'/monitor', MonitorHandler),
(r'/ws/terminal', WebTerminalHandler),
(r'/kill', WebTerminalKillHandler),
(r'/exec', ExecHandler),
(r'/ws/exec', ExecHandler),
(r"/static/(.*)", tornado.web.StaticFileHandler,
dict(path=os.path.join(os.path.dirname(__file__), "static"))),
('.*', tornado.web.FallbackHandler, dict(fallback=container)),

View File

@ -29,7 +29,7 @@
protocol = 'wss://';
}
var wsUri = protocol + "{{ web_terminal_uri }}"; //请求的websocket url
var wsUri = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + "{{ web_terminal_uri }}"; //请求的websocket url
var ws = new WebSocket(wsUri);
function createSystemMessage(message) {

View File

@ -48,7 +48,7 @@
protocol = 'wss://';
}
var endpoint = protocol + '{{ web_terminal_uri }}';
var endpoint = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + '{{ web_terminal_uri }}';
if (window.WebSocket) {
this._connection = new WebSocket(endpoint);