This commit is contained in:
dami 2025-05-18 10:20:03 +08:00
parent 6a41f68289
commit 64883aa424
2 changed files with 34 additions and 2 deletions

View File

@ -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()

View File

@ -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});