From 8855b7d907c874377a8743ebedfbfcdec2e345c9 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 10 Dec 2018 19:17:40 +0800 Subject: [PATCH] update --- plugins/csvn/index.html | 7 +- plugins/csvn/index.py | 16 ++- plugins/csvn/js/csvn.js | 60 +++++++++- plugins/webssh/index.html | 10 +- plugins/webssh/info.json | 10 +- plugins/webssh/install.sh | 27 ++--- plugins/webssh/js/webssh.js | 196 ++++++++++++++++++++++++++++++++ scripts/install.sh | 1 + templates/default/firewall.html | 6 +- 9 files changed, 303 insertions(+), 30 deletions(-) create mode 100755 plugins/webssh/js/webssh.js diff --git a/plugins/csvn/index.html b/plugins/csvn/index.html index 089507415..5bb8d5fa6 100755 --- a/plugins/csvn/index.html +++ b/plugins/csvn/index.html @@ -1,9 +1,10 @@
-

服务

-

自启动

-

用户管理

+

服务

+

自启动

+

用户管理

+

项目管理

diff --git a/plugins/csvn/index.py b/plugins/csvn/index.py index c3710fbe9..50ebf4719 100755 --- a/plugins/csvn/index.py +++ b/plugins/csvn/index.py @@ -150,6 +150,10 @@ def initdUinstall(): return 'ok' +def getAllUserList(): + pass + + def userList(): import math args = getArgs() @@ -176,15 +180,21 @@ def userList(): tmp = auth_list[x].split(':') ulist.append(tmp[0]) - data['list'] = public.getPage({'count': auth_list_sum, 'p': page}) + page_info = {'count': auth_list_sum, 'p': page, + 'row': 10, 'tojs': 'csvnUserList'} + data['list'] = public.getPage(page_info) data['page'] = page data['page_size'] = page_size data['page_count'] = int(math.ceil(auth_list_sum / page_size)) start = (page - 1) * page_size - data['data'] = ulist[start:page_size] + data['data'] = ulist[start:start + page_size] return public.getJson(data) + +def projectList(): + return [] + if __name__ == "__main__": func = sys.argv[1] if func == 'status': @@ -211,5 +221,7 @@ if __name__ == "__main__": print saveConf() elif func == 'user_list': print userList() + elif func == 'project_list': + print projectList() else: print 'fail' diff --git a/plugins/csvn/js/csvn.js b/plugins/csvn/js/csvn.js index 94b83bea7..7959f116e 100755 --- a/plugins/csvn/js/csvn.js +++ b/plugins/csvn/js/csvn.js @@ -20,7 +20,7 @@ function csvnUserList(page) { content = '
'; content += '
'; - content += '
'; + content += '
'; content += ''; content += ''; content += ''; @@ -32,7 +32,7 @@ function csvnUserList(page) { for (i in ulist){ content += ''; + '改密'; } content += ''; @@ -45,7 +45,61 @@ function csvnUserList(page) { content += page; $(".soft-man-con").html(content); + },'json'); +} - +function csvnDelUser(name){ + console.log(name); +} + +function csvnModPwdUser(name){ + console.log(name); +} + + +function csvnProjectList(page){ + var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); + _data = {}; + _data['page'] = page; + _data['page_size'] = 10; + $.post('/plugins/run', {name:'csvn', func:'project_list', args:JSON.stringify(_data)}, function(data) { + layer.close(loadT); + + if (!data.status){ + layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); + return; + } + + var rdata = $.parseJSON(data.data); + // console.log(rdata); + + content = '
'; + content += '
'; + + content += '
用户名操作
'+ulist[i]+''+ '删除|' + - '改密
'; + content += ''; + content += ''; + content += ''; + content += ''; + + content += ''; + + ulist = rdata.data; + for (i in ulist){ + content += ''; + } + + content += ''; + content += '
项目名操作
'+ulist[i]+''+ + '删除|' + + '改密
'; + + page = ''; + + content += page; + + $(".soft-man-con").html(content); },'json'); } \ No newline at end of file diff --git a/plugins/webssh/index.html b/plugins/webssh/index.html index e34eb9715..5f41875eb 100755 --- a/plugins/webssh/index.html +++ b/plugins/webssh/index.html @@ -1,6 +1,14 @@ + \ No newline at end of file diff --git a/plugins/webssh/info.json b/plugins/webssh/info.json index 77434167d..d5695b85c 100755 --- a/plugins/webssh/info.json +++ b/plugins/webssh/info.json @@ -6,10 +6,10 @@ "type":"扩展", "ps":"完整功能的SSH客户端,仅用于连接本服务器", "versions":"1.0", - "shell":"webssh.sh", - "checks":"/www/server/panel/plugin/webssh", - "author":"宝塔", - "home":"http://www.bt.cn/bbs", - "date":"2018-10-20", + "shell":"install.sh", + "checks":"server/webssh", + "author":"midoks", + "home":"", + "date":"2018-12-20", "pid":"4" } \ No newline at end of file diff --git a/plugins/webssh/install.sh b/plugins/webssh/install.sh index e88b3c5e7..15a0da24e 100755 --- a/plugins/webssh/install.sh +++ b/plugins/webssh/install.sh @@ -1,31 +1,32 @@ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -install_tmp='/tmp/bt_install.pl' -public_file=/www/server/panel/install/public.sh -if [ ! -f $public_file ];then - wget -O $public_file http://download.bt.cn/install/public.sh -T 5; -fi -. $public_file -download_Url=$NODE_URL + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + + +install_tmp=${rootPath}/tmp/bt_install.pl + Install_webssh() { - mkdir -p /www/server/panel/plugin/webssh echo '正在安装脚本文件...' > $install_tmp - wget -O /www/server/panel/plugin/webssh/index.html $download_Url/install/plugin/webssh/index.html -T 5 - wget -O /www/server/panel/plugin/webssh/info.json $download_Url/install/plugin/webssh/info.json -T 5 - wget -O /www/server/panel/plugin/webssh/icon.png $download_Url/install/plugin/webssh/icon.png -T 5 + mkdir -p $serverPath/webssh + echo '1.0' > $serverPath/webssh/version.pl echo '安装完成' > $install_tmp + } Uninstall_webssh() { - rm -rf /www/server/panel/plugin/webssh + rm -rf $serverPath/webssh + echo "卸载完成" > $install_tmp } - action=$1 if [ "${1}" == 'install' ];then Install_webssh diff --git a/plugins/webssh/js/webssh.js b/plugins/webssh/js/webssh.js new file mode 100755 index 000000000..883064e0a --- /dev/null +++ b/plugins/webssh/js/webssh.js @@ -0,0 +1,196 @@ +function web_shell() { + var termCols = 100; + var termRows = 29; + var sendTotal = 0; + 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); + + 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') { + setTimeout(function () { + layer.closeAll(); + }, 500); + } + }); + + if (socket) { + socket.emit('connect_event', ''); + interval = setInterval(function () { + socket.emit('connect_event', ''); + }, 1000); + } + + term.on('data', function (data) { + socket.emit('webssh', data); + }); + + + var term_box = layer.open({ + type: 1, + title: "宝塔终端", + area: ['920px','640px'], + closeBtn: 2, + shadeClose: false, + content: '
\ +
\ +