diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index d31fe71ea..68a0035c0 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -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 ----- ### # 进程是否存在 diff --git a/route/static/app/soft.js b/route/static/app/soft.js index df7165a95..2f940876f 100755 --- a/route/static/app/soft.js +++ b/route/static/app/soft.js @@ -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,