Fix some bugs related to webpanel
This commit is contained in:
13
core/cli.py
13
core/cli.py
@ -415,17 +415,16 @@ def webpanel(action: str, domain: str, port: int, admin_username: str, admin_pas
|
||||
raise click.UsageError('Error: the --domain, --port, --admin-username, and --admin-password are required for the start action.')
|
||||
|
||||
cli_api.start_webpanel(domain, port, admin_username, admin_password, expiration_minutes, debug)
|
||||
|
||||
services_status = cli_api.get_services_status()
|
||||
if not services_status:
|
||||
raise click.Abort('Error: WebPanel services status not available.')
|
||||
|
||||
if not services_status.get('hysteria-webpanel'):
|
||||
if not services_status.get('hysteria-webpanel.service'):
|
||||
raise click.Abort('Error: hysteria-webpanel.service service is not running.')
|
||||
|
||||
if not services_status.get('hysteria-caddy'):
|
||||
if not services_status.get('hysteria-caddy.service'):
|
||||
raise click.Abort('Error: hysteria-caddy.service service is not running.')
|
||||
|
||||
url = cli_api.get_webpanel_url()
|
||||
# url = cli_api.get_webpanel_url()
|
||||
click.echo(f'Hysteria web panel is now running. The service is accessible on: {url}')
|
||||
elif action == 'stop':
|
||||
cli_api.stop_webpanel()
|
||||
@ -456,8 +455,8 @@ def get_web_panel_api_token():
|
||||
def get_web_panel_services_status():
|
||||
try:
|
||||
if services_status := cli_api.get_services_status():
|
||||
webpanel_status = services_status.get('hysteria-webpanel', False)
|
||||
caddy_status = services_status.get('hysteria-caddy', False)
|
||||
webpanel_status = services_status.get('hysteria-webpanel.service', False)
|
||||
caddy_status = services_status.get('hysteria-caddy.service', False)
|
||||
print(f"hysteria-webpanel.service: {'Active' if webpanel_status else 'Inactive'}")
|
||||
print(f"hysteria-caddy.service: {'Active' if caddy_status else 'Inactive'}")
|
||||
else:
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
source /etc/hysteria/core/scripts/path.sh
|
||||
source /etc/hysteria/core/scripts/services_status.sh
|
||||
|
||||
# Function to define colors
|
||||
define_colors() {
|
||||
@ -90,7 +89,7 @@ load_hysteria2_ips() {
|
||||
}
|
||||
|
||||
check_services() {
|
||||
|
||||
source /etc/hysteria/core/scripts/services_status.sh
|
||||
for service in "${services[@]}"; do
|
||||
service_base_name=$(basename "$service" .service)
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ define_colors
|
||||
CADDY_CONFIG_FILE="/etc/hysteria/core/scripts/webpanel/Caddyfile"
|
||||
|
||||
install_dependencies() {
|
||||
# Update system
|
||||
# Update system
|
||||
sudo apt update -y > /dev/null 2>&1
|
||||
|
||||
# Install dependencies
|
||||
|
||||
Reference in New Issue
Block a user