diff --git a/plugins/webssh/index.html b/plugins/webssh/index.html index a5a499950..a53f8768e 100755 --- a/plugins/webssh/index.html +++ b/plugins/webssh/index.html @@ -1,10 +1,9 @@ \ No newline at end of file diff --git a/plugins/webssh/index.py b/plugins/webssh/index.py new file mode 100755 index 000000000..9780ba8c3 --- /dev/null +++ b/plugins/webssh/index.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +import time +import random +import os +import json +import re +import sys + +sys.path.append(os.getcwd() + "/class/core") +import public + + +def status(): + return 'start' + +if __name__ == "__main__": + func = sys.argv[1] + if func == 'status': + print status() diff --git a/requirements.txt b/requirements.txt index f04dda72f..a9dda38d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ flask flask_session flask_socketio gunicorn -gevent gevent-websocket psutil pillow diff --git a/route/static/app/files.js b/route/static/app/files.js index 6d9880a0a..af4e52df7 100755 --- a/route/static/app/files.js +++ b/route/static/app/files.js @@ -459,7 +459,8 @@ function getFiles(Path) { BarTools += ' '; } setCookie('open_dir_path',rdata.PATH); - BarTools += ' '; + BarTools += ' \ + '; var copyName = getCookie('copyFileName'); var cutName = getCookie('cutFileName'); var isPaste = (copyName == 'null') ? cutName : copyName; @@ -970,59 +971,6 @@ function downloadFile(action){ } -//执行SHELL -function ExecShell(action){ - if(action == 1){ - var path = $("#DirPathPlace input").val(); - var exec = encodeURIComponent($("#mExec").val()); - $.post('/files?action=ExecShell','path='+path+'&shell='+exec,function(rdata){ - if(rdata.status){ - $("#mExec").val(''); - GetShellEcho(); - } else { - layer.msg(rdata.msg,{icon:rdata.status?1:2}); - } - - }); - return; - } - layer.open({ - type: 1, - shift: 5, - closeBtn: 2, - area: ['70%','600px'], - title: lan.files.shell_title, - content: '
\ -
\ -
\ - '+lan.files.shell_go+'\ -
\ -
' - }); - setTimeout(function(){ - outTimeGet(); - },1000); - -} - -var outTime = null; -//取SHELL输出 -function outTimeGet(){ - outTime = setInterval(function(){ - if(!$("#mExec").attr('name')){ - clearInterval(outTime); - return; - } - GetShellEcho(); - },1000); -} - -function GetShellEcho(){ - $.post('/files?action=GetExecShellMsg','',function(rdata){ - $("#Result").html(rdata); - $(".shellcode").scrollTop($(".shellcode")[0].scrollHeight); - }); -} //重命名 function ReName(type, fileName) { diff --git a/route/static/app/public.js b/route/static/app/public.js index f49081f26..68ca0ff39 100755 --- a/route/static/app/public.js +++ b/route/static/app/public.js @@ -1203,23 +1203,27 @@ function loadImage(){ var socket, gterm; function webShell() { - var termCols = 50; - var termRows = 12; + var termCols = 83; + var termRows = 21; var sendTotal = 0; - if(!socket){ - socket = io.connect(); - } + if(!socket)socket = io.connect(); var term = new Terminal({ cols: termCols, rows: termRows, screenKeys: true, useStyle: true}); + term.open(); - gterm = term term.setOption('cursorBlink', true); + term.setOption('fontSize', 10); + gterm = term socket.on('server_response', function (data) { term.write(data.data); - - if (data.data == '\r\n登出\r\n' || data.data == '登出\r\n' || data.data == '\r\nlogout\r\n' || data.data == 'logout\r\n') { + if (data.data == '\r\n登出\r\n' || + data.data == '登出\r\n' || + data.data == '\r\nlogout\r\n' || + data.data == 'logout\r\n') { setTimeout(function () { layer.closeAll(); + term.destroy(); + clearInterval(interval); }, 500); } }); @@ -1239,7 +1243,7 @@ function webShell() { var term_box = layer.open({ type: 1, title: "本地终端", - area: ['480px','300px'], + area: ['600px','400px'], closeBtn: 2, shadeClose: false, content: '
\ @@ -1252,13 +1256,13 @@ function webShell() { ', cancel: function () { term.destroy(); - clearInterval(interval) + clearInterval(interval); } }); $(".shell_btn_close").click(function(){ layer.close(term_box); term.destroy(); - clearInterval(interval) + clearInterval(interval); }) setTimeout(function () { @@ -1358,22 +1362,9 @@ function webShell() { } }); - }, 100) - - + }, 100); } -// function shell_translate_text() { -// remove_ssh_menu(); -// var selectText = getCookie('ssh_selection'); -// var loadT = layer.msg('正在翻译...', { icon: 16, time: 1000 * 60, }); -// $.get('https://www.bt.cn/api/index/fanyi', { query: selectText }, function (rdata) { -// layer.close(loadT); -// layer.msg("原文: " + rdata.src + '
译文: ' + rdata.dst, { time: 1000 * 10, shadeClose: true, shade: 0.01 }); -// }, 'JSONP'); -// gterm.focus(); -// } - function shell_to_baidu() { var selectText = getCookie('ssh_selection'); remove_ssh_menu(); @@ -1381,7 +1372,6 @@ function shell_to_baidu() { gterm.focus(); } - function shell_paste_text(){ socket.emit('webssh', getCookie('ssh_selection')); remove_ssh_menu();