feat(脚本): 首次安装时可以自定义用户名、批量添加用户时可自定义email、修改批量添加用户时只添加一个的问题

pull/813/head
mack-a 2023-10-18 17:54:27 +08:00
parent 68dc7554c5
commit ac180a99d1
1 changed files with 18 additions and 20 deletions

View File

@ -3701,6 +3701,11 @@ initXrayConfig() {
uuid=$(/etc/v2ray-agent/xray/xray uuid)
fi
echoContent yellow "\n请输入自定义用户名[需合法][回车]随机随机用户名"
read -r -p '用户名:' customEmail
if [[ -z ${customEmail} ]]; then
customEmail="$(echo "${uuid}" | cut -d "-" -f 1)-VLESS_TCP/TLS_Vision"
fi
fi
if [[ -z "${addClientsStatus}" && -z "${uuid}" ]]; then
@ -3710,8 +3715,8 @@ initXrayConfig() {
fi
if [[ -n "${uuid}" ]]; then
currentClients='[{"id":"'${uuid}'","add":"'${add}'","flow":"xtls-rprx-vision","email":"'${uuid}'-VLESS_TCP/TLS_Vision"}]'
echoContent yellow "\n ${uuid}"
currentClients='[{"id":"'${uuid}'","add":"'${add}'","flow":"xtls-rprx-vision","email":"'${customEmail}'"}]'
echoContent yellow "\n ${customEmail}:${uuid}"
fi
# log
@ -5063,7 +5068,6 @@ customUserEmail() {
# 添加用户
addUserXray() {
readConfigHostPathUUID
read -r -p "请输入要添加的用户数量:" userNum
echo
if [[ -z ${userNum} || ${userNum} -le 0 ]]; then
@ -5071,26 +5075,21 @@ addUserXray() {
exit 0
fi
# 生成用户
if [[ "${userNum}" == "1" ]]; then
customUUID
customUserEmail
fi
# if [[ "${userNum}" == "1" ]]; then
# customUUID
# customUserEmail
# fi
while [[ ${userNum} -gt 0 ]]; do
readConfigHostPathUUID
local users=
((userNum--)) || true
if [[ -n "${currentCustomUUID}" ]]; then
uuid=${currentCustomUUID}
else
uuid=$(${ctlPath} uuid)
fi
local email=
if [[ -z "${currentCustomEmail}" ]]; then
email=${uuid}
else
email=${currentCustomEmail}
fi
customUUID
customUserEmail
uuid=${currentCustomUUID}
email=${currentCustomEmail}
# VLESS TCP
if echo "${currentInstallProtocolType}" | grep -q 0; then
@ -5174,7 +5173,6 @@ addUserXray() {
echo "${clients}" | jq . >"${singBoxConfigPath}config/tuic.json"
fi
done
reloadCore
echoContent green " ---> 添加完成"
manageAccount 1
@ -8153,7 +8151,7 @@ menu() {
cd "$HOME" || exit
echoContent red "\n=============================================================="
echoContent green "作者mack-a"
echoContent green "当前版本v2.11.5"
echoContent green "当前版本v2.11.6"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c"
showInstallStatus