Codacy compliant

This commit is contained in:
Samuel Huang
2024-10-01 00:15:33 +10:00
parent 3ae14cfa24
commit c1f71bf1bb
18 changed files with 73 additions and 129 deletions

View File

@@ -7,10 +7,10 @@ usage() {
>&2 echo -e "User format: user|u=<uid>[:level:email]"
}
IFS=',' read -a options <<< "$1"
IFS=',' read -ra options <<< "$1"
for option in "${options[@]}"
do
IFS='=' read -a kv <<< "$option"
IFS='=' read -ra kv <<< "$option"
case "${kv[0]}" in
d|dest)
dest="${kv[1]}"
@@ -64,7 +64,7 @@ fi
if [ -z "${prvkey}" ]; then
>&2 echo -e "Warning: PrivateKey undefined, Generated new...\n"
kv=($(/usr/local/bin/xray x25519|cut -d ' ' -f3|tr ' '))
read -ra kv <<< "$(/usr/local/bin/xray x25519|cut -d ' ' -f3|tr '\r\n' ' ')"
prvkey="${kv[0]}"
pubkey="${kv[1]}"
>&2 echo -e "PublicKey: $pubkey\n"
@@ -88,7 +88,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
# User settings
for user in "${xuser[@]}"
do
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
unset IFS
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
@@ -136,5 +136,5 @@ do
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
done
echo $inbound
echo "$inbound"
exit 0