2018-09-30 11:51:17 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC STARTING
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2019-01-19 12:00:42 +01:00
|
|
|
source scripts/_common.sh
|
2018-09-30 11:51:17 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Get is_public
|
|
|
|
is_public=${YNH_ACTION_IS_PUBLIC}
|
|
|
|
|
|
|
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK IF ARGUMENTS ARE CORRECT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CHECK IF AN ACTION HAS TO BE DONE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
is_public_old=$(ynh_app_setting_get $app is_public)
|
|
|
|
|
|
|
|
if [ $is_public -eq $is_public_old ]
|
|
|
|
then
|
|
|
|
ynh_die "is_public is already set as $is_public." 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC ACTION
|
|
|
|
#=================================================
|
|
|
|
# MOVE TO PUBLIC OR PRIVATE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [ $is_public -eq 0 ]
|
|
|
|
then
|
|
|
|
ynh_app_setting_delete $app unprotected_uris
|
2019-01-19 12:13:45 +01:00
|
|
|
# Set the action.php script public for the cron task
|
2018-09-30 11:51:17 +02:00
|
|
|
ynh_app_setting_set $app skipped_uris "/action.php"
|
|
|
|
else
|
|
|
|
ynh_app_setting_delete $app skipped_uris
|
|
|
|
ynh_app_setting_set $app unprotected_uris "/"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Regen ssowat configuration
|
|
|
|
yunohost app ssowatconf
|
|
|
|
|
|
|
|
# Update the config of the app
|
|
|
|
ynh_app_setting_set $app is_public $is_public
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RELOAD NGINX
|
|
|
|
#=================================================
|
|
|
|
|
2019-01-19 12:00:42 +01:00
|
|
|
ynh_systemd_action --action=reload --service_name=nginx
|