diff --git a/check_process b/check_process index 4f8e79e..db55109 100644 --- a/check_process +++ b/check_process @@ -10,6 +10,9 @@ admin="john" (USER) is_public=1 (PUBLIC|public=1|private=0) language="fr" + dav_support=1 (DAV_SUPPORT|dav_support=1|dav_support=0) + signup=0 (SIGNUP|signup=1|signup=0) + two_factor=0 (TWO_FACTOR|two_factor=1|two_factor=0) ; Checks pkg_linter=1 setup_sub_dir=0 diff --git a/conf/.env b/conf/.env index a6e24b0..314e600 100644 --- a/conf/.env +++ b/conf/.env @@ -68,7 +68,7 @@ APP_DEFAULT_LOCALE=language # Ability to disable signups on your instance. # Can be true or false. Default to false. -APP_DISABLE_SIGNUP=false +APP_DISABLE_SIGNUP=__SIGNUP__ # Enable user email verification. APP_SIGNUP_DOUBLE_OPTIN=false @@ -132,10 +132,10 @@ AWS_BUCKET= AWS_SERVER= # Allow Two Factor Authentication feature on your instance -MFA_ENABLED=true +MFA_ENABLED=__TWO_FACTOR__ # Enable DAV support -DAV_ENABLED=true +DAV_ENABLED=__DAV__ # CLIENT ID and SECRET used for OAuth authentication PASSPORT_PERSONAL_ACCESS_CLIENT_ID=__IDENTITY__ diff --git a/manifest.json b/manifest.json index 122db16..dd6bcdd 100644 --- a/manifest.json +++ b/manifest.json @@ -70,6 +70,30 @@ }, "choices": ["cs","de","en","es","fr","he","it","nl","pt","ru","zh"], "default": "en" + }, + { + "name": "dav_support", + "type": "boolean", + "ask": { + "en": "Enable DAV support?" + }, + "default": true + }, + { + "name": "signup", + "type": "boolean", + "ask": { + "en": "Enable signup for public users?" + }, + "default": false + }, + { + "name": "two_factor", + "type": "boolean", + "ask": { + "en": "Enable Two Factor Authentication for accounts?" + }, + "default": false } ] } diff --git a/scripts/install b/scripts/install index f2dc7ba..d813fc2 100755 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,9 @@ language=$YNH_APP_ARG_LANGUAGE random_key=$(ynh_string_random --length=32) email=$(ynh_user_get_info $admin 'mail') password=$(ynh_string_random --length=8) +dav_support=$YNH_APP_ARG_DAV_SUPPORT +signup=$YNH_APP_ARG_SIGNUP +two_factor=$YNH_APP_ARG_TWO_FACTOR app=$YNH_APP_INSTANCE_NAME @@ -55,6 +58,9 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=random_key --value=$random_key +ynh_app_setting_set --app=$app --key=dav_support --value=$dav_support +ynh_app_setting_set --app=$app --key=signup --value=$signup +ynh_app_setting_set --app=$app --key=two_factor --value=$two_factor #================================================= # STANDARD MODIFICATIONS @@ -134,6 +140,30 @@ ynh_replace_string --match_string="yunobase" --replace_string="$db_name" --targe ynh_replace_string --match_string="yunomail" --replace_string="$email" --target_file="$config" ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config" ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config" +# Enable or disable DAV support for users +if [ $dav_support -eq 0 ] +then + ynh_replace_string --match_string="__DAV__" --replace_string="false" --target_file="$config" +else +then + ynh_replace_string --match_string="__DAV__" --replace_string="true" --target_file="$config" +fi +# Enable or disable signup for public users +if [ $signup -eq 1 ] +then + ynh_replace_string --match_string="__SIGNUP__" --replace_string="false" --target_file="$config" +else +then + ynh_replace_string --match_string="__SIGNUP__" --replace_string="true" --target_file="$config" +fi +# Enable or disable two factor authentication support for users +if [ $two_factor -eq 1 ] +then + ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="true" --target_file="$config" +else +then + ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="false" --target_file="$config" +fi #================================================= # DEPLOY @@ -141,8 +171,7 @@ ynh_replace_string --match_string="language" --replace_string="$language" --targ ynh_script_progression --message="Deploying..." pushd "$final_path" - php$phpversion artisan monica:update --force - php$phpversion artisan setup:production --email=$email --password=$password -vvv -n + php$phpversion artisan setup:production --email=$email --password=$password -vvv -n --force php$phpversion artisan passport:client --password -n > key.txt mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- ) mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- ) diff --git a/scripts/upgrade b/scripts/upgrade index cd9802e..7f9ecc6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,6 +28,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) random_key=$(ynh_app_setting_get --app=$app --key=random_key) email=$(ynh_user_get_info --username=$admin --key=mail) +dav_support=$(ynh_app_setting_get --app=$app --key=dav_support) +signup=$(ynh_app_setting_get --app=$app --key=signup) +two_factor=$(ynh_app_setting_get --app=$app --key=two_factor) #================================================= # CHECK VERSION @@ -165,6 +168,29 @@ ynh_replace_string --match_string="yunomail" --replace_string="$email" - ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config" ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" +if [ $dav_support -eq 0 ] +then + ynh_replace_string --match_string="__DAV__" --replace_string="false" --target_file="$config" +else +then + ynh_replace_string --match_string="__DAV__" --replace_string="true" --target_file="$config" +fi +# Enable or disable signup for public users +if [ $signup -eq 1 ] +then + ynh_replace_string --match_string="__SIGNUP__" --replace_string="false" --target_file="$config" +else +then + ynh_replace_string --match_string="__SIGNUP__" --replace_string="true" --target_file="$config" +fi +# Enable or disable two factor authentication support for users +if [ $two_factor -eq 1 ] +then + ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="true" --target_file="$config" +else +then + ynh_replace_string --match_string="__TWO_FACTOR__" --replace_string="false" --target_file="$config" +fi #================================================= # DEPLOYMENT