mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
u
This commit is contained in:
Executable
+139
@@ -0,0 +1,139 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
import psutil
|
||||||
|
import time
|
||||||
|
import os
|
||||||
|
import public
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
class plugin:
|
||||||
|
__tasks = None
|
||||||
|
__plugin_dir = "plugins"
|
||||||
|
__type = "data/type.json"
|
||||||
|
setupPath = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.setupPath = 'server'
|
||||||
|
|
||||||
|
# 进程是否存在
|
||||||
|
def processExists(self, pname, exe=None):
|
||||||
|
try:
|
||||||
|
if not self.pids:
|
||||||
|
self.pids = psutil.pids()
|
||||||
|
for pid in self.pids:
|
||||||
|
try:
|
||||||
|
p = psutil.Process(pid)
|
||||||
|
if p.name() == pname:
|
||||||
|
if not exe:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
if p.exe() == exe:
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return False
|
||||||
|
except:
|
||||||
|
return True
|
||||||
|
|
||||||
|
# 检查是否正在安装
|
||||||
|
def checkSetupTask(self, sName):
|
||||||
|
if not self.__tasks:
|
||||||
|
self.__tasks = public.M('tasks').where(
|
||||||
|
"status!=?", ('1',)).field('status,name').select()
|
||||||
|
if sName.find('php-') != -1:
|
||||||
|
tmp = sName.split('-')
|
||||||
|
sName = tmp[0]
|
||||||
|
version = tmp[1]
|
||||||
|
isTask = '1'
|
||||||
|
for task in self.__tasks:
|
||||||
|
tmpt = public.getStrBetween('[', ']', task['name'])
|
||||||
|
if not tmpt:
|
||||||
|
continue
|
||||||
|
tmp1 = tmpt.split('-')
|
||||||
|
name1 = tmp1[0].lower()
|
||||||
|
if sName == 'php':
|
||||||
|
if name1 == sName and tmp1[1] == version:
|
||||||
|
isTask = task['status']
|
||||||
|
else:
|
||||||
|
if name1 == 'pure':
|
||||||
|
name1 = 'pure-ftpd'
|
||||||
|
if name1 == sName:
|
||||||
|
isTask = task['status']
|
||||||
|
return isTask
|
||||||
|
|
||||||
|
def checkStatus(self, info):
|
||||||
|
pass
|
||||||
|
|
||||||
|
# 构造本地插件信息
|
||||||
|
def getPluginInfo(self, info):
|
||||||
|
print info["checks"]
|
||||||
|
|
||||||
|
checks = ""
|
||||||
|
if info["checks"][0:1] == "/":
|
||||||
|
checks = info["checks"]
|
||||||
|
else:
|
||||||
|
checks = public.getRootDir() + "/" + info['checks']
|
||||||
|
|
||||||
|
pluginInfo = {
|
||||||
|
"id": 10000,
|
||||||
|
"pid": info['pid'],
|
||||||
|
"type": 1000,
|
||||||
|
"name": info['name'],
|
||||||
|
"title": info['title'],
|
||||||
|
"ps": info['ps'],
|
||||||
|
"dependnet": "",
|
||||||
|
"mutex": "",
|
||||||
|
"install_checks": checks,
|
||||||
|
"uninsatll_checks": checks,
|
||||||
|
"versions": info['versions'],
|
||||||
|
# "updates": info['updates'],
|
||||||
|
"setup": False,
|
||||||
|
"status": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
pluginInfo['task'] = self.checkSetupTask(pluginInfo['name'])
|
||||||
|
pluginInfo['setup'] = os.path.exists(pluginInfo['install_checks'])
|
||||||
|
pluginInfo['status'] = os.path.exists(pluginInfo['install_checks'])
|
||||||
|
return pluginInfo
|
||||||
|
|
||||||
|
def getPluginList(self, sType, sPage=1, sPageSize=15):
|
||||||
|
|
||||||
|
ret = {}
|
||||||
|
ret['type'] = json.loads(public.readFile(self.__type))
|
||||||
|
plugins_info = []
|
||||||
|
for dirinfo in os.listdir(self.__plugin_dir):
|
||||||
|
path = self.__plugin_dir + '/' + dirinfo
|
||||||
|
if os.path.isdir(path):
|
||||||
|
jsonFile = path + '/info.json'
|
||||||
|
if os.path.exists(jsonFile):
|
||||||
|
try:
|
||||||
|
tmp = json.loads(public.readFile(jsonFile))
|
||||||
|
if tmp['name'] == 'php':
|
||||||
|
for v in tmp['versions']:
|
||||||
|
pg = self.getPluginInfo(tmp)
|
||||||
|
pg['versions'] = v
|
||||||
|
# print "sss:", i, v
|
||||||
|
# pg['updates'] = tmp["updates"][v]
|
||||||
|
if sType == "0":
|
||||||
|
plugins_info.append(pg)
|
||||||
|
else:
|
||||||
|
if pg['pid'] == sType:
|
||||||
|
plugins_info.append(pg)
|
||||||
|
else:
|
||||||
|
pg = self.getPluginInfo(tmp)
|
||||||
|
if sType == "0":
|
||||||
|
plugins_info.append(pg)
|
||||||
|
else:
|
||||||
|
if pg['pid'] == sType:
|
||||||
|
plugins_info.append(pg)
|
||||||
|
except BaseException, e:
|
||||||
|
print e
|
||||||
|
args = {}
|
||||||
|
args['count'] = len(plugins_info)
|
||||||
|
args['p1'] = sPage
|
||||||
|
|
||||||
|
ret['data'] = plugins_info
|
||||||
|
ret['list'] = public.getPage(args)
|
||||||
|
return ret
|
||||||
@@ -5,8 +5,9 @@
|
|||||||
"name": "csvn",
|
"name": "csvn",
|
||||||
"title": "CSVN",
|
"title": "CSVN",
|
||||||
"versions": ["5.1"],
|
"versions": ["5.1"],
|
||||||
|
"updates":["5.1.4"],
|
||||||
"tip": "soft",
|
"tip": "soft",
|
||||||
"checks": "server/csvn/VERSION/",
|
"checks": "server/csvn",
|
||||||
"author": "midoks",
|
"author": "midoks",
|
||||||
"date": "2017-04-01",
|
"date": "2017-04-01",
|
||||||
"home": "https://www.collab.net",
|
"home": "https://www.collab.net",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
"type":"运行环境",
|
"type":"运行环境",
|
||||||
"ps":"MySQL是一种关系数据库管理系统!",
|
"ps":"MySQL是一种关系数据库管理系统!",
|
||||||
"versions":["5.5"],
|
"versions":["5.5"],
|
||||||
|
"updates":["5.5"],
|
||||||
"shell":"install.sh",
|
"shell":"install.sh",
|
||||||
"checks":"/www/server/panel/plugin/safelogin",
|
"checks":"/www/server/panel/plugin/safelogin",
|
||||||
"author":"midoks",
|
"author":"midoks",
|
||||||
|
|||||||
@@ -8,8 +8,9 @@
|
|||||||
"checks":"server/nginx",
|
"checks":"server/nginx",
|
||||||
"author":"伊戈尔·赛索耶夫",
|
"author":"伊戈尔·赛索耶夫",
|
||||||
"home":"https://www.nginx.org",
|
"home":"https://www.nginx.org",
|
||||||
"path": "server/nginx",
|
"checks": "server/nginx",
|
||||||
"date":"2017-11-24",
|
"date":"2017-11-24",
|
||||||
"pid": "1",
|
"pid": "1",
|
||||||
"versions": ["1.14.0", "1.12.2", "1.8.1", "1.15.3", "-Tengine2.2.2", "openresty"]
|
"versions": ["1.14.0", "1.12.2", "1.8.1", "1.15.3", "-Tengine2.2.2", "openresty"],
|
||||||
|
"updates": ["1.14.0", "1.12.2", "1.8.1", "1.15.3", "-Tengine2.2.2", "openresty"]
|
||||||
}
|
}
|
||||||
+3
-77
@@ -5,8 +5,8 @@
|
|||||||
"name": "php",
|
"name": "php",
|
||||||
"title": "PHP",
|
"title": "PHP",
|
||||||
"default": false,
|
"default": false,
|
||||||
"versions": "5.2,5.3,5.4,5.5,5.6,7.0,7.1,7.2",
|
"versions": ["5.2","5.3","5.4","5.5","5.6","7.0","7.1","7.2"],
|
||||||
"update": "5.2.17p1,5.3.29,5.4.45,5.5.38,5.6.32,7.0.26,7.1.12,7.2.0",
|
"updates": ["5.2.17p1","5.3.29","5.4.45","5.5.38","5.6.32","7.0.26","7.1.12","7.2.0"],
|
||||||
"tip": "soft",
|
"tip": "soft",
|
||||||
"checks": "/www/server/php/VERSION/bin/php",
|
"checks": "/www/server/php/VERSION/bin/php",
|
||||||
"display": 1,
|
"display": 1,
|
||||||
@@ -14,79 +14,5 @@
|
|||||||
"date": "2017-04-01",
|
"date": "2017-04-01",
|
||||||
"home": "https://www.php.net",
|
"home": "https://www.php.net",
|
||||||
"type": "语言解释器",
|
"type": "语言解释器",
|
||||||
"pid": "1",
|
"pid": "1"
|
||||||
"versions": [
|
|
||||||
{
|
|
||||||
"status": false,
|
|
||||||
"version": "5.2",
|
|
||||||
"no": "",
|
|
||||||
"task": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"status": false,
|
|
||||||
"version": "5.3",
|
|
||||||
"no": "",
|
|
||||||
"task": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"status": true,
|
|
||||||
"task": "1",
|
|
||||||
"run": true,
|
|
||||||
"no": "5.4.45",
|
|
||||||
"fpm": true,
|
|
||||||
"max": "50",
|
|
||||||
"version": "5.4",
|
|
||||||
"pathinfo": true,
|
|
||||||
"maxTime": "100",
|
|
||||||
"display": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"status": false,
|
|
||||||
"version": "5.5",
|
|
||||||
"no": "",
|
|
||||||
"task": "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"status": true,
|
|
||||||
"task": "1",
|
|
||||||
"run": true,
|
|
||||||
"no": "5.6.30",
|
|
||||||
"fpm": true,
|
|
||||||
"max": "50",
|
|
||||||
"version": "5.6",
|
|
||||||
"pathinfo": true,
|
|
||||||
"maxTime": "100",
|
|
||||||
"display": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"status": true,
|
|
||||||
"task": "1",
|
|
||||||
"run": true,
|
|
||||||
"no": "7.0.19",
|
|
||||||
"fpm": true,
|
|
||||||
"max": "50",
|
|
||||||
"version": "7.0",
|
|
||||||
"pathinfo": true,
|
|
||||||
"maxTime": "100",
|
|
||||||
"display": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"status": true,
|
|
||||||
"task": "1",
|
|
||||||
"run": true,
|
|
||||||
"no": "7.1.5",
|
|
||||||
"fpm": true,
|
|
||||||
"max": "50",
|
|
||||||
"version": "7.1",
|
|
||||||
"pathinfo": true,
|
|
||||||
"maxTime": "100",
|
|
||||||
"display": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"status": false,
|
|
||||||
"version": "7.2",
|
|
||||||
"no": "",
|
|
||||||
"task": "1"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
"shell": "install.sh",
|
"shell": "install.sh",
|
||||||
"default": false,
|
"default": false,
|
||||||
"versions":["4.0"],
|
"versions":["4.0"],
|
||||||
|
"updates":["4.0.11"],
|
||||||
"tip": "soft",
|
"tip": "soft",
|
||||||
"checks": "server/redis",
|
"checks": "server/redis",
|
||||||
"display": 1,
|
"display": 1,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Install_redis()
|
|||||||
|
|
||||||
echo '安装完成' > $install_tmp
|
echo '安装完成' > $install_tmp
|
||||||
|
|
||||||
# rm -rf $serverPath/tmp
|
rm -rf $serverPath/tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
Uninstall_redis()
|
Uninstall_redis()
|
||||||
|
|||||||
+4
-34
@@ -12,6 +12,7 @@ import json
|
|||||||
|
|
||||||
sys.path.append("class/core")
|
sys.path.append("class/core")
|
||||||
import public
|
import public
|
||||||
|
import plugin
|
||||||
|
|
||||||
|
|
||||||
plugins = Blueprint('plugins', __name__, template_folder='templates')
|
plugins = Blueprint('plugins', __name__, template_folder='templates')
|
||||||
@@ -39,40 +40,9 @@ def file():
|
|||||||
|
|
||||||
@plugins.route("/list", methods=['GET', 'POST'])
|
@plugins.route("/list", methods=['GET', 'POST'])
|
||||||
def list():
|
def list():
|
||||||
|
typeVal = request.args.get('type', '0')
|
||||||
data = json.loads(public.readFile("data/type.json"))
|
data = plugin.plugin().getPluginList(typeVal, 1)
|
||||||
ret = {}
|
return public.getJson(data)
|
||||||
ret["type"] = data
|
|
||||||
|
|
||||||
plugins_info = []
|
|
||||||
|
|
||||||
typeVal = request.args.get('type', '')
|
|
||||||
if typeVal == "":
|
|
||||||
typeVal = "0"
|
|
||||||
|
|
||||||
for dirinfo in os.listdir(__plugin_name):
|
|
||||||
path = __plugin_name + "/" + dirinfo
|
|
||||||
if os.path.isdir(path):
|
|
||||||
jsonFile = path + "/info.json"
|
|
||||||
if os.path.exists(jsonFile):
|
|
||||||
try:
|
|
||||||
tmp = json.loads(public.readFile(jsonFile))
|
|
||||||
if typeVal == "0":
|
|
||||||
plugins_info.append(tmp)
|
|
||||||
else:
|
|
||||||
if tmp['pid'] == typeVal:
|
|
||||||
plugins_info.append(tmp)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
ret['data'] = plugins_info
|
|
||||||
|
|
||||||
args = {}
|
|
||||||
args['count'] = len(plugins_info)
|
|
||||||
args['p1'] = 1
|
|
||||||
|
|
||||||
ret['list'] = public.getPage(args)
|
|
||||||
return jsonify(ret)
|
|
||||||
|
|
||||||
|
|
||||||
@plugins.route('/install', methods=['POST'])
|
@plugins.route('/install', methods=['POST'])
|
||||||
|
|||||||
+40
-35
@@ -1784,6 +1784,7 @@ function GetSList(isdisplay) {
|
|||||||
|
|
||||||
$(".task").text(rdata.data[rdata.length - 1]);
|
$(".task").text(rdata.data[rdata.length - 1]);
|
||||||
for (var i = 0; i < rdata.data.length; i++) {
|
for (var i = 0; i < rdata.data.length; i++) {
|
||||||
|
var plugin = rdata.data[i];
|
||||||
var len = rdata.data[i].versions.length;
|
var len = rdata.data[i].versions.length;
|
||||||
var version_info = '';
|
var version_info = '';
|
||||||
var version = '';
|
var version = '';
|
||||||
@@ -1793,50 +1794,54 @@ function GetSList(isdisplay) {
|
|||||||
var indexshow = '';
|
var indexshow = '';
|
||||||
var checked = '';
|
var checked = '';
|
||||||
|
|
||||||
checked = rdata.data[i].display ? 'checked' : '';
|
checked = plugin.display ? 'checked' : '';
|
||||||
|
|
||||||
if (typeof rdata.data[i].versions == "string"){
|
if (typeof plugin.versions == "string"){
|
||||||
version_info += rdata.data[i].versions + '|';
|
version_info += plugin.versions + '|';
|
||||||
} else {
|
} else {
|
||||||
for (var j = 0; j < len; j++) {
|
for (var j = 0; j < len; j++) {
|
||||||
version_info += rdata.data[i].versions[j] + '|';
|
version_info += plugin.versions[j] + '|';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (version_info != '') {
|
if (version_info != '') {
|
||||||
version_info = version_info.substring(0, version_info.length - 1);
|
version_info = version_info.substring(0, version_info.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var handle = '<a class="btlink" onclick="AddVersion(\'' + rdata.data[i].name + '\',\'' + version_info + '\',\'' + rdata.data[i].tip + '\',this,\'' + rdata.data[i].title + '\')">' + lan.soft.install + '</a>';
|
var handle = '<a class="btlink" onclick="AddVersion(\'' + plugin.name + '\',\'' + version_info + '\',\'' + plugin.tip + '\',this,\'' + plugin.title + '\')">安装</a>';
|
||||||
var isSetup = false;
|
var isSetup = false;
|
||||||
if (rdata.data[i].name != 'php') {
|
|
||||||
|
if (plugin.name != 'php') {
|
||||||
for (var n = 0; n < len; n++) {
|
for (var n = 0; n < len; n++) {
|
||||||
if (rdata.data[i].versions[n].status == true) {
|
if (plugin.status == true) {
|
||||||
isSetup = true;
|
isSetup = true;
|
||||||
if (rdata.data[i].tip == 'lib') {
|
if (plugin.tip == 'lib') {
|
||||||
var mupdate = (rdata.data[i].versions[n].no == rdata.data[i].versions[n].version) ? '' : '<a class="btlink" onclick="SoftUpdate(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\',\'' + rdata.data[i].versions[n].version + '\')">更新</a> | ';
|
var mupdate = (plugin.versions[n].no == plugin.versions[n].version) ? '' : '<a class="btlink" onclick="SoftUpdate(\'' + plugin.name + '\',\'' + plugin.versions[n].version + '\',\'' + plugin.versions[n].version + '\')">更新</a> | ';
|
||||||
handle = mupdate + '<a class="btlink" onclick="PluginMan(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].title + '\')">' + lan.soft.setup + '</a> | <a class="btlink" onclick="UninstallVersion(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\',\'' + rdata.data[i].title + '\')">' + lan.soft.uninstall + '</a>';
|
handle = mupdate + '<a class="btlink" onclick="PluginMan(\'' + plugin.name + '\',\'' + plugin.title + '\')">' + lan.soft.setup + '</a> | <a class="btlink" onclick="UninstallVersion(\'' + plugin.name + '\',\'' + plugin.versions[n].version + '\',\'' + plugin.title + '\')">卸载</a>';
|
||||||
titleClick = 'onclick="PluginMan(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].title + '\')" style="cursor:pointer"';
|
titleClick = 'onclick="PluginMan(\'' + plugin.name + '\',\'' + plugin.title + '\')" style="cursor:pointer"';
|
||||||
} else {
|
} else {
|
||||||
var mupdate = (rdata.data[i].versions[n].no == rdata.data[i].update[n]) ? '' : '<a class="btlink" onclick="SoftUpdate(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\',\'' + rdata.data[i].update[n] + '\')">更新</a> | ';
|
console.log(plugin, n);
|
||||||
if (rdata.data[i].versions[n].no == '') mupdate = '';
|
|
||||||
handle = mupdate + '<a class="btlink" onclick="SoftMan(\'' + rdata.data[i].name + '\',\'' + version_info + '\')">' + lan.soft.setup + '</a> | <a class="btlink" onclick="UninstallVersion(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\',\'' + rdata.data[i].title + '\')">' + lan.soft.uninstall + '</a>';
|
|
||||||
titleClick = 'onclick="SoftMan(\'' + rdata.data[i].name + '\',\'' + version_info + '\')" style="cursor:pointer"';
|
var mupdate = '';//(plugin.versions[n] == plugin.updates[n]) '' : '<a class="btlink" onclick="SoftUpdate(\'' + plugin.name + '\',\'' + plugin.versions[n].version + '\',\'' + plugin.updates[n] + '\')">更新</a> | ';
|
||||||
|
if (plugin.versions[n] == '') mupdate = '';
|
||||||
|
handle = mupdate + '<a class="btlink" onclick="SoftMan(\'' + plugin.name + '\',\'' + version_info + '\')">' + lan.soft.setup + '</a> | <a class="btlink" onclick="UninstallVersion(\'' + plugin.name + '\',\'' + plugin.versions[n].version + '\',\'' + plugin.title + '\')">卸载</a>';
|
||||||
|
titleClick = 'onclick="SoftMan(\'' + plugin.name + '\',\'' + version_info + '\')" style="cursor:pointer"';
|
||||||
}
|
}
|
||||||
|
|
||||||
version = rdata.data[i].versions[n].version;
|
version = plugin.version;
|
||||||
softPath = '<span class="glyphicon glyphicon-folder-open" title="' + rdata.data[i].path + '" onclick="openPath(\'' + rdata.data[i].path + '\')"></span>';
|
softPath = '<span class="glyphicon glyphicon-folder-open" title="' + rdata.data[i].path + '" onclick="openPath(\'' + rdata.data[i].path + '\')"></span>';
|
||||||
indexshow = '<div class="index-item"><input class="btswitch btswitch-ios" id="index_' + rdata.data[i].name + '" type="checkbox" ' + checked + '><label class="btswitch-btn" for="index_' + rdata.data[i].name + '" onclick="toIndexDisplay(\'' + rdata.data[i].name + '\',\'' + version + '\')"></label></div>';
|
indexshow = '<div class="index-item"><input class="btswitch btswitch-ios" id="index_' + rdata.data[i].name + '" type="checkbox" ' + checked + '><label class="btswitch-btn" for="index_' + plugin.name + '" onclick="toIndexDisplay(\'' + plugin.name + '\',\'' + version + '\')"></label></div>';
|
||||||
if (rdata.data[i].versions[n].run == true) {
|
if (rdata.data[i].versions[n].run == true) {
|
||||||
state = '<span style="color:#20a53a" class="glyphicon glyphicon-play"></span>'
|
state = '<span style="color:#20a53a" class="glyphicon glyphicon-play"></span>'
|
||||||
} else {
|
} else {
|
||||||
state = '<span style="color:red" class="glyphicon glyphicon-pause"></span>'
|
state = '<span style="color:red" class="glyphicon glyphicon-pause"></span>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var isTask = rdata.data[i].versions[n].task;
|
var isTask = plugin.task;
|
||||||
if (isTask == '-1') {
|
if (isTask == '-1') {
|
||||||
handle = '<a style="color:green;" href="javascript:task();">' + lan.soft.the_install + '</a>'
|
handle = '<a style="color:green;" href="javascript:task();">正在安装...</a>';
|
||||||
} else if (isTask == '0') {
|
} else if (isTask == '0') {
|
||||||
handle = '<a style="color:#C0C0C0;" href="javascript:task();">' + lan.soft.sleep_install + '</a>'
|
handle = '<a style="color:#C0C0C0;" href="javascript:task();">等待安装...</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1853,18 +1858,18 @@ function GetSList(isdisplay) {
|
|||||||
} else {
|
} else {
|
||||||
var pnum = 0;
|
var pnum = 0;
|
||||||
for (var n = 0; n < len; n++) {
|
for (var n = 0; n < len; n++) {
|
||||||
if (rdata.data[i].versions[n].status == true) {
|
if (plugin.status == true) {
|
||||||
checked = rdata.data[i].versions[n]['display'] ? "checked" : "";
|
// checked = plugin.versions[n]['display'] ? "checked" : "";
|
||||||
var mupdate = (rdata.data[i].versions[n].no == rdata.data[i].update[n]) ? '' : '<a class="btlink" onclick="SoftUpdate(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\',\'' + rdata.data[i].update[n] + '\')">更新</a> | ';
|
// var mupdate = (plugin.versions[n] == plugin.updates[n]) ? '' : '<a class="btlink" onclick="SoftUpdate(\'' + rdata.data[i].name + '\',\'' + plugin.versions[n] + '\',\'' + plugin.updates[n] + '\')">更新</a> | ';
|
||||||
handle = mupdate + '<a class="btlink" onclick="phpSoftMain(\'' + rdata.data[i].versions[n].version + '\',' + n + ')">' + lan.soft.setup + '</a> | <a class="btlink" onclick="UninstallVersion(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\',\'' + rdata.data[i].title + '\')">' + lan.soft.uninstall + '</a>';
|
// handle = mupdate + '<a class="btlink" onclick="phpSoftMain(\'' + plugin.versions + '\',' + n + ')">' + lan.soft.setup + '</a> | <a class="btlink" onclick="UninstallVersion(\'' + rdata.data[i].name + '\',\'' + plugin.versions[n] + '\',\'' + plugin.title + '\')">卸载</a>';
|
||||||
softPath = '<span class="glyphicon glyphicon-folder-open" title="' + rdata.data[i].path + '" onclick="openPath(\'' + rdata.data[i].path + "/" + rdata.data[i].versions[n].version.replace(/\./, "") + '\')"></span>';
|
// softPath = '<span class="glyphicon glyphicon-folder-open" title="' + plugin.path + '" onclick="openPath(\'' + plugin.path + "/" + plugin.versions[n].replace(/\./, "") + '\')"></span>';
|
||||||
titleClick = 'onclick="phpSoftMain(\'' + rdata.data[i].versions[n].version + '\',' + n + ')" style="cursor:pointer"';
|
// titleClick = 'onclick="phpSoftMain(\'' + plugin.versions[n] + '\',' + n + ')" style="cursor:pointer"';
|
||||||
indexshow = '<div class="index-item"><input class="btswitch btswitch-ios" id="index_' + rdata.data[i].name + rdata.data[i].versions[n].version.replace(/\./, "") + '" type="checkbox" ' + checked + '><label class="btswitch-btn" for="index_' + rdata.data[i].name + rdata.data[i].versions[n].version.replace(/\./, "") + '" onclick="toIndexDisplay(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\')"></label></div>';
|
// indexshow = '<div class="index-item"><input class="btswitch btswitch-ios" id="index_' + plugin.name + plugin.versions[n].replace(/\./, "") + '" type="checkbox" ' + checked + '><label class="btswitch-btn" for="index_' + plugin.name + plugin.versions[n].replace(/\./, "") + '" onclick="toIndexDisplay(\'' + plugin.name + '\',\'' + plugin.versions[n] + '\')"></label></div>';
|
||||||
if (rdata.data[i].versions[n].run == true) {
|
// if (plugin.run == true) {
|
||||||
state = '<span style="color:#20a53a" class="glyphicon glyphicon-play"></span>'
|
// state = '<span style="color:#20a53a" class="glyphicon glyphicon-play"></span>'
|
||||||
} else {
|
// } else {
|
||||||
state = '<span style="color:red" class="glyphicon glyphicon-pause"></span>'
|
// state = '<span style="color:red" class="glyphicon glyphicon-pause"></span>'
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
handle = '<a class="btlink" onclick="oneInstall(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\')">' + lan.soft.install + '</a>';
|
handle = '<a class="btlink" onclick="oneInstall(\'' + rdata.data[i].name + '\',\'' + rdata.data[i].versions[n].version + '\')">' + lan.soft.install + '</a>';
|
||||||
softPath = '';
|
softPath = '';
|
||||||
@@ -1922,7 +1927,7 @@ function GetSList(isdisplay) {
|
|||||||
$(this).addClass("on").siblings().removeClass("on");
|
$(this).addClass("on").siblings().removeClass("on");
|
||||||
GetSList();
|
GetSList();
|
||||||
})
|
})
|
||||||
})
|
},'json');
|
||||||
}
|
}
|
||||||
//刷新状态
|
//刷新状态
|
||||||
function FPStatus() {
|
function FPStatus() {
|
||||||
@@ -2327,7 +2332,7 @@ function toIndexDisplay(name, version) {
|
|||||||
status = $("#index_" + name + verinfo).prop("checked") ? "0" : "1";
|
status = $("#index_" + name + verinfo).prop("checked") ? "0" : "1";
|
||||||
}
|
}
|
||||||
var data = "name=" + name + "&status=" + status + "&version=" + version;
|
var data = "name=" + name + "&status=" + status + "&version=" + version;
|
||||||
$.post("/plugins?action=setPluginStatus", data, function(rdata) {
|
$.post("/plugins/set_plugin_status", data, function(rdata) {
|
||||||
if (rdata.status) {
|
if (rdata.status) {
|
||||||
layer.msg(rdata.msg, { icon: 1 })
|
layer.msg(rdata.msg, { icon: 1 })
|
||||||
}
|
}
|
||||||
@@ -2345,7 +2350,7 @@ function flush_cache() {
|
|||||||
|
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
if (window.document.location.pathname == '/soft') {
|
if (window.document.location.pathname == '/soft/') {
|
||||||
setInterval(function() { GetSList(true); }, 5000);
|
setInterval(function() { GetSList(true); }, 5000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -9,7 +9,7 @@ import json
|
|||||||
# import psutil
|
# import psutil
|
||||||
import time
|
import time
|
||||||
|
|
||||||
sys.path.append(os.getcwd() + "/class/")
|
sys.path.append(os.getcwd() + "/class/core")
|
||||||
reload(sys)
|
reload(sys)
|
||||||
sys.setdefaultencoding('utf-8')
|
sys.setdefaultencoding('utf-8')
|
||||||
import db
|
import db
|
||||||
@@ -113,13 +113,13 @@ def startTask():
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
if os.path.exists(isTask):
|
if os.path.exists(isTask):
|
||||||
print "run --- !"
|
# print "run --- !"
|
||||||
sql = db.Sql()
|
sql = db.Sql()
|
||||||
sql.table('tasks').where(
|
sql.table('tasks').where(
|
||||||
"status=?", ('-1',)).setField('status', '0')
|
"status=?", ('-1',)).setField('status', '0')
|
||||||
taskArr = sql.table('tasks').where("status=?", ('0',)).field(
|
taskArr = sql.table('tasks').where("status=?", ('0',)).field(
|
||||||
'id,type,execstr').order("id asc").select()
|
'id,type,execstr').order("id asc").select()
|
||||||
print sql
|
# print sql
|
||||||
for value in taskArr:
|
for value in taskArr:
|
||||||
start = int(time.time())
|
start = int(time.time())
|
||||||
if not sql.table('tasks').where("id=?", (value['id'],)).count():
|
if not sql.table('tasks').where("id=?", (value['id'],)).count():
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th width="165">软件名称</th>
|
<th width="165">软件名称</th>
|
||||||
<th>说明</th>
|
<th>说明</th>
|
||||||
<th width="40">状态</th>
|
|
||||||
<th width="40">位置</th>
|
<th width="40">位置</th>
|
||||||
|
<th width="40">状态</th>
|
||||||
<th width="64">首页显示</th>
|
<th width="64">首页显示</th>
|
||||||
<th style="text-align: right;" width="120">操作</th>
|
<th style="text-align: right;" width="120">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user