This commit is contained in:
vet
2026-04-14 15:20:00 +07:00
parent 3332ec541a
commit 4ce37703b3
8 changed files with 192 additions and 27 deletions

View File

@@ -260,6 +260,10 @@ pc_print_vite_backend_env() {
info " VITE_CHAT_URL=${VITE_CHAT_URL:-<empty>}"
info " VITE_USER_URL=${VITE_USER_URL:-<empty>}"
info " VITE_ADMIN_URL=${VITE_ADMIN_URL:-${PC_VITE_ADMIN_URL:-<empty>}}"
if [[ "$PC_BACKEND_ORIGIN" == http://* ]] && [[ "$PC_BACKEND_ORIGIN" != http://127.0.0.1* ]] && [[ "$PC_BACKEND_ORIGIN" != http://localhost* ]]; then
warn " PC_BACKEND_ORIGIN 仍是 HTTP 公网入口OpenIM WASM DB worker 可能继续 initDB 超时。建议改为 https://${VITE_BASE_DOMAIN}"
fi
}
pc_check_nginx_gateway() {
@@ -272,11 +276,14 @@ pc_check_nginx_gateway() {
return 0
fi
if curl -fsS --max-time 3 "${o}/nginx-health" >/dev/null 2>&1; then
local curl_tls=()
[[ "$o" == https://* ]] && curl_tls=(-k)
if curl "${curl_tls[@]}" -fsS --max-time 3 "${o}/nginx-health" >/dev/null 2>&1; then
success " Nginx 网关可达: ${o}/nginx-health"
else
warn " Nginx 网关不可达: ${o}/nginx-health"
warn " PC WebSocket 默认连 ${VITE_WS_URL:-ws://<host>/msg_gateway};请确认已执行 sudo ./deploy-test/00-init-tools.sh nginx并放行 TCP 80"
warn " PC WebSocket 默认连 ${VITE_WS_URL:-ws://<host>/msg_gateway};请确认已执行 sudo ./deploy-test/00-init-tools.sh nginx并放行 TCP 80/443"
fi
pc_probe_msg_gateway "$o"
@@ -308,6 +315,9 @@ pc_check_wasm_assets() {
return 0
fi
local curl_tls=()
[[ "$origin" == https://* ]] && curl_tls=(-k)
local asset url ct
for asset in \
openIM.wasm \
@@ -316,8 +326,8 @@ pc_check_wasm_assets() {
node_modules/@openim/wasm-client-sdk/lib/worker.js \
node_modules/@openim/wasm-client-sdk/lib/worker-legacy.js; do
url="${origin}/${asset}"
ct=$(curl -fsSI --max-time 5 "$url" 2>/dev/null | awk 'BEGIN{IGNORECASE=1} /^content-type:/ {sub(/\r$/, ""); print $0; exit}' || true)
if [[ -n "$ct" ]] || curl -fsS --max-time 5 -r 0-0 "$url" >/dev/null 2>&1; then
ct=$(curl "${curl_tls[@]}" -fsSI --max-time 5 "$url" 2>/dev/null | awk 'BEGIN{IGNORECASE=1} /^content-type:/ {sub(/\r$/, ""); print $0; exit}' || true)
if [[ -n "$ct" ]] || curl "${curl_tls[@]}" -fsS --max-time 5 -r 0-0 "$url" >/dev/null 2>&1; then
success " PC SDK 资源可达: ${url}${ct:+ (${ct#*: })}"
else
warn " PC SDK 资源不可达: ${url}SDK login 可能卡住且不会发起 /msg_gateway WebSocket"