From 64883aa424941ad4eb4a075dec6413aee3b3eb9b Mon Sep 17 00:00:00 2001 From: dami Date: Sun, 18 May 2025 10:20:03 +0800 Subject: [PATCH] update --- plugins/webhook/index.py | 20 ++++++++++++++++++++ plugins/webhook/js/webhook.js | 16 ++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/plugins/webhook/index.py b/plugins/webhook/index.py index 03cd23ca4..8a5cf2fb4 100755 --- a/plugins/webhook/index.py +++ b/plugins/webhook/index.py @@ -114,6 +114,26 @@ def addHook(): mw.writeFile(shellFile, args['shell']) return mw.returnJson(True, '添加成功!') +def addHookShell(args): + if args['title'] == '': + return mw.returnJson(False, '名称不能为空!') + + hook = {} + hook['title'] = args['title'] + hook['access_key'] = mw.md5(hook['title']) + hook['count'] = 0 + hook['addtime'] = int(time.time()) + hook['uptime'] = 0 + + script_dir = getServerDir() + "/scripts" + if not os.path.exists(script_dir): + os.mkdir(script_dir) + + addCfg(hook) + shellFile = script_dir + '/' + hook['access_key'] + mw.writeFile(shellFile, args['shell']) + return mw.returnJson(True, '添加成功!') + def getList(): data = getCfg() diff --git a/plugins/webhook/js/webhook.js b/plugins/webhook/js/webhook.js index 97daf5854..14e5d2801 100755 --- a/plugins/webhook/js/webhook.js +++ b/plugins/webhook/js/webhook.js @@ -154,7 +154,7 @@ function addHook(){ layer.close(loadT); var rdata = $.parseJSON(data.data); if (!rdata.status){ - layer.msg(rdata.msg,{icon:0,time:2000,shade: [5, '#000']}); + layer.msg(rdata.msg,{icon:16,time:2000,shade: [5, '#000']}); return; } @@ -186,7 +186,19 @@ function addHook(){ title: $("#hook_title").val(), shell: whEditor.getValue(), } - whPost('add_hook', data, function(rdata){ + // whPost('add_hook', data, function(rdata){ + // var rdata = $.parseJSON(rdata.data); + // if (!rdata.status){ + // layer.msg(rdata.msg,{icon:2}); + // return; + // } + // layer.close(indexs); + // showMsg(rdata.msg, function(){ + // getHookList(); + // }, {icon:1}, 2000); + // }); + + whPostCallbak('addHookShell', '', data, function(rdata){ var rdata = $.parseJSON(rdata.data); if (!rdata.status){ layer.msg(rdata.msg,{icon:2});