From cd82186019a6eb76790d38ccf6b6b61057bee911 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 5 Nov 2018 19:05:33 +0800 Subject: [PATCH] u --- class/public.py | 31 ++- plugins/redis/ico.png | Bin 0 -> 1686 bytes plugins/redis/index.html | 550 +++++++++++++++++++++++++++++++++++++++ plugins/redis/info.json | 19 ++ plugins/redis/install.sh | 36 +++ plugins/score/install.sh | 2 +- route/plugins.py | 3 +- route/task.py | 6 + scripts/GetOS.sh | 26 ++ 9 files changed, 668 insertions(+), 5 deletions(-) create mode 100755 plugins/redis/ico.png create mode 100755 plugins/redis/index.html create mode 100755 plugins/redis/info.json create mode 100755 plugins/redis/install.sh create mode 100755 scripts/GetOS.sh diff --git a/class/public.py b/class/public.py index ad9e8c57b..4e89186cb 100755 --- a/class/public.py +++ b/class/public.py @@ -17,7 +17,6 @@ sys.path.append(os.getcwd() + "/class/") import db from random import Random -# from flask import jsonify def getRunDir(): @@ -35,6 +34,32 @@ def M(table): return sql.table(table) +def getWebPage(data, args): + # 取分页 + import page + # 实例化分页类 + page = page.Page() + info = {} + info['count'] = len(data) + + info['row'] = 10 + if hasattr(args, 'row'): + info['row'] = args['row'] + + info['p'] = 1 + if hasattr(args, 'p'): + info['p'] = int(get['p']) + info['uri'] = {} + info['return_js'] = '' + if hasattr(args, 'tojs'): + info['return_js'] = args.tojs + + # 获取分页数据 + result = {} + result['page'] = page.GetPage(info) + return result + + def md5(str): # 生成MD5 try: @@ -195,7 +220,7 @@ def httpGet(url, timeout=30): response = urllib2.urlopen(url, timeout=timeout) return response.read() except Exception, ex: - #WriteLog('网络诊断',str(ex) + '['+url+']'); + # WriteLog('网络诊断',str(ex) + '['+url+']'); return str(ex) @@ -214,7 +239,7 @@ def httpPost(url, data, timeout=30): response = urllib2.urlopen(req, timeout=timeout) return response.read() except Exception, ex: - #WriteLog('网络诊断',str(ex) + '['+url+']'); + # WriteLog('网络诊断',str(ex) + '['+url+']'); return str(ex) diff --git a/plugins/redis/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3y*nPIaId8g`v>*24n z9Bp&DJ6rRy=Qi6NPVM#0gtm4L6-u8?-%_2gc3M4%gxb3pL^VLQ7oTrt+t#MrP)t&? z%ge*#EM2$z5`O-xj>VDUP;!59m600z{9LWEHe+)pn`~`nIJa5nRsB?{uq2l8wAUzv zzMkEdkneVDk7V;Md(ZHl_i&viLDW2^!MVG#!~FYIb(Q>aJpSfsn!ITlNfiUl|0#wl z?3=Qyit#-z6Nrq6V8Vz?c1Z$1?We4$XH`Nk3O7CAIwvsq#a{OUCf@4c+Qa@iRC^a& ptw!@@@-=*IHGWk}Xy-e+>3wG<)@uLsDR7M-WG8pWTGHY4zX8OGE585$ literal 0 HcmV?d00001 diff --git a/plugins/redis/index.html b/plugins/redis/index.html new file mode 100755 index 000000000..cf0b57f1b --- /dev/null +++ b/plugins/redis/index.html @@ -0,0 +1,550 @@ + + + +
+
+
+

密钥

+

面板设置

+

面板登录日志

+

SSH设置

+

SSH日志管理

+
+
+
+

+ 密钥: + +

+ +
    +
  • 宝塔企业运维后台连接您的服务器需要此密钥,请妥善记录并保存
  • +
  • 一但密钥丢失,可能导致您无法登录服务器
  • +
+
+ + + + +
+
+
+ \ No newline at end of file diff --git a/plugins/redis/info.json b/plugins/redis/info.json new file mode 100755 index 000000000..9fc21b4fe --- /dev/null +++ b/plugins/redis/info.json @@ -0,0 +1,19 @@ +{ + "sort": 7, + "ps": "最流行的SVN代码共享管理软件", + "shell": "install.sh", + "name": "redis", + "title": "Redis", + "default": false, + "versions":[ + {"status":false,"version":"1.0"} + ], + "tip": "soft", + "checks": "/www/server/php/VERSION/bin/php", + "display": 1, + "author": "Zend", + "date": "2017-04-01", + "home": "https://www.collab.net", + "type": "语言解释器", + "pid": "2" +} \ No newline at end of file diff --git a/plugins/redis/install.sh b/plugins/redis/install.sh new file mode 100755 index 000000000..c5c00a834 --- /dev/null +++ b/plugins/redis/install.sh @@ -0,0 +1,36 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") + + +install_tmp=${rootPath}/tmp/bt_install.pl + +echo "Install_csvn" + +mkdir -p $serverPath/redis + +Install_csvn() +{ + echo '正在安装脚本文件...' > $install_tmp + + echo '安装完成' > $install_tmp + +} + +Uninstall_csvn() +{ + echo "Uninstall_csvn" +} + + +action=$1 +if [ "${1}" == 'install' ];then + Install_csvn +else + Uninstall_csvn +fi diff --git a/plugins/score/install.sh b/plugins/score/install.sh index c69f4a349..716fa80ea 100755 --- a/plugins/score/install.sh +++ b/plugins/score/install.sh @@ -6,7 +6,7 @@ curPath=`pwd` rootPath=$(dirname "$curPath") rootPath=$(dirname "$rootPath") -install_tmp=${rootPath}'/tmp/bt_install.pl' +install_tmp=${rootPath}/tmp/bt_install.pl Install_score() { diff --git a/route/plugins.py b/route/plugins.py index 067a5e444..cd25253cf 100644 --- a/route/plugins.py +++ b/route/plugins.py @@ -68,7 +68,8 @@ def list(): pass ret['data'] = plugins_info - ret['list'] = get_page(plugins_info, request.args) + # request.args['row'] = __row_num + ret['list'] = public.getWebPage(plugins_info, request.args) return jsonify(ret) diff --git a/route/task.py b/route/task.py index 831741e7a..f59537db2 100644 --- a/route/task.py +++ b/route/task.py @@ -20,3 +20,9 @@ def index(): def count(): c = public.M('tasks').where("status!=?", ('1',)).count() return str(c) + + +@task.route("/list") +def list(): + c = public.M('tasks').where("status!=?", ('1',)).count() + return str(c) diff --git a/scripts/GetOS.sh b/scripts/GetOS.sh new file mode 100755 index 000000000..9b93a3a74 --- /dev/null +++ b/scripts/GetOS.sh @@ -0,0 +1,26 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH +if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then + OSNAME='CentOS' +elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then + OSNAME='RHEL' +elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then + OSNAME='Aliyun' +elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then + OSNAME='Fedora' +elif grep -Eqi "Amazon Linux AMI" /etc/issue || grep -Eq "Amazon Linux AMI" /etc/*-release; then + OSNAME='Amazon' +elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then + OSNAME='Debian' +elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then + OSNAME='Ubuntu' +elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then + OSNAME='Raspbian' +elif grep -Eqi "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then + OSNAME='Deepin' +else + OSNAME='unknow' +fi + +echo "$OSNAME" > /www/server/panel/data/osname.pl \ No newline at end of file