From d0842e2adcb0fb5cf842c3e2e0ad7dfc61c00acb Mon Sep 17 00:00:00 2001 From: Whispering Wind <151555003+ReturnFI@users.noreply.github.com> Date: Fri, 23 Aug 2024 13:55:12 +0330 Subject: [PATCH] Merging traffic data into users.json --- upgrade.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/upgrade.sh b/upgrade.sh index 8bd83dc..0095be5 100644 --- a/upgrade.sh +++ b/upgrade.sh @@ -1,4 +1,5 @@ #!/bin/bash + cd /root/ TEMP_DIR=$(mktemp -d) @@ -34,6 +35,16 @@ for FILE in "${FILES[@]}"; do cp "$TEMP_DIR/$FILE" "$FILE" done +echo "Merging traffic data into users.json" + +if [ -f /etc/hysteria/traffic_data.json ]; then + jq -s '.[0] * .[1]' /etc/hysteria/users.json /etc/hysteria/traffic_data.json > /etc/hysteria/users_temp.json + mv /etc/hysteria/users_temp.json /etc/hysteria/users.json + # rm /etc/hysteria/traffic_data.json +else + echo "No traffic_data.json found to merge." +fi + echo "Setting ownership and permissions" chown hysteria:hysteria /etc/hysteria/ca.key /etc/hysteria/ca.crt chmod 640 /etc/hysteria/ca.key /etc/hysteria/ca.crt