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 += '
| '+ulist[i]+' | '+
'删除|' +
- '改密 |
';
+ '改密';
}
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 += '';
+ content += '';
+ content += '| 项目名 | ';
+ content += '操作 | ';
+ content += '
';
+
+ content += '';
+
+ ulist = rdata.data;
+ for (i in ulist){
+ content += '| '+ulist[i]+' | '+
+ '删除|' +
+ '改密 |
';
+ }
+
+ content += '';
+ content += '
';
+
+ 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: '\
+ \
+
\
+
\
+ \
+ \
+
\
+
',
+ cancel: function () {
+ term.destroy();
+ clearInterval(interval)
+ }
+ });
+ $(".shell_btn_close").click(function(){
+ layer.close(term_box);
+ term.destroy();
+ clearInterval(interval)
+ })
+
+ setTimeout(function () {
+ $('.terminal').detach().appendTo('#term');
+ $("#term").show();
+ socket.emit('webssh', "\n");
+ term.focus();
+
+ // 鼠标右键事件
+ var can = $("#term");
+ can.contextmenu(function (e) {
+ var winWidth = can.width();
+ var winHeight = can.height();
+ var mouseX = e.pageX;
+ var mouseY = e.pageY;
+ var menuWidth = $(".contextmenu").width();
+ var menuHeight = $(".contextmenu").height();
+ var minEdgeMargin = 10;
+ if (mouseX + menuWidth + minEdgeMargin >= winWidth &&
+ mouseY + menuHeight + minEdgeMargin >= winHeight) {
+ menuLeft = mouseX - menuWidth - minEdgeMargin + "px";
+ menuTop = mouseY - menuHeight - minEdgeMargin + "px";
+ }
+ else if (mouseX + menuWidth + minEdgeMargin >= winWidth) {
+ menuLeft = mouseX - menuWidth - minEdgeMargin + "px";
+ menuTop = mouseY + minEdgeMargin + "px";
+ }
+ else if (mouseY + menuHeight + minEdgeMargin >= winHeight) {
+ menuLeft = mouseX + minEdgeMargin + "px";
+ menuTop = mouseY - menuHeight - minEdgeMargin + "px";
+ }
+ else {
+ menuLeft = mouseX + minEdgeMargin + "px";
+ menuTop = mouseY + minEdgeMargin + "px";
+ };
+
+ var selectText = term.getSelection()
+ var style_str = '';
+ var paste_str = '';
+ if (!selectText) {
+ if (!getCookie('shell_copy_body')) {
+ paste_str = 'style="color: #bbb;" disable';
+ }
+ style_str = 'style="color: #bbb;" disable';
+ } else {
+ setCookie('ssh_selection', selectText);
+ }
+
+
+ var menudiv = '';
+ $("body").append(menudiv);
+ $(".contextmenu").css({
+ "left": menuLeft,
+ "top": menuTop
+ });
+ return false;
+ });
+ can.click(function () {
+ remove_ssh_menu();
+ });
+
+ clipboard = new ClipboardJS('.shell_copy_btn');
+ clipboard.on('success', function (e) {
+ layer.msg('复制成功!');
+ setCookie('shell_copy_body', e.text)
+ remove_ssh_menu();
+ term.focus();
+ });
+
+ clipboard.on('error', function (e) {
+ layer.msg('复制失败,浏览器不兼容!');
+ setCookie('shell_copy_body', e.text)
+ remove_ssh_menu();
+ term.focus();
+ });
+
+ $(".shellbutton").click(function () {
+ var tobj = $("textarea[name='ssh_copy']");
+ var ptext = tobj.val();
+ tobj.val('');
+ if ($(this).text().indexOf('Alt') != -1) {
+ ptext +="\n";
+ }
+ socket.emit('webssh', ptext);
+ term.focus();
+ })
+ $("textarea[name='ssh_copy']").keydown(function (e) {
+
+ if (e.ctrlKey && e.keyCode == 13) {
+ $(".shell_btn_1").click();
+ } else if (e.altKey && e.keyCode == 13) {
+ $(".shell_btn_1").click();
+ }
+ });
+
+ }, 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();
+ window.open('https://www.baidu.com/s?wd=' + selectText)
+ gterm.focus();
+}
+
+
+function shell_paste_text(){
+ socket.emit('webssh', getCookie('ssh_selection'));
+ remove_ssh_menu();
+ gterm.focus();
+}
+
+function remove_ssh_menu() {
+ $(".contextmenu").remove();
+}
\ No newline at end of file
diff --git a/scripts/install.sh b/scripts/install.sh
index 1c83f86d9..fe7c55ebe 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -26,6 +26,7 @@ mv /tmp/mdserver-web-master /www/server/mdserver-web
yum groupinstall -y "Development Tools"
yum -y libevent libevent-devel pcre-devel zlib-devel openssl openssl-devel
+yum -y libxml2 libxml2-devel
yum -y install epel-release python-pip python-devel
pip install --upgrade pip
diff --git a/templates/default/firewall.html b/templates/default/firewall.html
index 95b8ea857..501ed7f97 100755
--- a/templates/default/firewall.html
+++ b/templates/default/firewall.html
@@ -30,9 +30,9 @@
首页/系统安全
-
@@ -127,5 +127,5 @@
-
+
{% endblock %}
\ No newline at end of file