1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/adguardhome_ynh.git synced 2024-09-03 18:06:23 +02:00
adguardhome_ynh/scripts/config
OniriCorpe 74d16e44d3
Update scripts/config
Co-authored-by: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com>
2023-12-27 00:08:17 +01:00

43 lines
1.6 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# SPECIFIC SETTERS
#=================================================
set__dns_over_https() {
if [ "$dns_over_https" == "true" ]; then
ynh_script_progression --message="Opening DoH and DoQ ports..."
# if DNS over HTTPS/QUIC is activated, open the associated ports
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP "$port_dns_over_http"
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP "$port_dns_over_http"
ynh_exec_warn_less yunohost firewall allow --no-upnp UDP "$port_dns_over_quic"
yunohost firewall reload
elif [ "$dns_over_https" == "false" ]; then
# else if false, close them
ynh_script_progression --message="Closing DoH and DoQ ports..."
ynh_exec_warn_less yunohost firewall disallow --no-upnp TCP "$port_dns_over_http"
ynh_exec_warn_less yunohost firewall disallow --no-upnp UDP "$port_dns_over_http"
ynh_exec_warn_less yunohost firewall disallow --no-upnp UDP "$port_dns_over_quic"
yunohost firewall reload
else
# else, throw error
ynh_print_warn --message="The variable 'dns_over_https' should be 'true' or 'false' but isn't, please report this."
fi
# save the new setting
ynh_app_setting_set "$app" dns_over_https "$dns_over_https"
}
ynh_app_config_run $1