1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

[enh] Config panel with useful parameters

This commit is contained in:
ljf 2023-12-10 23:10:07 +01:00
parent 37e8e2b82e
commit 40355e522b
No known key found for this signature in database
4 changed files with 45 additions and 53 deletions

View file

@ -1,5 +1,6 @@
{ {
"system": { "system": {
"maintenance": false,
"updatechecker": false, "updatechecker": false,
"memcache.local": "\\OC\\Memcache\\APCu", "memcache.local": "\\OC\\Memcache\\APCu",
"integrity.check.disabled": true, "integrity.check.disabled": true,
@ -12,6 +13,14 @@
"password": "" "password": ""
}, },
"hashing_default_password": true, "hashing_default_password": true,
"has_internet_connection": true,
"default_phone_region": "",
"default_timezone": "Europe/Paris",
"trashbin_retention_obligation": "auto",
"version_retention_obligation": "auto",
"enable_previews": true,
"defaultapp": "dashboard,files",
"lost_password_link": "",
"localstorage.allowsymlinks": true, "localstorage.allowsymlinks": true,
"simpleSignUpLink.shown": false, "simpleSignUpLink.shown": false,
"mail_smtpmode": "smtp", "mail_smtpmode": "smtp",

View file

@ -2,19 +2,20 @@ version = "1.0"
[main] [main]
name = "Nextcloud configuration" name = "Nextcloud configuration"
services = ["php8.2-fpm"]
[main.mode] [main.mode]
name = "Modes" name = "Modes"
[main.mode.maintenance_mode] [main.mode.maintenance]
ask = "Enable maintenance mode" ask = "Enable maintenance mode"
type = "boolean" type = "boolean"
default = "0" bind = ":__INSTALL_DIR__/config/config.php"
[main.mode.closed_network_mode] [main.mode.has_internet_connection]
ask = "Enable closed network mode" ask = "Enable closed network mode"
type = "boolean" type = "boolean"
default = "0" bind = ":__INSTALL_DIR__/config/config.php"
help = "Is Nextcloud connected to the Internet or running in a closed network?" help = "Is Nextcloud connected to the Internet or running in a closed network?"
[main.localization] [main.localization]
@ -23,14 +24,13 @@ name = "Nextcloud configuration"
[main.localization.default_phone_region] [main.localization.default_phone_region]
ask = "Default phone region" ask = "Default phone region"
type = "select" type = "select"
default = "0" bind = ":__INSTALL_DIR__/config/config.php"
help = "It is required to allow inserting phone numbers in the user profiles starting without the country code (e.g. +49 for Germany)." help = "It is required to allow inserting phone numbers in the user profiles starting without the country code (e.g. +49 for Germany)."
[main.localization.default_timezone] [main.localization.default_timezone]
ask = "Default timezone" ask = "Default timezone"
type = "select" type = "select"
bind = ":__INSTALL_DIR__/config/config.php" bind = ":__INSTALL_DIR__/config/config.php"
default = "Europe/Paris"
help = "The default timezone parameter is only used when the timezone of the user cant be determined." help = "The default timezone parameter is only used when the timezone of the user cant be determined."
[main.account] [main.account]
@ -40,7 +40,6 @@ name = "Nextcloud configuration"
ask = "Lost password link" ask = "Lost password link"
type = "url" type = "url"
bind = ":__INSTALL_DIR__/config/config.php" bind = ":__INSTALL_DIR__/config/config.php"
default = "0"
help = "Allow to redirect on a custom form to require a password reset (for example to ask you to reset it from this yunohost webadmin)" help = "Allow to redirect on a custom form to require a password reset (for example to ask you to reset it from this yunohost webadmin)"
[main.account.logout_url] [main.account.logout_url]
@ -52,50 +51,38 @@ name = "Nextcloud configuration"
[main.files] [main.files]
name = "Files" name = "Files"
[main.account.trashbin_retention_obligation] [main.files.trashbin_retention_obligation]
ask = "Trashbin retention" ask = "Trashbin retention"
type = "string" type = "string"
bind = ":__INSTALL_DIR__/config/config.php" bind = ":__INSTALL_DIR__/config/config.php"
default = "auto"
help = "If the trash bin app is enabled (default), this setting defines the policy for when files and folders in the trash bin will be permanently deleted." help = "If the trash bin app is enabled (default), this setting defines the policy for when files and folders in the trash bin will be permanently deleted."
[main.account.version_retention_obligation] [main.files.version_retention_obligation]
ask = "Version retention" ask = "Version retention"
type = "string" type = "string"
bind = ":__INSTALL_DIR__/config/config.php" bind = ":__INSTALL_DIR__/config/config.php"
default = "auto"
help = "If the versions app is enabled (default), this setting defines the policy for when versions will be permanently deleted." help = "If the versions app is enabled (default), this setting defines the policy for when versions will be permanently deleted."
[main.account.enable_previews] [main.files.enable_previews]
ask = "Enable previews" ask = "Enable previews"
type = "boolean" type = "boolean"
bind = ":__INSTALL_DIR__/config/config.php" bind = ":__INSTALL_DIR__/config/config.php"
default = "1"
help = "Info: Previews of photos and text documents could consume a lot of resources." help = "Info: Previews of photos and text documents could consume a lot of resources."
[main.apps] [main.apps]
name = "Apps" name = "Apps"
[main.account.auto_update] [main.apps.auto_update]
ask = "Auto update apps" ask = "Auto update apps"
type = "boolean" type = "boolean"
default = "1"
help = "Automatically update apps each night" help = "Automatically update apps each night"
[main.apps.defaultapp] [main.apps.defaultapp]
ask = "Default app to display" ask = "Default app to display"
type = "tags" type = "tags"
bind = ":__INSTALL_DIR__/config/config.php" bind = ":__INSTALL_DIR__/config/config.php"
default = "dashboard,files"
help = "Set the default app to open on login." help = "Set the default app to open on login."
[main.apps.appsallowlist]
ask = "List of apps installable"
type = "tags"
bind = ":__INSTALL_DIR__/config/config.php"
default = "all"
help = "Filters allowed installable apps from the appstore."
[main.php_fpm_config] [main.php_fpm_config]
name = "PHP-FPM configuration" name = "PHP-FPM configuration"

View file

@ -21,21 +21,21 @@ current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
#================================================= #=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY # SPECIFIC GETTERS FOR TOML SHORT KEY
#================================================= #=================================================
get__default_phone_region() {
cat << EOF
value: "$(ynh_read_var_in_file --file="$install_dir/config/config.php" --key="default_phone_region")"
choices:
EOF
jq '.[][] | " \"\(.alpha_2)\": \"\(.name)\""' -r /usr/share/iso-codes/json/iso_3166-1.json
get__maintenance_mode() { }
# Maintenance mode status
maintenance_mode_status="$(cd "$install_dir" && ynh_exec_as "$app" \ get__default_timezone() {
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode)" 2> /dev/null cat << EOF
if echo $maintenance_mode_status | grep -q "disabled" value: "$(ynh_read_var_in_file --file="$install_dir/config/config.php" --key="default_timezone")"
then choices:
echo "0" EOF
elif echo $maintenance_mode_status | grep -q "enabled" timedatectl list-timezones --no-pager | sed 's/^/ - /g'
then
echo "1"
else
ynh_print_err --message="Unexpected output from maintenance status check command."
exit 0
fi
} }
get__fpm_footprint() { get__fpm_footprint() {
@ -65,21 +65,6 @@ get__free_footprint() {
# SPECIFIC SETTERS FOR TOML SHORT KEYS # SPECIFIC SETTERS FOR TOML SHORT KEYS
#================================================= #=================================================
set__maintenance_mode() {
if [ "$maintenance_mode" -eq "0" ]; then
# If maintenance_mode was set to 0, disable maintenance mode
(cd "$install_dir" && ynh_exec_as "$app" \
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --off)
ynh_print_info "Maintenance mode disabled"
elif [ "$maintenance_mode" -eq "1" ]; then
# If maintenance_mode was set to 1, enable maintenance mode
(cd "$install_dir" && ynh_exec_as "$app" \
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --on)
ynh_print_info "Maintenance mode enabled"
fi
ynh_app_setting_set --app=$app --key=maintenance_mode --value="$maintenance_mode"
}
set__fpm_footprint() { set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ] if [ "$fpm_footprint" != "specific" ]
then then

View file

@ -24,12 +24,23 @@ phpflags="--define apc.enable_cli=1"
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_app_setting_set --app=$app --key=maintenance_mode --value=$maintenance_mode ynh_app_setting_set --app=$app --key=maintenance --value=$maintenance_mode
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
ynh_app_setting_set --app=$app --key=phpflags --value=$phpflags ynh_app_setting_set --app=$app --key=phpflags --value=$phpflags
ynh_app_setting_set --app=$app --key=has_internet_connection --value=1
ynh_app_setting_set --app=$app --key=default_phone_region --value=""
ynh_app_setting_set --app=$app --key=default_timezone --value="Europe/Paris"
ynh_app_setting_set --app=$app --key=lost_password_link --value=""
ynh_app_setting_set --app=$app --key=logout_url --value=""
ynh_app_setting_set --app=$app --key=trashbin_retention_obligation --value="auto"
ynh_app_setting_set --app=$app --key=version_retention_obligation --value="auto"
ynh_app_setting_set --app=$app --key=enable_previews --value=1
ynh_app_setting_set --app=$app --key=auto_update --value=1
ynh_app_setting_set --app=$app --key=defaultapp --value="dashboard,files"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================