From 2f54c3f32bcb1245cd05b24e4965c2d70d18ee18 Mon Sep 17 00:00:00 2001 From: Kayou Date: Fri, 1 Mar 2019 12:16:59 +0100 Subject: [PATCH 1/3] Acces to "adminstuds.php" when app is in public --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 0dee5b2..66a55ed 100644 --- a/scripts/install +++ b/scripts/install @@ -183,7 +183,7 @@ if [ $is_public -eq 0 ]; then ynh_app_setting_set "$app" protected_uris "/" else - ynh_app_setting_set "$app" protected_uris "/admin" + ynh_app_setting_set "$app" protected_regex "/admin/" ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf" ynh_store_file_checksum "$finalnginxconf" From ec53481d68138d8d6867f4ae8609fa782e58e72d Mon Sep 17 00:00:00 2001 From: Kayou Date: Fri, 1 Mar 2019 12:19:33 +0100 Subject: [PATCH 2/3] Acces to "adminstuds.php" when app is in public --- scripts/upgrade | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index ea6424c..9eed528 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -211,7 +211,9 @@ if [ $is_public -eq 0 ]; then ynh_app_setting_set "$app" protected_uris "/" else - ynh_app_setting_set "$app" protected_uris "/admin" + ynh_app_setting_delete "$app" protected_uris + ynh_app_setting_set "$app" protected_regex "/admin/" + ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf" ynh_store_file_checksum "$finalnginxconf" From 5d3d2ff67d8724e316d0e8f27c5dfa7949df4720 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Thu, 28 Mar 2019 15:37:23 +0100 Subject: [PATCH 3/3] Fix the regex --- scripts/install | 10 +++++++++- scripts/upgrade | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 66a55ed..dd75135 100644 --- a/scripts/install +++ b/scripts/install @@ -183,7 +183,15 @@ if [ $is_public -eq 0 ]; then ynh_app_setting_set "$app" protected_uris "/" else - ynh_app_setting_set "$app" protected_regex "/admin/" + # If the app is private, viewing images stays publicly accessible. + 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/admin/" + ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf" ynh_store_file_checksum "$finalnginxconf" diff --git a/scripts/upgrade b/scripts/upgrade index 9eed528..2889cf0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -212,7 +212,15 @@ then ynh_app_setting_set "$app" protected_uris "/" else ynh_app_setting_delete "$app" protected_uris - ynh_app_setting_set "$app" protected_regex "/admin/" + + # If the app is private, viewing images stays publicly accessible. + 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/admin/" ynh_replace_string " include conf.d/" " #include conf.d/" "$finalnginxconf"