From 01d6f751b16ac2edeada4a0623ed3e6e8cc743ea Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 6 Nov 2015 10:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=AE=9E=E6=97=B6=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8term.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 4 +- templates/jlog/log_online.html | 73 ++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/connect.py b/connect.py index 945dcf30c..063708ad3 100644 --- a/connect.py +++ b/connect.py @@ -430,8 +430,8 @@ class Jtty(object): time.sleep(1) tmp = channel.recv(1024) #print 'ok'+tmp+'ok' - SSH_TTY = re.search(r'(?<=/dev/).*', tmp).group().strip() - + # SSH_TTY = re.search(r'(?<=/dev/).*', tmp).group().strip() + SSH_TTY = '' channel.send('clear\n') # Make ssh interactive tunnel self.posix_shell(ssh) diff --git a/templates/jlog/log_online.html b/templates/jlog/log_online.html index f2eacb9d6..23ee55647 100644 --- a/templates/jlog/log_online.html +++ b/templates/jlog/log_online.html @@ -1,7 +1,21 @@ {% extends 'base.html' %} -{% block content %} -{% include 'nav_cat_bar.html' %} - + + + +{% endblock %} +{% block content %} +{% include 'nav_cat_bar.html' %}
@@ -104,8 +123,6 @@ {# window.open('/jlog/monitor/', '监控', 'height=500, width=910, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');#} {# })#} {# });#} - - function init(obj){ var file_path = obj.attr('file_path'); var wsUri = '{{ web_monitor_uri }}'; @@ -121,31 +138,27 @@ var username = obj.closest('tr').find('#username').text(); var ip = obj.closest('tr').find('#ip').text(); - BootstrapDialog.show({message: function(){ - var tag = $('
');
-{#            document.cookie.split('; ').forEach(function(obj){#}
-{#                var info = obj.split('=');#}
-{#                if(info.length == 2 ){#}
-{#                    if(info[0] == 'username'){#}
-{#                        username = info[1];#}
-{#                    }else if(info[0] == 'seed'){#}
-{#                        seed = info[1];#}
-{#                    }#}
-{#                }#}
-{#            });#}
 
+
+        BootstrapDialog.show({message: function(){
             //服务器端认证
 {#            socket.send('login', {userid:message.id, filename:message.filename,username:username,seed:seed});#}
-            socket.onmessage = function(evt){
-                var control_regx =  /\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]/g;
-                var newline_regx = /\n|\r|(\r\n)|(\u0085)|(\u2028)|(\u2029)/g;
-{#                if (option == 'new') {#}
-                tag.append(evt.data.replace(newline_regx, '
').replace(control_regx, '')); -{# } else if (option == 'exist') {#} -{# tag.append('
' + exsit_message + '
');#} -{# }#} - tag.animate({ scrollTop: tag[0].scrollHeight}, 1); - }; + var term = new Terminal({ + cols: 80, + rows: 24, + screenKeys: false + }); + var tag = $('
'); + term.open(); + term.resize(80, 24); + + window.setTimeout(function(){ + $('.terminal').detach().appendTo('#term'); + socket.onmessage = function(evt){ + term.write(evt.data); + }}, 1000); + + tag[0].style.color = "#00FF00"; return tag[0]; @@ -158,7 +171,7 @@ $(document).ready(function(){ $('.monitor').click(function(){ - init($(this)) + init($(this)); }); $('.log_command').on('click',function(){