Fix path related issues

This commit is contained in:
Sarina
2024-07-21 21:32:11 +03:30
parent 484821c499
commit 14f61134dc
5 changed files with 13 additions and 13 deletions

View File

@ -9,10 +9,10 @@ remove_user() {
username=$1
if [ -f "/etc/hysteria/users/users.json" ]; then
if [ -f "/etc/hysteria/users.json" ]; then
# Check if the username exists in the users.json file
if jq -e "has(\"$username\")" /etc/hysteria/users/users.json > /dev/null; then
jq --arg username "$username" 'del(.[$username])' /etc/hysteria/users/users.json > /etc/hysteria/users/users_temp.json && mv /etc/hysteria/users/users_temp.json /etc/hysteria/users/users.json
if jq -e "has(\"$username\")" /etc/hysteria/users.json > /dev/null; then
jq --arg username "$username" 'del(.[$username])' /etc/hysteria/users.json > /etc/hysteria/users_temp.json && mv /etc/hysteria/users_temp.json /etc/hysteria/users.json
if [ -f "/etc/hysteria/traffic_data.json" ]; then
jq --arg username "$username" 'del(.[$username])' /etc/hysteria/traffic_data.json > /etc/hysteria/traffic_data_temp.json && mv /etc/hysteria/traffic_data_temp.json /etc/hysteria/traffic_data.json
@ -24,7 +24,7 @@ remove_user() {
echo -e "\033[0;31mError:\033[0m User $username not found."
fi
else
echo -e "\033[0;31mError:\033[0m Config file /etc/hysteria/users/users.json not found."
echo -e "\033[0;31mError:\033[0m Config file /etc/hysteria/users.json not found."
fi
}