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