diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index eb99e2124..77ac43824 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -794,7 +794,7 @@ class plugins_api: return mw.returnJson(True, '删除成功!') # shell 调用 - def run(self, name, func, version, args='', script='index'): + def run(self, name, func, version='', args='', script='index'): path = mw.getRunDir() + '/' + self.__plugin_dir + \ '/' + name + '/' + script + '.py' py = 'python3 ' + path diff --git a/class/core/site_api.py b/class/core/site_api.py index 06506905c..aa2a78889 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -823,6 +823,25 @@ class site_api: port = request.form.get('port', '') return self.add(webname, port, ps, path, version) + def checkWebStatusApi(self): + ''' + 创建站点检查web服务 + ''' + if not mw.isInstalledWeb(): + return mw.returnJson(False, '请安装并启动OpenResty服务!') + + path = mw.getServerDir() + '/openresty/init.d/openresty' + data = mw.execShell(path + " status") + if data[0].strip().find('stopped') != -1: + return mw.returnJson(False, '请启动OpenResty服务!') + + # import plugins_api + # data = plugins_api.plugins_api().run('openresty', 'status') + # if data[0].strip() == 'stop': + # return mw.returnJson(False, '请启动OpenResty服务!') + + return mw.returnJson(True, 'OK') + def addDomainApi(self): isError = mw.checkWebConfig() if isError != True: @@ -1075,7 +1094,7 @@ class site_api: # self.closeHasPwd(get) filename = self.passPath + '/' + siteName + '.pass' - print(filename) + # print(filename) passconf = username + ':' + mw.hasPwd(password) if siteName == 'phpmyadmin': diff --git a/route/static/app/site.js b/route/static/app/site.js index 02e7866b8..fe9b437f4 100755 --- a/route/static/app/site.js +++ b/route/static/app/site.js @@ -163,8 +163,23 @@ function setWebPs(b, e, a) { },'json'); } +function checkWebStatus(){ + data = syncPost('/site/check_web_status') + if (data.status){ + return true + } + layer.msg(data.msg,{icon:0,time:3000,shade: [0.3, "#000"]}) + return false +} + //添加站点 function webAdd(type) { + checkPass = checkWebStatus() + //未开启openresty,不能继续 + if (!checkPass){ + return + } + if (type == 1) { var array; var str=""; diff --git a/route/static/app/soft.js b/route/static/app/soft.js index 94bca7e5e..8f59f2a80 100755 --- a/route/static/app/soft.js +++ b/route/static/app/soft.js @@ -146,17 +146,6 @@ function getSList(isdisplay) { '
' + plugin_title + '