客户端默认指向 jxd.jinniu.ink 的 HTTPS/WSS;登录后把 OpenIM userID 设为极光 alias。 华为 agconnect-services.json 不伪造、不入库。Master Secret 只从服务器文件注入。 Co-authored-by: multica-agent <github@multica.ai>
28 lines
924 B
Bash
Executable File
28 lines
924 B
Bash
Executable File
#!/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 该变量
|