mirror of
https://github.com/YunoHost-Apps/hotspot_ynh.git
synced 2024-09-03 19:25:53 +02:00
[fix] redirection missing
This commit is contained in:
parent
2bfee6653a
commit
fd91c45396
1 changed files with 28 additions and 0 deletions
|
@ -214,6 +214,34 @@ ynh_app_config_apply() {
|
||||||
captive_portal=$(ynh_app_setting_get --app=$app --key=captive_portal)
|
captive_portal=$(ynh_app_setting_get --app=$app --key=captive_portal)
|
||||||
if [[ "$captive_portal" =~ 1 ]]
|
if [[ "$captive_portal" =~ 1 ]]
|
||||||
then
|
then
|
||||||
|
echo "location / {" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
if [[ "$captive_portal__1" == "1" ]]
|
||||||
|
then
|
||||||
|
echo " if (\$remote_addr ~ "^$ip4_nat_prefix__1.\d+$") {" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
|
||||||
|
echo " return 302 $captive_portal_url__1;" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
|
||||||
|
echo " }" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
fi
|
||||||
|
if [[ "$captive_portal__2" == "1" ]]
|
||||||
|
then
|
||||||
|
echo " if (\$remote_addr ~ "^$ip4_nat_prefix__2.\d+$") {" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
|
||||||
|
echo " return 302 $captive_portal_url__2;" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
|
||||||
|
echo " }" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
fi
|
||||||
|
if [[ "$captive_portal__3" == "1" ]]
|
||||||
|
then
|
||||||
|
echo " if (\$remote_addr ~ "^$ip4_nat_prefix__3.\d+$") {" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
|
||||||
|
echo " return 302 $captive_portal_url__3;" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
|
||||||
|
echo " }" > /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
fi
|
||||||
|
echo " return 302 https://\$http_host/yunohost/admin;" >> /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
echo "}" >> /etc/nginx/conf.d/default.d/redirect_to_admin.conf
|
||||||
|
|
||||||
ynh_systemd_action --service_name=captiveportal_fakedns --action="start" --log_path=systemd
|
ynh_systemd_action --service_name=captiveportal_fakedns --action="start" --log_path=systemd
|
||||||
else
|
else
|
||||||
ynh_systemd_action --service_name=captiveportal_fakedns --action="stop" --log_path=systemd
|
ynh_systemd_action --service_name=captiveportal_fakedns --action="stop" --log_path=systemd
|
||||||
|
|
Loading…
Add table
Reference in a new issue