This commit is contained in:
vincent
2024-05-15 23:08:42 +08:00
parent 2c17d5a27d
commit a00fcfb091
2 changed files with 12 additions and 12 deletions
+6 -6
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"
# Save keys to key.txt
xray x25519 > $config_dir/key.txt
xray x25519 > $CONFIG_DIR/key.txt
private_key=$(grep "Private key" $config_dir/key.txt | awk -F ': ' '{print $2}')
PRIVATE_KEY=$(grep "Private key" $CONFIG_DIR/key.txt | awk -F ': ' '{print $2}')
# 修改config.json密钥属性
jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$private_key\"" $config_dir/config.json > $config_dir/config_temp.json
mv $config_dir/config_temp.json $config_dir/config.json
jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$PRIVATE_KEY\"" $CONFIG_DIR/config.json > $CONFIG_DIR/config_temp.json
mv $CONFIG_DIR/config_temp.json $CONFIG_DIR/config.json
echo "生成和设置密钥成功."