Skip to content

Commit

Permalink
Merge pull request midoks#388 from midoks/dev
Browse files Browse the repository at this point in the history
局部优化
  • Loading branch information
midoks authored Mar 2, 2023
2 parents 9d9b39d + dffe9a7 commit 04e43e0
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 2 deletions.
3 changes: 3 additions & 0 deletions class/plugin/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def setSocket(self, sock):
def setCharset(self, charset):
self.__DB_CHARSET = charset

def setHost(self, host):
self.__DB_HOST = host

def setPort(self, port):
self.__DB_PORT = port

Expand Down
25 changes: 24 additions & 1 deletion plugins/supervisor/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ def getSupList():
infos = fr.readlines()
for line in infos:
if "command=" in line.strip():
d["command"] = line.strip().split('=')[1]
# d["command"] = line.strip().split('=')[1]
d["command"] = "子配置查看"
if "user=" in line.strip():
d["user"] = line.strip().split('=')[1]
if "priority=" in line.strip():
Expand Down Expand Up @@ -329,6 +330,26 @@ def startJob():
return mw.returnJson(True, action + '[' + name + ']成功!')


def restartJob():
args = getArgs()
data = checkArgs(args, ['name', 'status'])
if not data[0]:
return data[1]

supCtl = 'supervisorctl -c ' + getServerDir() + "/supervisor.conf"

name = args['name']
status = args['status']

action = "启动"
cmd = supCtl + " restart " + name
data = mw.execShell(cmd)

if data[1] != '':
return mw.returnJson(False, '[' + name + ']重启失败!')
return mw.returnJson(True, '[' + name + ']重启成功!')


def delJob():
args = getArgs()
data = checkArgs(args, ['name'])
Expand Down Expand Up @@ -567,6 +588,8 @@ def runLog():
print(addJob())
elif func == 'start_job':
print(startJob())
elif func == 'restart_job':
print(restartJob())
elif func == 'del_job':
print(delJob())
elif func == 'update_job':
Expand Down
11 changes: 11 additions & 0 deletions plugins/supervisor/js/supervisor.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function supList(page, search){

list += '<td style="text-align:right">\
<a href="javascript:;" class="btlink" onclick="startOrStop(\''+rdata.data[i]['program']+'\',\''+sup_status+'\')" title="启动|停止">'+sup_status_desc+'</a> | ' +
'<a href="javascript:;" class="btlink" onclick="restartJob(\''+rdata.data[i]['program']+'\',\''+sup_status+'\')" title="重启">重启</a> | ' +
'<a href="javascript:;" class="btlink" onclick="updateJob(\''+rdata.data[i]['program']+'\')">修改</a> | ' +
'<a href="javascript:;" class="btlink" onclick="delJob(\''+rdata.data[i]['program']+'\')" title="删除">删除</a>' +
'</td>';
Expand Down Expand Up @@ -128,6 +129,16 @@ function startOrStop(name,status){
});
}

function restartJob(name,status){
myPost('restart_job',{'name':name,'status':status}, function(data){
var rdata = $.parseJSON(data.data);
layer.msg(rdata.msg,{icon:rdata.status?1:2});
setTimeout(function(){
supList(1,10);
},2000);
});
}

function updateJob(name){
myPost('get_job_info',{'name':name},function(data){
var rdata = $.parseJSON(data.data);
Expand Down
1 change: 1 addition & 0 deletions plugins/webstats/conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"gif",
"jpg",
"css",
"svg",
"js",
"ico",
"woff2"
Expand Down
1 change: 1 addition & 0 deletions plugins/webstats/lua/webstats_log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ log_by_lua_block {

local function exclude_url()
if not ngx.var.uri then return false end
if not ngx.var.request_uri then return false end
if not auto_config['exclude_url'] then return false end
local the_uri = string.sub(ngx.var.request_uri, 2)
local url_conf = auto_config["exclude_url"]
Expand Down
6 changes: 5 additions & 1 deletion route/templates/default/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ <h3 class="mypcip"><span class="f14 cw">{{data['ip']}}</span></h3>

{% block content %}{% endblock %}
<div class="footer bgw">mdserver-web &copy;2018-∞ Linux面板 (<a class="btlink" target="_blank" href="//github.com/midoks/mdserver-web">源码</a>) <span style="margin-left:5px;">/</span>
<a class="btlink" style="margin-left:5px;" href="//github.com/midoks/mdserver-web/wiki" target="_blank">WIKI</a><span style="margin-left:5px;">/</span>
<a class="btlink" target="_blank" style="margin-left:5px;" href="//github.com/midoks/mdserver-web/wiki">WIKI</a><span style="margin-left:5px;">/</span>
<a class='btlink panel_ad_list_mode' style="margin-left:5px;">AD</a>
<span style="margin-left:5px;">/</span>
<a class='btlink' target="_blank" href="https://bbs.midoks.me" style="margin-left:5px;">交流论坛</a>
<span style="margin-left:5px;">/</span>
<a class='btlink' target="_blank" href="https://t.me/mdserver_web" style="margin-left:5px;">TG吹水群</a>
</div>
</div>
</div>
Expand Down

0 comments on commit 04e43e0

Please sign in to comment.