From 4d13bded792d2b51cc84782bbca409b22f9b0607 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 13 Nov 2025 16:28:40 +0000 Subject: [PATCH] Fix host mode port configuration by using QlPort environment variable Co-authored-by: whyour <22700758+whyour@users.noreply.github.com> --- docker/docker-entrypoint.sh | 2 ++ shell/api.sh | 16 ++++++++-------- shell/check.sh | 6 +++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index b06b9abb..edf305b0 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -14,6 +14,8 @@ log_with_style() { log_with_style "INFO" "🚀 1. 检测配置文件..." import_config "$@" +# Export BACK_PORT from QlPort for backend server to use +export BACK_PORT="${ql_port}" fix_config pm2 l &>/dev/null diff --git a/shell/api.sh b/shell/api.sh index f704e3fb..771a565e 100755 --- a/shell/api.sh +++ b/shell/api.sh @@ -41,7 +41,7 @@ add_cron_api() { fi local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/open/crons?t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/open/crons?t=$currentTimeStamp" \ -H "Authorization: Bearer ${__ql_token__}" \ -H "Content-Type: application/json;charset=UTF-8" \ --data-raw "{\"name\":\"${name//\"/\\\"}\",\"command\":\"${command//\"/\\\"}\",\"schedule\":\"$schedule\",\"sub_id\":$sub_id}" \ @@ -71,7 +71,7 @@ update_cron_api() { fi local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/open/crons?t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/open/crons?t=$currentTimeStamp" \ -X 'PUT' \ -H "Authorization: Bearer ${__ql_token__}" \ -H "Content-Type: application/json;charset=UTF-8" \ @@ -98,7 +98,7 @@ update_cron_command_api() { fi local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/open/crons?t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/open/crons?t=$currentTimeStamp" \ -X 'PUT' \ -H "Authorization: Bearer ${__ql_token__}" \ -H "Content-Type: application/json;charset=UTF-8" \ @@ -118,7 +118,7 @@ del_cron_api() { local ids="$1" local currentTimeStamp=$(date +%s) local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/open/crons?t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/open/crons?t=$currentTimeStamp" \ -X 'DELETE' \ -H "Authorization: Bearer ${__ql_token__}" \ -H "Content-Type: application/json;charset=UTF-8" \ @@ -143,7 +143,7 @@ update_cron() { local runningTime="${6:-0}" local currentTimeStamp=$(date +%s) local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/open/crons/status?t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/open/crons/status?t=$currentTimeStamp" \ -X 'PUT' \ -H "Authorization: Bearer ${__ql_token__}" \ -H "Content-Type: application/json;charset=UTF-8" \ @@ -165,7 +165,7 @@ notify_api() { local content="$2" local currentTimeStamp=$(date +%s) local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/open/system/notify?t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/open/system/notify?t=$currentTimeStamp" \ -X 'PUT' \ -H "Authorization: Bearer ${__ql_token__}" \ -H "Content-Type: application/json;charset=UTF-8" \ @@ -185,7 +185,7 @@ find_cron_api() { local params="$1" local currentTimeStamp=$(date +%s) local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/open/crons/detail?$params&t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/open/crons/detail?$params&t=$currentTimeStamp" \ -H "Authorization: Bearer ${__ql_token__}" \ -H "Content-Type: application/json;charset=UTF-8" \ --compressed @@ -204,7 +204,7 @@ update_auth_config() { local tip="$2" local currentTimeStamp=$(date +%s) local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/open/system/auth/reset?t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/open/system/auth/reset?t=$currentTimeStamp" \ -X 'PUT' \ -H "Authorization: Bearer ${__ql_token__}" \ -H "Content-Type: application/json;charset=UTF-8" \ diff --git a/shell/check.sh b/shell/check.sh index ae4db058..3f47889a 100755 --- a/shell/check.sh +++ b/shell/check.sh @@ -31,7 +31,7 @@ pm2_log() { } check_ql() { - local api=$(curl -s --noproxy "*" "http://0.0.0.0:5700") + local api=$(curl -s --noproxy "*" "http://0.0.0.0:${ql_port}") echo -e "\n=====> 检测面板\n\n$api\n" if [[ $api =~ "
" ]]; then echo -e "=====> 面板服务启动正常\n" @@ -42,10 +42,10 @@ check_pm2() { pm2_log local currentTimeStamp=$(date +%s) local api=$( - curl -s --noproxy "*" "http://0.0.0.0:5700/api/system?t=$currentTimeStamp" \ + curl -s --noproxy "*" "http://0.0.0.0:${ql_port}/api/system?t=$currentTimeStamp" \ -H 'Accept: */*' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36' \ - -H 'Referer: http://0.0.0.0:5700/crontab' \ + -H "Referer: http://0.0.0.0:${ql_port}/crontab" \ -H 'Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7' \ --compressed )