mirror of
https://github.com/kejilion/sh.git
synced 2026-09-08 00:40:03 +08:00
feat(kpanel): expose interactive site recipes
This commit is contained in:
40
kejilion.sh
40
kejilion.sh
@@ -10147,6 +10147,13 @@ kpanel_run_web_recipe_cli() {
|
||||
return "$rc"
|
||||
}
|
||||
|
||||
kpanel_web_recipe_requires_document_root() {
|
||||
case "${1:-}" in
|
||||
2|3|4|5|6|7|8|9|20|25|26|27|30) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
kpanel_ldnmp_escape() {
|
||||
local value="${1:-}"
|
||||
value=${value//\\/\\\\}; value=${value//\"/\\\"}
|
||||
@@ -10715,7 +10722,7 @@ linux_ldnmp() {
|
||||
if [ "${KJ_WEB_NONINTERACTIVE:-0}" = "1" ]; then
|
||||
sub_choice="${KJ_WEB_RECIPE:-}"
|
||||
case "$sub_choice" in
|
||||
2|3|4|5|6|7|8|9|23|27) ;;
|
||||
2|3|4|5|6|7|8|9|20|22|23|24|25|26|27|28|30) ;;
|
||||
*)
|
||||
echo "KPANEL_PROGRESS 100 不支持的 KJ_WEB_RECIPE"
|
||||
return 1
|
||||
@@ -11726,7 +11733,8 @@ linux_ldnmp() {
|
||||
echo "KPANEL_PROGRESS 100 kejilion.sh 建站产物不完整"
|
||||
return 1
|
||||
fi
|
||||
if [ "$sub_choice" != "23" ] && [ ! -d "/home/web/html/${KJ_WEB_DOMAIN}" ]; then
|
||||
if kpanel_web_recipe_requires_document_root "$sub_choice" &&
|
||||
[ ! -d "/home/web/html/${KJ_WEB_DOMAIN}" ]; then
|
||||
echo "KPANEL_PROGRESS 100 kejilion.sh 建站产物不完整"
|
||||
return 1
|
||||
fi
|
||||
@@ -23769,6 +23777,34 @@ else
|
||||
shift
|
||||
kpanel_run_web_recipe_cli 27 "$@"
|
||||
;;
|
||||
php-site)
|
||||
shift
|
||||
kpanel_run_web_recipe_cli 20 "$@"
|
||||
;;
|
||||
redirect-site)
|
||||
shift
|
||||
kpanel_run_web_recipe_cli 22 "$@"
|
||||
;;
|
||||
domain-proxy)
|
||||
shift
|
||||
kpanel_run_web_recipe_cli 24 "$@"
|
||||
;;
|
||||
bitwarden-site)
|
||||
shift
|
||||
kpanel_run_web_recipe_cli 25 "$@"
|
||||
;;
|
||||
halo-site)
|
||||
shift
|
||||
kpanel_run_web_recipe_cli 26 "$@"
|
||||
;;
|
||||
loadbalance-site)
|
||||
shift
|
||||
kpanel_run_web_recipe_cli 28 "$@"
|
||||
;;
|
||||
static-site)
|
||||
shift
|
||||
kpanel_run_web_recipe_cli 30 "$@"
|
||||
;;
|
||||
fd|rp|反代)
|
||||
shift
|
||||
ldnmp_Proxy "$@"
|
||||
|
||||
@@ -22,10 +22,10 @@ recipe_case="$(
|
||||
capture && /不支持的 KJ_WEB_RECIPE/ { exit }
|
||||
' "${script_path}"
|
||||
)"
|
||||
for selector in 2 3 4 5 6 7 8 9 23 27; do
|
||||
for selector in 2 3 4 5 6 7 8 9 20 22 23 24 25 26 27 28 30; do
|
||||
printf '%s\n' "${recipe_case}" | grep -E "(^|[[:space:]|])${selector}([|)])" >/dev/null
|
||||
done
|
||||
if printf '%s\n' "${recipe_case}" | grep -E '(^|[[:space:]|])(20|22|24|29|30|34|38)([|)])' >/dev/null; then
|
||||
if printf '%s\n' "${recipe_case}" | grep -E '(^|[[:space:]|])(21|29|31|32|33|34|35|36|37|38)([|)])' >/dev/null; then
|
||||
printf '%s\n' "unsafe or interactive recipe selector was exposed to KPanel" >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -34,7 +34,8 @@ grep -F 'ldnmp_wp "${KJ_WEB_DOMAIN:-}"' "${script_path}" >/dev/null
|
||||
grep -F 'ldnmp_Proxy "${KJ_WEB_DOMAIN:-}" "${KJ_WEB_PROXY_HOST:-}" "${KJ_WEB_PROXY_PORT:-}"' "${script_path}" >/dev/null
|
||||
grep -F 'KJ_WEB_PROXY_HOST 不是有效的 IP 或主机名' "${script_path}" >/dev/null
|
||||
grep -F 'KJ_WEB_PROXY_PORT 不是有效端口' "${script_path}" >/dev/null
|
||||
grep -F 'if [ "$sub_choice" != "23" ] && [ ! -d "/home/web/html/${KJ_WEB_DOMAIN}" ]; then' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_web_recipe_requires_document_root()' "${script_path}" >/dev/null
|
||||
grep -F 'if kpanel_web_recipe_requires_document_root "$sub_choice" &&' "${script_path}" >/dev/null
|
||||
grep -F 'web_del "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'KPANEL_DELETE_SITE deleted $yuming' "${script_path}" >/dev/null
|
||||
grep -F 'KPANEL_DELETE_DATABASE dropped $yuming' "${script_path}" >/dev/null
|
||||
@@ -42,5 +43,12 @@ grep -F 'rm -rf -- "/home/web/html/$yuming"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli()' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 3 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 27 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 20 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 22 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 24 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 25 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 26 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 28 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'kpanel_run_web_recipe_cli 30 "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'ldnmp_wp "$@"' "${script_path}" >/dev/null
|
||||
grep -F 'ldnmp_Proxy "$@"' "${script_path}" >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user