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

@ -41,13 +41,13 @@ add_user() {
traffic=$((traffic_gb * 1073741824))
if [ ! -f "/etc/hysteria/users/users.json" ]; then
echo "{}" > /etc/hysteria/users/users.json
if [ ! -f "/etc/hysteria/users.json" ]; then
echo "{}" > /etc/hysteria/users.json
fi
jq --arg username "$username" --arg password "$password" --argjson traffic "$traffic" --argjson expiration_days "$expiration_days" --arg creation_date "$creation_date" \
'.[$username] = {password: $password, max_download_bytes: $traffic, expiration_days: $expiration_days, account_creation_date: $creation_date, blocked: false}' \
/etc/hysteria/users/users.json > /etc/hysteria/users/users_temp.json && mv /etc/hysteria/users/users_temp.json /etc/hysteria/users/users.json
/etc/hysteria/users.json > /etc/hysteria/users_temp.json && mv /etc/hysteria/users_temp.json /etc/hysteria/users.json
python3 /etc/hysteria/core/cli.py restart-hysteria2 > /dev/null 2>&1