mirror of
https://github.com/YunoHost-Apps/lstu_ynh.git
synced 2024-09-03 19:36:12 +02:00
Fix public/private
This commit is contained in:
parent
ea879356a5
commit
4b906ee1c9
4 changed files with 47 additions and 16 deletions
|
@ -76,10 +76,16 @@ else
|
||||||
public_private="public"
|
public_private="public"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
if [ $is_public -eq 0 ]
|
||||||
if [ $is_public -eq 0 ];
|
then
|
||||||
then # If the app is private, only the shortened URLs are publics
|
# If the app is private, only the shortened URLs are publics.
|
||||||
ynh_app_setting_set $app protected_regex "/login$","/logout$","/api$","/extensions$","/stats$","/d/.*$","/a$","/$"
|
if [ "$path_url" == "/" ]; then
|
||||||
|
# If the path is /, clear it to prevent any error with the regex.
|
||||||
|
path_url=""
|
||||||
|
fi
|
||||||
|
# Modify the domain to be used in a regex
|
||||||
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
|
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/login$","$domain_regex$path_url/logout$","$domain_regex$path_url/api$","$domain_regex$path_url/extensions$","$domain_regex$path_url/stats$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/a$","$domain_regex$path_url/$"
|
||||||
else
|
else
|
||||||
ynh_app_setting_delete $app protected_regex
|
ynh_app_setting_delete $app protected_regex
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -127,6 +127,23 @@ ynh_store_file_checksum "${final_path}/lstu.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
#=================================================
|
||||||
|
# UPDATE SSOWAT
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info "Reconfigure SSOwat"
|
||||||
|
|
||||||
|
if [ $is_public -eq 0 ]
|
||||||
|
then
|
||||||
|
# If the app is private, only the shortened URLs are publics.
|
||||||
|
if [ "$path_url" == "/" ]; then
|
||||||
|
# If the path is /, clear it to prevent any error with the regex.
|
||||||
|
path_url=""
|
||||||
|
fi
|
||||||
|
# Modify the domain to be used in a regex
|
||||||
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
|
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/login$","$domain_regex$path_url/logout$","$domain_regex$path_url/api$","$domain_regex$path_url/extensions$","$domain_regex$path_url/stats$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/a$","$domain_regex$path_url/$"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART LSTU
|
# RESTART LSTU
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -182,13 +182,17 @@ yunohost service add $app --log "/var/log/$app.log" --log "/var/www/$app/log/pro
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Configuring SSOwat..."
|
ynh_print_info "Configuring SSOwat..."
|
||||||
|
|
||||||
# Make app public or private
|
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
if [ $is_public -eq 0 ];
|
if [ $is_public -eq 0 ]
|
||||||
then # If the app is private, only the shortened URLs are publics
|
then
|
||||||
ynh_app_setting_set $app protected_regex "/login$","/logout$","/api$","/extensions$","/stats$","/d/.*$","/a$","/$"
|
# If the app is private, only the shortened URLs are publics.
|
||||||
else
|
if [ "$path_url" == "/" ]; then
|
||||||
ynh_app_setting_delete $app protected_regex
|
# If the path is /, clear it to prevent any error with the regex.
|
||||||
|
path_url=""
|
||||||
|
fi
|
||||||
|
# Modify the domain to be used in a regex
|
||||||
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
|
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/login$","$domain_regex$path_url/logout$","$domain_regex$path_url/api$","$domain_regex$path_url/extensions$","$domain_regex$path_url/stats$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/a$","$domain_regex$path_url/$"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -196,13 +196,17 @@ ynh_systemd_action -n $app -a reload -l "Reloaded Shortened URLs service." -p "s
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading SSOwat configuration..."
|
ynh_print_info "Upgrading SSOwat configuration..."
|
||||||
|
|
||||||
# Make app public or private
|
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
if [ $is_public -eq 0 ];
|
if [ $is_public -eq 0 ]
|
||||||
then # If the app is private, only the shortened URLs are publics
|
then
|
||||||
ynh_app_setting_set $app protected_regex "/login$","/logout$","/api$","/extensions$","/stats$","/d/.*$","/a$","/$"
|
# If the app is private, only the shortened URLs are publics.
|
||||||
else
|
if [ "$path_url" == "/" ]; then
|
||||||
ynh_app_setting_delete $app protected_regex
|
# If the path is /, clear it to prevent any error with the regex.
|
||||||
|
path_url=""
|
||||||
|
fi
|
||||||
|
# Modify the domain to be used in a regex
|
||||||
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
|
ynh_app_setting_set $app protected_regex "$domain_regex$path_url/login$","$domain_regex$path_url/logout$","$domain_regex$path_url/api$","$domain_regex$path_url/extensions$","$domain_regex$path_url/stats$","$domain_regex$path_url/d/.*$","$domain_regex$path_url/a$","$domain_regex$path_url/$"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue