1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00

keep is_public for readability

This commit is contained in:
Kay0u 2020-02-12 18:15:20 +07:00
parent d3b4829d7c
commit 5f9bc5b2c8
No known key found for this signature in database
GPG key ID: 7FF262C033518333
5 changed files with 16 additions and 2 deletions

View file

@ -12,6 +12,7 @@ if [ "$app" == __APP__ ]; then
if [ "$permission" = "upload images" ]; then
if [ "$added_groups" = "visitors" ]; then
ynh_app_setting_delete --app=$app --key=protected_regex
ynh_app_setting_set --app=$app --key=is_public --value=1
yunohost app ssowatconf
else

View file

@ -15,6 +15,7 @@ if [ "$app" == __APP__ ]; then
path_url=$(ynh_app_setting_get --app=$app --key=path)
domain_regex=$(echo "$domain" | sed 's@-@.@g')
ynh_app_setting_set --app=$app --key=protected_regex --value="$domain_regex$path_url/stats/?$","$domain_regex$path_url/manifest.webapp/?$","$domain_regex$path_url/?$","$domain_regex$path_url/[d-m]/.*$"
ynh_app_setting_set --app=$app --key=is_public --value=0
yunohost app ssowatconf
else

View file

@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Loading installation settings..." --weight=2
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
@ -121,7 +122,7 @@ fi
#=================================================
ynh_script_progression --message="Reconfiguring SSOwat..."
if [ ! -z $(ynh_app_setting_get --app=$app --key=protected_regex) ] # Only user with a yunohost account can upload an image
if [ $is_public -eq 0 ] # Only user with a yunohost account can upload an image
then
# If the app is private, viewing images stays publicly accessible.
if [ "$new_path" == "/" ]; then

View file

@ -49,6 +49,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=always_encrypt --value=$always_encrypt
ynh_app_setting_set --app=$app --key=overwrite_settings --value=1

View file

@ -20,6 +20,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
port=$(ynh_app_setting_get --app=$app --key=port)
always_encrypt=$(ynh_app_setting_get --app=$app --key=always_encrypt)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -47,6 +48,15 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
# Fix is_public as a boolean
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
if [ ! -z "$skipped_uris" ]; then
ynh_app_setting_delete --app=$app --key=skipped_uris
fi
@ -263,7 +273,7 @@ ynh_script_progression --message="Upgrading permission..."
if ! ynh_permission_exists --permission="upload images"
then
if [ -z $(ynh_app_setting_get --app=$app --key=protected_regex) ] # Everyone can upload image
if [ $is_public -eq 1 ] # Everyone can upload image
then
ynh_permission_create --permission="upload images" --allowed="visitors"
else # Only user with a yunohost account can upload an image