This commit is contained in:
vet
2026-04-20 12:51:03 +07:00
parent 8d3b8bdc23
commit fa6b610ddf
8 changed files with 90 additions and 95 deletions

View File

@@ -259,9 +259,6 @@ _install_pc_nginx_proxy() {
local conf_src="${script_dir}/nginx/openim-pc-proxy.conf"
local conf_name="openim-pc-proxy.conf"
local proxy_domain="${PC_PROXY_DOMAIN:-cms-jack.imharry.work}"
local repo_root
repo_root="$(cd "${script_dir}/.." && pwd)"
local sdk_static_dir="/var/www/openim-pc-sdk"
if [[ -f "$ENV_FILE" ]]; then
# shellcheck source=/dev/null
@@ -274,31 +271,9 @@ _install_pc_nginx_proxy() {
return 1
fi
info " 准备 OpenIM WASM SDK 静态资源: ${sdk_static_dir}"
mkdir -p "$sdk_static_dir"
local sdk_lib_dir="${repo_root}/pc/node_modules/@openim/wasm-client-sdk/lib"
local sdk_assets_dir="${repo_root}/pc/node_modules/@openim/wasm-client-sdk/assets"
local pc_public_dir="${repo_root}/pc/public"
local asset src
for asset in worker.js worker-legacy.js; do
src="${sdk_lib_dir}/${asset}"
if [[ -s "$src" ]]; then
install -m 0644 "$src" "${sdk_static_dir}/${asset}"
success " 已安装 SDK worker: ${sdk_static_dir}/${asset}"
else
warn " 缺少 SDK worker: $src(请先执行 ./deploy-test/06-install-frontend.sh pc"
fi
done
for asset in openIM.wasm sql-wasm.wasm wasm_exec.js; do
src="${pc_public_dir}/${asset}"
[[ -s "$src" ]] || src="${sdk_assets_dir}/${asset}"
if [[ -s "$src" ]]; then
install -m 0644 "$src" "${sdk_static_dir}/${asset}"
success " 已安装 SDK 资源: ${sdk_static_dir}/${asset}"
else
warn " 缺少 SDK 资源: ${asset}(请先执行 ./deploy-test/06-install-frontend.sh pc && ./deploy-test/07-start-frontend.sh pc"
fi
done
if [[ ! -f /app/pc/dist/index.html ]]; then
warn " /app/pc/dist/index.html 不存在;域名首页会不可用。请先执行: ./deploy-test/dt.sh pc-build"
fi
if ! _has nginx; then
if _has apt-get; then
@@ -342,6 +317,7 @@ _install_pc_nginx_proxy() {
info " 本机 Nginx 仅监听 TCP 80curl -sS -H 'Host: ${proxy_domain}' http://127.0.0.1/nginx-health 应返回 ok"
info " 外部推荐入口 https://${proxy_domain} 应由 LB/CDN/其它网关终止 HTTPS 后转发到本机 :80"
info " 建议 .env.deploy-test 设置 PC_BACKEND_ORIGIN=https://${proxy_domain}"
info " PC 静态根目录: /app/pc/dist请先执行 ./deploy-test/dt.sh pc-build"
info " 浏览器打开 https://${proxy_domain}/"
}