1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jellyfin_ynh.git synced 2024-09-03 19:26:29 +02:00

Offer to open discovery ports in restore and upgrade

This commit is contained in:
tituspijean 2021-05-26 17:04:08 +02:00
parent 430685b8d1
commit 2784b22d18
2 changed files with 52 additions and 0 deletions

View file

@ -51,6 +51,32 @@ fi
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# OPEN PORTS
#=================================================
if [ $discovery -eq 1 ]; then
ynh_script_progression --message="Configuring firewall..." --time --weight=1
# Open port 1900 for service auto-discovery
if ynh_port_available --port=1900; then
ynh_exec_warn_less yunohost firewall allow UDP 1900
ynh_app_setting_set --app=$app --key=discovery_service --value=1
else
ynh_print_warn --message="Port 1900 (for service auto-discovery) is not available. Continuing nonetheless."
ynh_app_setting_set --app=$app --key=discovery_service --value=0
fi
# Open port 7359 for client auto-discovery
if ynh_port_available --port=7359; then
ynh_exec_warn_less yunohost firewall allow UDP 7359
ynh_app_setting_set --app=$app --key=discovery_client --value=1
else
ynh_print_warn --message="Port 7359 (for client auto-discovery) is not available. Continuing nonetheless."
ynh_app_setting_set --app=$app --key=discovery_client --value=0
fi
fi
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================

View file

@ -87,6 +87,32 @@ ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# OPEN PORTS
#=================================================
if [ $discovery -eq 1 ]; then
ynh_script_progression --message="Configuring firewall..." --time --weight=1
# Open port 1900 for service auto-discovery
if ynh_port_available --port=1900; then
ynh_exec_warn_less yunohost firewall allow UDP 1900
ynh_app_setting_set --app=$app --key=discovery_service --value=1
else
ynh_print_warn --message="Port 1900 (for service auto-discovery) is not available. Continuing nonetheless."
ynh_app_setting_set --app=$app --key=discovery_service --value=0
fi
# Open port 7359 for client auto-discovery
if ynh_port_available --port=7359; then
ynh_exec_warn_less yunohost firewall allow UDP 7359
ynh_app_setting_set --app=$app --key=discovery_client --value=1
else
ynh_print_warn --message="Port 7359 (for client auto-discovery) is not available. Continuing nonetheless."
ynh_app_setting_set --app=$app --key=discovery_client --value=0
fi
fi
#=================================================
# STOP SYSTEMD SERVICE
#=================================================