diff --git a/plugins/webhook/index.html b/plugins/webhook/index.html index b50d38710..0de594878 100755 --- a/plugins/webhook/index.html +++ b/plugins/webhook/index.html @@ -14,11 +14,11 @@ 名称 - 添加时间 - 近期调用 - 调用次数 - 密钥 - 操作 + 添加时间 + 近期调用 + 调用次数 + 密钥 + 操作 diff --git a/plugins/webhook/index.py b/plugins/webhook/index.py index 8a5cf2fb4..9d92ee009 100755 --- a/plugins/webhook/index.py +++ b/plugins/webhook/index.py @@ -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': diff --git a/plugins/webhook/js/webhook.js b/plugins/webhook/js/webhook.js index 14e5d2801..72111a09f 100755 --- a/plugins/webhook/js/webhook.js +++ b/plugins/webhook/js/webhook.js @@ -227,6 +227,7 @@ function getHookList(){ +''+mlist[i].count+'' +'查看密钥' +'测试 | ' + +'命令 | ' +'编辑 | ' +'日志 | ' +'删除' @@ -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: '
\ +
\ +
'+rdata.data+'
\ +
\ +
', + success:function(){ + copyText(rdata.data); + }, + yes:function(){ + copyText(rdata.data); + } + }); + }); +} + //删除 function deleteHook(key, title){ layer.confirm('删除Hook-['+ title +']',{