From a6644cc706d037b40d143831b47a7d7e19a096e8 Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 30 Oct 2023 01:48:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/gogs/hook/self_hook.tpl | 2 +- plugins/gogs/js/gogs.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/gogs/hook/self_hook.tpl b/plugins/gogs/hook/self_hook.tpl index 7338b357e..266f053e8 100644 --- a/plugins/gogs/hook/self_hook.tpl +++ b/plugins/gogs/hook/self_hook.tpl @@ -4,7 +4,7 @@ H_DIR={$HOOK_DIR} HL_DIR={$HOOK_LOGS_DIR} -SH_LIST=`cd ${H_DIR} && ls | grep ".sh"` +SH_LIST=`cd ${H_DIR} && ls | grep ".sh$"` for sh_f in $SH_LIST; do ABS_FILE=${H_DIR}/${sh_f} diff --git a/plugins/gogs/js/gogs.js b/plugins/gogs/js/gogs.js index b336aefa5..2cf3ece16 100755 --- a/plugins/gogs/js/gogs.js +++ b/plugins/gogs/js/gogs.js @@ -598,6 +598,10 @@ function projectScriptSelfRender(user, name){ $('#gogs_self_table .run').click(function(){ var i = $(this).data('index'); var file = data[i]["name"]; + if (data[i]["is_hidden"]){ + layer.msg("已经禁用,不能执行!",{icon:2,time:2000,shade: [0.3, '#000']}); + return; + } gogsPost('project_script_self_run', {'user':user,'name':name,'file':file}, function(data){ var rdata = $.parseJSON(data.data); layer.msg(rdata.msg,{icon:data.status?1:2,time:2000,shade: [0.3, '#000']}); @@ -608,6 +612,12 @@ function projectScriptSelfRender(user, name){ $('#gogs_self_table .rename').click(function(){ var i = $(this).data('index'); var file = data[i]["name"]; + + if (data[i]["is_hidden"]){ + layer.msg("已经禁用,不能执行!",{icon:2,time:2000,shade: [0.3, '#000']}); + return; + } + file = file.split('.sh')[0]; layer.open({