mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
u
This commit is contained in:
@@ -150,9 +150,6 @@ class plugins_api:
|
||||
infoJsonPos = self.__plugin_dir + '/' + name + '/' + 'info.json'
|
||||
if not os.path.exists(infoJsonPos):
|
||||
return public.returnJson(False, "配置文件不存在!", ())
|
||||
|
||||
#
|
||||
|
||||
return public.returnJson(True, "插件存在!", ())
|
||||
|
||||
def setIndexApi(self):
|
||||
@@ -180,6 +177,23 @@ class plugins_api:
|
||||
return public.returnJson(True, "OK", data[0].strip())
|
||||
return public.returnJson(False, data[1].strip())
|
||||
|
||||
def updateZipApi(self):
|
||||
tmp_path = public.getRootDir() + '/temp'
|
||||
if not os.path.exists(tmp_path):
|
||||
os.makedirs(tmp_path, mode=755)
|
||||
public.execShell("rm -rf " + tmp_path + '/*')
|
||||
|
||||
tmp_file = tmp_path + '/plugin_tmp.zip'
|
||||
from werkzeug.utils import secure_filename
|
||||
from flask import request
|
||||
f = request.files['plugin_zip']
|
||||
if f.filename[-4:] != '.zip':
|
||||
return public.returnJson(False, '仅支持zip文件!')
|
||||
# tmp_file = tmp_path + '/plugin_tmp.tar.gz'
|
||||
|
||||
f.save(tmp_file)
|
||||
# os.remove(tmp_file)
|
||||
|
||||
##### ----- end ----- ###
|
||||
|
||||
# 进程是否存在
|
||||
|
||||
@@ -369,7 +369,6 @@ function importPluginOpen(){
|
||||
importPlugin(files[0]);
|
||||
$("#update_zip").val('')
|
||||
});
|
||||
|
||||
$("#update_zip").click();
|
||||
}
|
||||
|
||||
@@ -378,7 +377,7 @@ function importPlugin(file){
|
||||
var formData = new FormData();
|
||||
formData.append("plugin_zip", file);
|
||||
$.ajax({
|
||||
url: "/plugin?action=update_zip",
|
||||
url: "/plugins/update_zip",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false,
|
||||
|
||||
Reference in New Issue
Block a user