feat: Add web panel configuration management functions
This commit is contained in:
56
menu.sh
56
menu.sh
@ -688,6 +688,9 @@ webpanel_handler() {
|
||||
echo -e "${cyan}3.${NC} Get WebPanel URL"
|
||||
echo -e "${cyan}4.${NC} Show API Token"
|
||||
echo -e "${yellow}5.${NC} Reset WebPanel Credentials"
|
||||
echo -e "${yellow}6.${NC} Change Domain/Port"
|
||||
echo -e "${yellow}7.${NC} Change Root Path"
|
||||
echo -e "${yellow}8.${NC} Change Session Expiration"
|
||||
echo "0. Back"
|
||||
read -p "Choose an option: " option
|
||||
|
||||
@ -784,6 +787,57 @@ webpanel_handler() {
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
6)
|
||||
if ! systemctl is-active --quiet hysteria-webpanel.service; then
|
||||
echo -e "${red}WebPanel service is not running. Cannot perform this action.${NC}"
|
||||
else
|
||||
read -e -p "Enter new domain (leave blank to keep current): " new_domain
|
||||
read -e -p "Enter new port (leave blank to keep current): " new_port
|
||||
|
||||
if [ -z "$new_domain" ] && [ -z "$new_port" ]; then
|
||||
echo -e "${yellow}No changes specified. Aborting.${NC}"
|
||||
else
|
||||
local cmd_args=()
|
||||
if [ -n "$new_domain" ]; then
|
||||
cmd_args+=("--domain" "$new_domain")
|
||||
fi
|
||||
if [ -n "$new_port" ]; then
|
||||
cmd_args+=("--port" "$new_port")
|
||||
fi
|
||||
echo "Attempting to change domain/port..."
|
||||
python3 "$CLI_PATH" change-webpanel-domain-port "${cmd_args[@]}"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
7)
|
||||
if ! systemctl is-active --quiet hysteria-webpanel.service; then
|
||||
echo -e "${red}WebPanel service is not running. Cannot perform this action.${NC}"
|
||||
else
|
||||
read -e -p "Enter new root path (leave blank for random): " new_root_path
|
||||
local cmd_args=()
|
||||
if [ -n "$new_root_path" ]; then
|
||||
cmd_args+=("--path" "$new_root_path")
|
||||
fi
|
||||
echo "Attempting to change root path..."
|
||||
python3 "$CLI_PATH" change-webpanel-root "${cmd_args[@]}"
|
||||
fi
|
||||
;;
|
||||
8)
|
||||
if ! systemctl is-active --quiet hysteria-webpanel.service; then
|
||||
echo -e "${red}WebPanel service is not running. Cannot perform this action.${NC}"
|
||||
else
|
||||
while true; do
|
||||
read -e -p "Enter new session expiration in minutes: " new_minutes
|
||||
if [[ "$new_minutes" =~ ^[0-9]+$ ]]; then
|
||||
break
|
||||
else
|
||||
echo -e "${red}Error:${NC} Please enter a valid number."
|
||||
fi
|
||||
done
|
||||
echo "Attempting to change session expiration..."
|
||||
python3 "$CLI_PATH" change-webpanel-exp --minutes "$new_minutes"
|
||||
fi
|
||||
;;
|
||||
0)
|
||||
break
|
||||
;;
|
||||
@ -1162,4 +1216,4 @@ advance_menu() {
|
||||
}
|
||||
# Main function to run the script
|
||||
define_colors
|
||||
main_menu
|
||||
main_menu
|
||||
Reference in New Issue
Block a user