mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 01:29:26 +08:00
update
This commit is contained in:
@@ -14,11 +14,11 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>添加时间</th>
|
||||
<th>近期调用</th>
|
||||
<th>调用次数</th>
|
||||
<th>密钥</th>
|
||||
<th style="text-align: right;" width="150">操作</th>
|
||||
<th width="150">添加时间</th>
|
||||
<th width="150">近期调用</th>
|
||||
<th width="100">调用次数</th>
|
||||
<th width="100">密钥</th>
|
||||
<th style="text-align: right;" width="180">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="zipBody"></tbody>
|
||||
|
||||
@@ -178,6 +178,21 @@ def runShellArgs(args):
|
||||
return mw.returnJson(True, '运行成功!')
|
||||
return mw.returnJson(False, '指定Hook不存在!')
|
||||
|
||||
def getRunShellCmd():
|
||||
args = getArgs()
|
||||
check_arg = checkArgs(args, ['access_key'])
|
||||
if not check_arg[0]:
|
||||
return check_arg[1]
|
||||
|
||||
script_dir = getServerDir() + "/scripts"
|
||||
shellFile = script_dir + '/' + args['access_key']
|
||||
param = ''
|
||||
if 'params' in args:
|
||||
param = args['params']
|
||||
param = re.sub("\"", '', param)
|
||||
cmd = "bash {} {}".format(shellFile, param)
|
||||
return mw.returnJson(True, 'ok', cmd)
|
||||
|
||||
|
||||
def runShell():
|
||||
args = getArgs()
|
||||
@@ -257,6 +272,8 @@ if __name__ == "__main__":
|
||||
print(getList())
|
||||
elif func == "run_shell":
|
||||
print(runShell())
|
||||
elif func == 'run_shell_cmd':
|
||||
print(getRunShellCmd())
|
||||
elif func == 'del_hook':
|
||||
print(delHook())
|
||||
elif func == 'get_log':
|
||||
|
||||
@@ -227,6 +227,7 @@ function getHookList(){
|
||||
+'<td>'+mlist[i].count+'</td>'
|
||||
+'<td><a href="javascript:showWebHookCode(\''+mlist[i].url+'\',\''+mlist[i].access_key+'\')" class="btlink">查看密钥</a></td>'
|
||||
+'<td><a href="javascript:runHook(\''+mlist[i].access_key+'\');" class="btlink">测试</a> | '
|
||||
+'<a href="javascript:getRunHookCmd(\''+mlist[i].access_key+'\');" class="btlink">命令</a> | '
|
||||
+'<a href="javascript:onlineEditFile(0,\''+ script_dir + '/'+ mlist[i].access_key+'\',\'sh\');" class="btlink">编辑</a> | '
|
||||
+'<a href="javascript:getLogs(\''+ script_dir + '/' + mlist[i].access_key+'.log\');" class="btlink">日志</a> | '
|
||||
+'<a href="javascript:deleteHook(\''+mlist[i].access_key+'\',\''+ mlist[i].title +'\');" class="btlink">删除</a></td>'
|
||||
@@ -316,6 +317,36 @@ function runHook(key){
|
||||
},{icon:1},2000);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getRunHookCmd(key) {
|
||||
whPost('run_shell_cmd', {"access_key":key}, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
if (!rdata.status){
|
||||
layer.msg(rdata.msg,{icon:2});
|
||||
}
|
||||
layer.open({
|
||||
title: "手动执行命令CMD",
|
||||
area: ['600px', '180px'],
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
btn:["复制","取消"],
|
||||
content: '<div class="pd15">\
|
||||
<div class="divtable">\
|
||||
<pre class="layui-code">'+rdata.data+'</pre>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(){
|
||||
copyText(rdata.data);
|
||||
},
|
||||
yes:function(){
|
||||
copyText(rdata.data);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//删除
|
||||
function deleteHook(key, title){
|
||||
layer.confirm('删除Hook-['+ title +']',{
|
||||
|
||||
Reference in New Issue
Block a user