1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zerobin_ynh.git synced 2024-09-03 18:06:01 +02:00

Allow pastes to be seen in private

This commit is contained in:
maniack 2020-03-08 20:09:34 +01:00
parent 9f8c858d69
commit 5ff45db4d1
4 changed files with 36 additions and 2 deletions

View file

@ -49,6 +49,10 @@
"en": "Is it a public Zerobin site ?",
"fr": "Est-ce un site public ?"
},
"help": {
"en": "If private, only YunoHost users can create a paste, but everyone can read it.",
"fr": "Si privé, seul les utilisateurs YunoHost peuvent créer un paste, mais tout le monde peut lire."
},
"default": true
}
]

View file

@ -75,6 +75,24 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# UPDATE SSOWAT
#=================================================
ynh_script_progression --message="Reconfiguring SSOwat..."
if [ $is_public -eq 0 ]
then
# If the app is private, viewing images stays publicly accessible.
if [ "$new_path" == "/" ]; then
# If the path is /, clear it to prevent any error with the regex.
new_path=""
fi
# Modify the domain to be used in a regex
domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$new_path/$"
ynh_app_setting_set --app=$app --key=unprotected_regex --value="$domain_regex$new_path/.*$"
fi
#=================================================
# GENERIC FINALISATION
#=================================================

View file

@ -107,6 +107,12 @@ ynh_script_progression --message="Configuring SSOwat..."
if [ $is_public -eq 1 ]; then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
else
# If the app is private, viewing paste stays publicly accessible.
# Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/$"
ynh_app_setting_set --app=$app --key=unprotected_regex --value="$domain_regex$path_url/.*$"
fi
#=================================================

View file

@ -142,6 +142,12 @@ ynh_script_progression --message="Upgrading SSOwat configuration..."
if [ $is_public -eq 1 ]; then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
else
# If the app is private, viewing paste stays publicly accessible.
# Modify the domain to be used in a regex
domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/$"
ynh_app_setting_set --app=$app --key=unprotected_regex --value="$domain_regex$path_url/.*$"
fi
#=================================================