diff --git a/README.md b/README.md index 74eb866c3..70d72cdf8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ### 自动安装 ``` -curl -fsSL https://raw.githubusercontent.com/midoks/mdweb/master/install/install.sh | sh +curl -fsSL https://raw.githubusercontent.com/midoks/mdweb/master/sciprts/install.sh | sh ``` ### 手动操作 diff --git a/class/public.py b/class/public.py index 7ef21bf32..863d69294 100755 --- a/class/public.py +++ b/class/public.py @@ -6,7 +6,7 @@ import time import string -def runDir(): +def getRunDir(): return os.getcwd() @@ -26,10 +26,9 @@ def md5(str): except: return False -# 文件的MD5值 - def GetFileMd5(filename): + # 文件的MD5值 if not os.path.isfile(filename): return False import hashlib @@ -43,10 +42,9 @@ def GetFileMd5(filename): f.close() return myhash.hexdigest() -# 取随机字符串 - def GetRandomString(length): + # 取随机字符串 from random import Random str = '' chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789' @@ -92,10 +90,9 @@ def returnMsg(status, msg, args=()): msg = msg.replace(rep, args[i]) return {'status': status, 'msg': msg} -# 取提示消息 - def getMsg(key, args=()): + # 取提示消息 try: import json logMessage = json.loads( @@ -111,10 +108,9 @@ def getMsg(key, args=()): except: return key -# 取提示消息 - def getLan(key): + # 取提示消息 import json logMessage = json.loads( readFile('static/language/' + get_language() + '/template.json')) diff --git a/install/install.sh b/scripts/install.sh similarity index 100% rename from install/install.sh rename to scripts/install.sh diff --git a/views/plugins.py b/views/plugins.py index 0eae3cdfc..017c12f17 100644 --- a/views/plugins.py +++ b/views/plugins.py @@ -16,15 +16,9 @@ import json plugins = Blueprint('plugins', __name__, template_folder='templates') - __plugin_name = "plugins" -@plugins.route("/") -def index(): - return render_template('default/ftp.html') - - @plugins.route("/file", methods=['GET']) def file(): name = request.args.get('name', '') @@ -78,11 +72,19 @@ def list(): @plugins.route("/install", methods=['POST']) def install(): + rundir = public.getRunDir() + name = request.form['name'] if name.strip() == '': return '' - install = "plugins/" + name + "/install.sh" + infoJson = __plugin_name + "/" + name + "/info.json" + install = __plugin_name + "/" + name + "/install.sh" + + pluginInfo = json.loads(public.readFile(infoJson)) + + print pluginInfo + print install os.system('/bin/bash ' + install + ' install') print request.args