This commit is contained in:
vincent 2024-05-15 23:09:23 +08:00
parent a00fcfb091
commit cf58e785f8

View File

@ -1,16 +1,16 @@
#!/bin/bash
script_dir=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
config_dir="$script_dir/../conf"
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd) # 脚本文件绝对路径
CONFIG_DIR="$SCRIPT_DIR/../conf"
# 生成 UUID
uuid=$(xray uuid)
UUID=$(xray uuid)
# 使用 jq 修改 JSON 文件
jq ".inbounds[0].settings.clients[0].id=\"$uuid\"" $config_dir/config.json > $config_dir/config.json_tmp
jq ".inbounds[0].settings.clients[0].id=\"$UUID\"" $CONFIG_DIR/config.json > $CONFIG_DIR/config.json_tmp
# 替换原始文件
mv $config_dir/config.json_tmp $config_dir/config.json
mv $CONFIG_DIR/config.json_tmp $CONFIG_DIR/config.json
# 验证结果
echo "设置UUID成功."