mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 05:29:25 +08:00
up
This commit is contained in:
@@ -85,7 +85,10 @@ class plugin_api:
|
||||
return False
|
||||
|
||||
def getVersion(self, path):
|
||||
pass
|
||||
version_f = path + '/version.pl'
|
||||
if os.path.exists(version_f):
|
||||
return public.readFile(version_f).strip()
|
||||
return ''
|
||||
|
||||
# 构造本地插件信息
|
||||
def getPluginInfo(self, info):
|
||||
@@ -142,6 +145,12 @@ class plugin_api:
|
||||
info['name'], pluginInfo['versions'])
|
||||
|
||||
pluginInfo['setup'] = os.path.exists(pluginInfo['install_checks'])
|
||||
|
||||
if coexist and pluginInfo['setup']:
|
||||
pluginInfo['setup_version'] = info['versions']
|
||||
else:
|
||||
pluginInfo['setup_version'] = self.getVersion(
|
||||
pluginInfo['path'])
|
||||
# pluginInfo['status'] = os.path.exists(pluginInfo['install_checks'])
|
||||
return pluginInfo
|
||||
|
||||
@@ -199,7 +208,7 @@ class plugin_api:
|
||||
for index in range(len(tmp_data)):
|
||||
plugins_info.append(tmp_data[index])
|
||||
except Exception, e:
|
||||
pass
|
||||
print e
|
||||
return plugins_info
|
||||
|
||||
def getPluginList(self, sType, sPage=1, sPageSize=15):
|
||||
@@ -240,9 +249,14 @@ class plugin_api:
|
||||
plist.append(tmp_data[index])
|
||||
continue
|
||||
except Exception, e:
|
||||
pass
|
||||
print e
|
||||
return plist
|
||||
|
||||
def setIndexSort(self, sort):
|
||||
data = sort.split('|')
|
||||
public.writeFile(self.__index, json.dumps(data))
|
||||
return True
|
||||
|
||||
def addIndex(self, name, version):
|
||||
if not os.path.exists(self.__index):
|
||||
public.writeFile(self.__index, '[]')
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"ps":"(mdserver-web)插件产开发说明,每个版本可能有所变化!",
|
||||
"versions": "0.1",
|
||||
"shell":"install.sh",
|
||||
"checks":"mdserver-web/plugins/readme/r",
|
||||
"checks":"server/readme",
|
||||
"path":"server/readme",
|
||||
"author":"mdserver-web",
|
||||
"home":"github.com/midoks/mdserver-web",
|
||||
"date":"2018-11-30",
|
||||
|
||||
@@ -11,17 +11,20 @@ install_tmp=${rootPath}/tmp/bt_install.pl
|
||||
|
||||
Install_readme()
|
||||
{
|
||||
mkdir -p ${serverPath}/readme
|
||||
echo "${1}" > ${serverPath}/readme/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
}
|
||||
|
||||
Uninstall_readme()
|
||||
{
|
||||
rm -rf ${serverPath}/readme
|
||||
echo '卸载完成' > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_readme
|
||||
Install_readme $2
|
||||
else
|
||||
Uninstall_readme
|
||||
Uninstall_readme $2
|
||||
fi
|
||||
|
||||
+7
-3
@@ -53,9 +53,13 @@ def indexList():
|
||||
|
||||
@plugins.route('/index_sort', methods=['POST'])
|
||||
def indexSort():
|
||||
sort = request.form.get('ssrot', '')
|
||||
# data = plugin_api.plugin_api().setIndexSort()
|
||||
return public.returnJson(False, '已将安装任务添加到队列!')
|
||||
sort = request.form.get('ssort', '')
|
||||
if sort.strip() == '':
|
||||
return public.returnJson(False, '排序数据不能为空!')
|
||||
data = plugin_api.plugin_api().setIndexSort(sort)
|
||||
if data:
|
||||
return public.returnJson(True, '成功!')
|
||||
return public.returnJson(False, '失败!')
|
||||
|
||||
|
||||
@plugins.route('/install', methods=['POST'])
|
||||
|
||||
+47
-29
@@ -316,9 +316,7 @@ function flush_cache() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//首页软件列表
|
||||
function indexSoft() {
|
||||
function indexListHtml(callback){
|
||||
var loadT = layer.msg('正在获取列表...', { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.get('/plugins/index_list', function(rdata) {
|
||||
layer.close(loadT);
|
||||
@@ -340,7 +338,6 @@ function indexSoft() {
|
||||
version_info = version_info.substring(0, version_info.length - 1);
|
||||
}
|
||||
|
||||
|
||||
if (plugin.status == true) {
|
||||
state = '<span style="color:#20a53a" class="glyphicon glyphicon-play"></span>'
|
||||
} else {
|
||||
@@ -348,19 +345,20 @@ function indexSoft() {
|
||||
}
|
||||
|
||||
var name = plugin.title + ' ' + plugin.versions + ' ';
|
||||
var data_id = plugin.name + '-' + plugin.setup_version;
|
||||
if (plugin.coexist){
|
||||
name = plugin.title + ' ';
|
||||
data_id = plugin.name + '-' + plugin.versions;
|
||||
}
|
||||
|
||||
if (plugin.display == true) {
|
||||
con += '<div class="col-sm-3 col-md-3 col-lg-3" data-id="' + plugin.pid + '">\
|
||||
<span class="spanmove"></span>\
|
||||
<div onclick="softMain(\'' + plugin.name + '\',\'' + version_info + '\')">\
|
||||
<div class="image"><img src="plugins/file?name=' + plugin.name + '&f=ico.png"></div>\
|
||||
<div class="sname">' + name + state + '</div>\
|
||||
</div>\
|
||||
</div>'
|
||||
}
|
||||
|
||||
con += '<div class="col-sm-3 col-md-3 col-lg-3" data-id="' + data_id + '">\
|
||||
<span class="spanmove"></span>\
|
||||
<div onclick="softMain(\'' + plugin.name + '\',\'' + version_info + '\')">\
|
||||
<div class="image"><img src="plugins/file?name=' + plugin.name + '&f=ico.png"></div>\
|
||||
<div class="sname">' + name + state + '</div>\
|
||||
</div>\
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
$("#indexsoft").html(con);
|
||||
@@ -371,28 +369,48 @@ function indexSoft() {
|
||||
var softboxn = softboxlen;
|
||||
if (softboxlen <= softboxsum) {
|
||||
for (var i = 0; i < softboxsum - softboxlen; i++) {
|
||||
softboxn += 1000;
|
||||
softboxcon += '<div class="col-sm-3 col-md-3 col-lg-3 no-bg" data-id="' + softboxn + '"></div>'
|
||||
// softboxn += 1000;
|
||||
softboxcon += '<div class="col-sm-3 col-md-3 col-lg-3 no-bg" data-id="' + '"></div>'
|
||||
}
|
||||
$("#indexsoft").append(softboxcon);
|
||||
}
|
||||
|
||||
$("#indexsoft").dragsort({ dragSelector: ".spanmove", dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "<div class='col-sm-3 col-md-3 col-lg-3 dashed-border'></div>" });
|
||||
function saveOrder() {
|
||||
var data = $("#indexsoft > div").map(function() { return $(this).attr("data-id"); }).get();
|
||||
var ssort = data.join("|");
|
||||
$("input[name=list1SortOrder]").val(ssort);
|
||||
$.post("/plugins/index_sort", 'ssort=' + ssort, function(rdata) {
|
||||
if (!rdata.status){
|
||||
showMsg('设置失败:'+ rdata.msg, function(){
|
||||
indexSoft();
|
||||
}, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
}
|
||||
},'json');
|
||||
};
|
||||
if (typeof callback=='function'){
|
||||
callback();
|
||||
}
|
||||
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
//首页软件列表
|
||||
function indexSoft() {
|
||||
indexListHtml(function(){
|
||||
$("#indexsoft").dragsort({ dragSelector: ".spanmove", dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "<div class='col-sm-3 col-md-3 col-lg-3 dashed-border'></div>" });
|
||||
});
|
||||
|
||||
function saveOrder() {
|
||||
var data = $("#indexsoft > div").map(function() { return $(this).attr("data-id"); }).get();
|
||||
tmp = [];
|
||||
for(i in data){
|
||||
console.log(data[i]);
|
||||
if (data[i] != ''){
|
||||
tmp.push($.trim(data[i]));
|
||||
}
|
||||
}
|
||||
var ssort = tmp.join("|");
|
||||
console.log(ssort);
|
||||
$("input[name=list1SortOrder]").val(ssort);
|
||||
$.post("/plugins/index_sort", 'ssort=' + ssort, function(rdata) {
|
||||
if (!rdata.status){
|
||||
showMsg('设置失败:'+ rdata.msg, function(){
|
||||
indexListHtml();
|
||||
}, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
}
|
||||
},'json');
|
||||
};
|
||||
}
|
||||
|
||||
// $(function() {
|
||||
// if (window.document.location.pathname == '/soft/') {
|
||||
// setInterval(function() { GetSList(true); }, 5000);
|
||||
|
||||
Reference in New Issue
Block a user