Files
tongxunruanjian/scripts/load-jpush-secret.sh
T
编码工程师andmultica-agent f1fe4a3928 feat(mobile,deploy): 接入安卓极光与华为通道并准备公网部署配置
客户端默认指向 jxd.jinniu.ink 的 HTTPS/WSS;登录后把 OpenIM userID 设为极光 alias。
华为 agconnect-services.json 不伪造、不入库。Master Secret 只从服务器文件注入。

Co-authored-by: multica-agent <github@multica.ai>
2026-08-30 21:32:58 +08:00

28 lines
924 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 从服务器安全文件注入极光 Master Secret 到环境变量。
# 不打印文件内容、不写入仓库。供总工部署时 source,本卡不执行。
set -euo pipefail
SECRET_FILE="${JPUSH_MASTER_SECRET_FILE:-/root/.config/jinxunda/jpush_master_secret}"
if [ ! -f "$SECRET_FILE" ]; then
echo "缺少极光 Master Secret 文件(已配置路径,不打印内容)" >&2
exit 1
fi
perm=$(stat -c '%a' "$SECRET_FILE" 2>/dev/null || stat -f '%OLp' "$SECRET_FILE")
if [ "$perm" != "600" ] && [ "$perm" != "400" ]; then
echo "Master Secret 文件权限应为 600 或 400(当前 $perm" >&2
exit 1
fi
len=$(wc -c < "$SECRET_FILE" | tr -d ' ')
if [ "$len" -lt 16 ] || [ "$len" -gt 64 ]; then
echo "Master Secret 文件长度异常(不打印内容)" >&2
exit 1
fi
JPUSH_MASTER_SECRET="$(tr -d '\n\r' < "$SECRET_FILE")"
export JPUSH_MASTER_SECRET
# 有意不 echo 该变量