Added an option to change SUBPATH

This commit is contained in:
Whispering Wind
2025-02-28 14:39:17 +03:30
committed by GitHub
parent a5dd5f6f9f
commit 3a2b769234

20
menu.sh
View File

@ -532,6 +532,7 @@ normalsub_handler() {
while true; do while true; do
echo -e "${cyan}1.${NC} Start Normal-Sub service" echo -e "${cyan}1.${NC} Start Normal-Sub service"
echo -e "${red}2.${NC} Stop Normal-Sub service" echo -e "${red}2.${NC} Stop Normal-Sub service"
echo -e "${yellow}3.${NC} Change SUBPATH"
echo "0. Back" echo "0. Back"
read -p "Choose an option: " option read -p "Choose an option: " option
@ -570,6 +571,25 @@ normalsub_handler() {
python3 $CLI_PATH normal-sub -a stop python3 $CLI_PATH normal-sub -a stop
fi fi
;; ;;
3)
if ! systemctl is-active --quiet hysteria-normal-sub.service; then
echo "Error: The hysteria-normal-sub.service is not active. Start the service first."
continue
fi
while true; do
read -e -p "Enter new SUBPATH (Must include Uppercase, Lowercase, and Numbers): " subpath
if [[ -z "$subpath" ]]; then
echo "Error: SUBPATH cannot be empty. Please try again."
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"
echo "SUBPATH updated successfully!"
break
fi
done
;;
0) 0)
break break
;; ;;