1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/privatebin_ynh.git synced 2024-09-03 20:15:56 +02:00

Merge remote-tracking branch 'origin/public_pastes' into testing

This commit is contained in:
ericgaspar 2020-10-13 17:01:27 +02:00
commit 204989f3d9
No known key found for this signature in database
GPG key ID: 574F281483054D44
4 changed files with 36 additions and 2 deletions

View file

@ -49,6 +49,10 @@
"en": "Is it a public site?", "en": "Is it a public site?",
"fr": "Est-ce un site public ?" "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 "default": true
} }
] ]

View file

@ -76,6 +76,24 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi 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 # GENERIC FINALISATION
#================================================= #=================================================

View file

@ -105,8 +105,14 @@ ynh_script_progression --message="Configuring SSOwat..."
# If app is public, add url to SSOWat conf as skipped_uris # If app is public, add url to SSOWat conf as skipped_uris
if [ $is_public -eq 1 ]; then if [ $is_public -eq 1 ]; then
# unprotected_uris allows SSO credentials to be passed anyway. # unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" 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 fi
#================================================= #=================================================

View file

@ -143,6 +143,12 @@ ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
if [ $is_public -eq 1 ]; then if [ $is_public -eq 1 ]; then
# unprotected_uris allows SSO credentials to be passed anyway. # unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" 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 fi
#================================================= #=================================================