feat: improve edit_subpath function with better error handling and efficient Caddy reload
- Add service status validation before editing subpath - Use systemctl reload for Caddy config changes - Add fallback to restart if reload fails - Enhance user feedback with old/new subpath comparison - Improve error handling and status verification
This commit is contained in:
5
menu.sh
5
menu.sh
@ -619,9 +619,8 @@ normalsub_handler() {
|
||||
elif ! [[ "$subpath" =~ [A-Z] ]] || ! [[ "$subpath" =~ [a-z] ]] || ! [[ "$subpath" =~ [0-9] ]]; then
|
||||
echo "Error: SUBPATH must include at least one uppercase letter, one lowercase letter, and one number."
|
||||
else
|
||||
sed -i "s|^SUBPATH=.*|SUBPATH=${subpath}|" "$NORMALSUB_ENV"
|
||||
systemctl restart hysteria-normal-sub.service
|
||||
echo "SUBPATH updated successfully!"
|
||||
python3 $CLI_PATH normal-sub -a edit_subpath -sp "$subpath"
|
||||
# echo "SUBPATH updated successfully!"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user