diff --git a/connect.py b/connect.py index 9f339205e..f180ba0f8 100644 --- a/connect.py +++ b/connect.py @@ -437,6 +437,7 @@ class SshTty(Tty): termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_tty) log_file_f.write('End time is %s' % datetime.datetime.now()) log_file_f.close() + log_time_f.close() log.is_finished = True log.end_time = datetime.datetime.now() log.save() diff --git a/jlog/log_api.py b/jlog/log_api.py index 5ef484777..6afbfdb0f 100644 --- a/jlog/log_api.py +++ b/jlog/log_api.py @@ -43,14 +43,16 @@ def scriptToJSON(scriptf, timing=None): scriptf.readline() # ignore first header line from script file offset = 0 for t in timing: - data = escapeString(scriptf.read(t[1])) + dt = scriptf.read(t[1]) + data = escapeString(dt) offset += t[0] ret.append((data, offset)) return dumps(ret) def renderTemplate(script_path, time_file_path, dimensions=(24, 80), templatename=DEFAULT_TEMPLATE): - with copen(script_path, encoding='utf-8', errors='replace') as scriptf: + #with copen(script_path, encoding='utf-8', errors='replace') as scriptf: + with open(script_path) as scriptf: with open(time_file_path) as timef: timing = getTiming(timef) json = scriptToJSON(scriptf, timing) diff --git a/jumpserver.conf b/jumpserver.conf index 41894e0d9..6297ab00a 100644 --- a/jumpserver.conf +++ b/jumpserver.conf @@ -13,7 +13,7 @@ password = mysql234 database = jumpserver [websocket] -web_socket_host = js:3000 +web_socket_host = j:3000 [mail] mail_enable = 1 diff --git a/run_websocket.py b/run_websocket.py index 168d50ba9..9250dd3a8 100644 --- a/run_websocket.py +++ b/run_websocket.py @@ -275,8 +275,11 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler): for t in WebTerminalHandler.tasks: if t.is_alive(): continue - t.setDaemon(True) - t.start() + try: + t.setDaemon(True) + t.start() + except RuntimeError: + pass def on_message(self, message): data = json.loads(message) @@ -309,6 +312,7 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler): self.log.is_finished = True self.log.end_time = datetime.datetime.now() self.log.save() + self.log_time_f.close() self.close() except AttributeError: pass diff --git a/templates/jasset/asset_list.html b/templates/jasset/asset_list.html index 28ab2523e..1dc6b5aab 100644 --- a/templates/jasset/asset_list.html +++ b/templates/jasset/asset_list.html @@ -182,8 +182,15 @@ success: function(data){ var dataArray = data.split(','); if (dataArray.length == 1 && data != 'error'){ - console.log('one'); - window.open(new_url + data, '', 'height=400, width=600, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'); + layer.open({ + type: 2, + title: 'Jumpserver Web Terminal', + maxmin: true, + shade: false, + area: ['628px', '452px'], + content: new_url + }); + //window.open(new_url + data, '', 'location=no, resizeable=no, height=410, width=625, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,status=no'); } else if (dataArray.length == '1' && data == 'error'){ layer.alert('没有授权角色') } else { @@ -194,6 +201,7 @@ layer.alert(aUrl, { skin: 'layui-layer-molv', title: '多个角色,请选择一个连接', + shade: false, closeBtn: 0 }) } @@ -205,7 +213,15 @@ function windowOpen(aTab){ var new_url = aTab.href; - window.open(new_url, '', 'height=400, width=600, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'); + layer.open({ + type: 2, + title: 'Jumpserver Web Terminal', + maxmin: true, + area: ['628px', '452px'], + shade: false, + content: new_url + }); + //window.open(new_url, '', 'height=410, width=625, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'); return false } @@ -224,7 +240,6 @@ border: [2, 0.3, '#1AB394'], shade: [0.5, '#000000'], shadeClose: true, - area : ['800px' , '600px'], content: url, cancel: function(){ location.replace(location.href); diff --git a/templates/jperm/perm_rule_add.html b/templates/jperm/perm_rule_add.html index 346d444a1..fb408cfc7 100644 --- a/templates/jperm/perm_rule_add.html +++ b/templates/jperm/perm_rule_add.html @@ -163,38 +163,6 @@ $('#ruleForm').validator({ }); -$(document).ready(function(){ - $("input.role").click(function(){ - if($("input.role[value=GA]").is( ":checked" )){ - $("#admin_groups").css("display", 'none'); - } - else { - - $("#admin_groups").css("display", 'block'); - } - }); - - $('#use_password').click(function(){ - if ($(this).is(':checked')){ - $('#admin_account_password').css('display', 'block') - } - else { - - $('#admin_account_password').css('display', 'none') - } - }); - - $('#use_publicKey').click(function(){ - if ($(this).is(':checked')){ - - $('#admin_account_publicKey').css('display', 'block') - } - else { - $('#admin_account_publicKey').css('display', 'none') - } - }); -}); - var config = { '.chosen-select' : {}, '.chosen-select-deselect' : {allow_single_deselect:true},