1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/redirect_ynh.git synced 2024-09-03 20:16:10 +02:00

Add option for the yunohost overlay

This commit is contained in:
Salamandar 2024-01-10 18:42:13 +01:00
parent d63b681d7c
commit 66e773d73d
6 changed files with 30 additions and 4 deletions

View file

@ -9,12 +9,12 @@ location __PATH__/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port $server_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding';
__OVERLAY_COMMENT__# Include SSOWAT user panel.
__OVERLAY_COMMENT__include conf.d/yunohost_panel.conf.inc;
__OVERLAY_COMMENT__more_clear_input_headers 'Accept-Encoding';
}

View file

@ -48,6 +48,12 @@ ram.runtime = "50M"
type = "url"
help = "This may be something like https://some.other.website (for explicit redirect) or http://127.0.0.1:1234 for reverse-proxies."
[install.ynh_overlay]
ask.en = "Enable the YunoHost button overlay"
ask.fr = "Active le button superposé YunoHost"
type = "boolean"
default = true
[install.init_main_permission]
type = "group"
default = "visitors"

View file

@ -14,3 +14,12 @@ _validate_redirect_uri() {
ynh_die --message="For secure reason, you can't use an unencrypted http remote destination couple with ssowat for your reverse proxy: $target" 1
fi
}
_set_ynh_overlay() {
# Set the comment (or not) for the yunohost overlay
overlay_comment=""
if [[ "$ynh_overlay" == 0 ]]; then
overlay_comment="# "
fi
ynh_app_setting_set --app=$app --key=overlay_comment --value="$overlay_comment"
}

View file

@ -9,6 +9,8 @@
source _common.sh
source /usr/share/yunohost/helpers
_set_ynh_overlay
#=================================================
# STANDARD MODIFICATIONS
#=================================================

View file

@ -11,6 +11,8 @@ source /usr/share/yunohost/helpers
_validate_redirect_uri
_set_ynh_overlay
#=================================================
# CONFIGURE NGINX
#=================================================

View file

@ -20,6 +20,13 @@ if [[ -z "${target:-}" ]] && [[ -n "${redirect_path:-}" ]]; then
ynh_app_setting_set --app=$app --key=target --value="$target"
fi
if [[ -z "${ynh_overlay:-}" ]]; then
ynh_overlay=1
ynh_app_setting_set --app=$app --key=ynh_overlay --value="$ynh_overlay"
fi
_set_ynh_overlay
#=================================================
# CONFIGURE NGINX
#=================================================