This commit is contained in:
vet
2026-04-20 12:30:26 +07:00
parent f409121771
commit 8d3b8bdc23
3 changed files with 70 additions and 0 deletions

View File

@@ -259,6 +259,9 @@ _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
@@ -271,6 +274,32 @@ _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 ! _has nginx; then
if _has apt-get; then
apt-get update -y