From e53a554938904b36efb9bf732ef0629f3610e7f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 25 Jan 2022 19:28:10 +0100 Subject: [PATCH] Fix config panel (#19) * Fix * Update upgrade * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> * Update config_panel.toml Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> Co-authored-by: Tagada <36127788+Tagadda@users.noreply.github.com> --- conf/.env.production.sample | 22 ++++++------ config_panel.toml | 24 ++++++------- scripts/install | 23 +++++++++++++ scripts/upgrade | 67 +++++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 23 deletions(-) diff --git a/conf/.env.production.sample b/conf/.env.production.sample index d15d443..b597d2b 100644 --- a/conf/.env.production.sample +++ b/conf/.env.production.sample @@ -254,31 +254,31 @@ LDAP_TLS_NO_VERIFY=true # --------------- # Maximum allowed character count -MAX_TOOT_CHARS=500 +MAX_TOOT_CHARS=__MAX_TOOT_CHARS__ # Maximum number of pinned posts -MAX_PINNED_TOOTS=5 +MAX_PINNED_TOOTS=__MAX_PINNED_TOOTS__ # Maximum allowed bio characters -MAX_BIO_CHARS=500 +MAX_BIO_CHARS=__MAX_BIO_CHARS__ # Maximim number of profile fields allowed -MAX_PROFILE_FIELDS=4 +MAX_PROFILE_FIELDS=__MAX_PROFILE_FIELDS__ # Maximum allowed display name characters -MAX_DISPLAY_NAME_CHARS=30 +MAX_DISPLAY_NAME_CHARS=__MAX_DISPLAY_NAME_CHARS__ # Maximum allowed poll options -MAX_POLL_OPTIONS=5 +MAX_POLL_OPTIONS=__MAX_POLL_OPTIONS__ # Maximum allowed poll option characters -MAX_POLL_OPTION_CHARS=100 +MAX_POLL_OPTION_CHARS=__MAX_POLL_OPTION_CHARS__ # Maximum image and video/audio upload sizes # Units are in bytes # 1048576 bytes equals 1 megabyte -MAX_IMAGE_SIZE=8388608 -MAX_VIDEO_SIZE=41943040 +MAX_IMAGE_SIZE=__MAX_IMAGE_SIZE__ +MAX_VIDEO_SIZE=__MAX_VIDEO_SIZE__ # Maximum search results to display # Only relevant when elasticsearch is installed @@ -288,5 +288,5 @@ MAX_VIDEO_SIZE=41943040 # If undefined or smaller than MAX_EMOJI_SIZE, the value # of MAX_EMOJI_SIZE will be used for MAX_REMOTE_EMOJI_SIZE # Units are in bytes -MAX_EMOJI_SIZE=51200 -MAX_REMOTE_EMOJI_SIZE=204800 +MAX_EMOJI_SIZE=__MAX_EMOJI_SIZE__ +MAX_REMOTE_EMOJI_SIZE=__MAX_REMOTE_EMOJI_SIZE__ diff --git a/config_panel.toml b/config_panel.toml index c1bcc1c..28b5909 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -1,7 +1,7 @@ version = "1.0" [main] -name = "Main configuration" +name = "Glitchsoc configuration" services = ["__APP__-web", "__APP__-sidekiq", "__APP__-streaming"] [main.customization] @@ -11,64 +11,64 @@ services = ["__APP__-web", "__APP__-sidekiq", "__APP__-streaming"] ask = "Maximum allowed character count in a toot" type = "number" example = "500" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_pinned_toots] ask = "Maximum number of pinned posts" type = "number" example = "5" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_bio_chars] ask = "Maximum allowed bio characters" type = "number" example = "500" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_profile_fields] ask = "Maximim number of profile fields allowed" type = "number" example = "4" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_display_name_chars] ask = "Maximum allowed bio characters" type = "number" example = "30" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_poll_options] ask = "Maximum allowed poll options" type = "number" example = "5" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_poll_option_chars] ask = "Maximum allowed poll option characters" type = "number" example = "100" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_image_size] ask = "Maximum image upload size, in bytes" type = "number" example = "8388608" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_video_size] ask = "Maximum video and audio upload sizes, in bytes" type = "number" example = "41943040" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_emoji_size] ask = "Maximum custom emoji file sizes" type = "number" example = "51200" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" [main.customization.max_remote_emoji_size] ask = "Maximum remote custom emoji file sizes" type = "number" example = "204800" - bind = ":/var/www/__APP__/live/.env.production" + bind = ":__FINALPATH__/live/.env.production" diff --git a/scripts/install b/scripts/install index ad72e5f..14893b0 100644 --- a/scripts/install +++ b/scripts/install @@ -32,6 +32,18 @@ admin_mail=$(ynh_user_get_info $admin 'mail') app=$YNH_APP_INSTANCE_NAME +max_toot_chars="500" +max_pinned_toots="5" +max_bio_chars="500" +max_profile_fields="4" +max_display_name_chars="30" +max_poll_options="5" +max_poll_option_chars="100" +max_image_size="8388608" +max_video_size="41943040" +max_emoji_size="51200" +max_remote_emoji_size="204800" + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -52,6 +64,17 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=max_toot_chars --value=$max_toot_chars +ynh_app_setting_set --app=$app --key=max_pinned_toots --value=$max_pinned_toots +ynh_app_setting_set --app=$app --key=max_bio_chars --value=$max_bio_chars +ynh_app_setting_set --app=$app --key=max_profile_fields --value=$max_profile_fields +ynh_app_setting_set --app=$app --key=max_display_name_chars--value=$max_display_name_chars +ynh_app_setting_set --app=$app --key=max_poll_options --value=$max_poll_options +ynh_app_setting_set --app=$app --key=max_poll_option_chars --value=$max_poll_option_chars +ynh_app_setting_set --app=$app --key=max_image_size --value=$max_image_size +ynh_app_setting_set --app=$app --key=max_video_size --value=$max_video_size +ynh_app_setting_set --app=$app --key=max_emoji_size --value=$max_emoji_size +ynh_app_setting_set --app=$app --key=max_remote_emoji_size --value=$max_remote_emoji_size #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index aad03b8..692a6d2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,6 +36,18 @@ vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key) config="$final_path/live/.env.production" +max_toot_chars=$(ynh_app_setting_get --app=$app --key=max_toot_chars) +max_pinned_toots=$(ynh_app_setting_get --app=$app --key=max_pinned_toots) +max_bio_chars=$(ynh_app_setting_get --app=$app --key=max_bio_chars) +max_profile_fields=$(ynh_app_setting_get --app=$app --key=max_profile_fields) +max_display_name_chars=$(ynh_app_setting_get --app=$app --key=max_display_name_chars) +max_poll_options=$(ynh_app_setting_get --app=$app --key=max_poll_options) +max_poll_option_chars=$(ynh_app_setting_get --app=$app --key=max_poll_option_chars) +max_image_size=$(ynh_app_setting_get --app=$app --key=max_image_size) +max_video_size=$(ynh_app_setting_get --app=$app --key=max_video_size) +max_emoji_size=$(ynh_app_setting_get --app=$app --key=max_emoji_size) +max_remote_emoji_size=$(ynh_app_setting_get --app=$app --key=max_remote_emoji_size) + #================================================= # CHECK VERSION #================================================= @@ -148,6 +160,61 @@ if [[ -z "$redis_namespace" ]]; then ynh_app_setting_set --app=$app --key=redis_namespace --value=$redis_namespace fi +if [ -z "$max_toot_chars" ]; then + max_toot_chars="500" + ynh_app_setting_set --app=$app --key=max_toot_chars --value=$max_toot_chars +fi + +if [ -z "$max_pinned_toots" ]; then + max_pinned_toots="5" + ynh_app_setting_set --app=$app --key=max_pinned_toots --value=$max_pinned_toots +fi + +if [ -z "$max_bio_chars" ]; then + max_bio_chars="500" + ynh_app_setting_set --app=$app --key=max_bio_chars --value=$max_bio_chars +fi + +if [ -z "$max_profile_fields" ]; then + max_profile_fields="4" + ynh_app_setting_set --app=$app --key=max_profile_fields --value=$max_profile_fields +fi + +if [ -z "$max_display_name_chars" ]; then + max_display_name_chars="30" + ynh_app_setting_set --app=$app --key=max_display_name_chars --value=$max_display_name_chars +fi + +if [ -z "$max_poll_options" ]; then + max_poll_options="5" + ynh_app_setting_set --app=$app --key=max_poll_options --value=$max_poll_options +fi + +if [ -z "$max_poll_option_chars" ]; then + max_poll_option_chars="100" + ynh_app_setting_set --app=$app --key=max_poll_option_chars --value=$max_poll_option_chars +fi + +if [ -z "$max_image_size" ]; then + max_image_size="8388608" + ynh_app_setting_set --app=$app --key=max_image_size --value=$max_image_size +fi + +if [ -z "$max_video_size" ]; then + max_video_size="41943040" + ynh_app_setting_set --app=$app --key=max_video_size --value=$max_video_size +fi + +if [ -z "$max_emoji_size" ]; then + max_emoji_size="51200" + ynh_app_setting_set --app=$app --key=max_emoji_size --value=$max_emoji_size +fi + +if [ -z "$max_remote_emoji_size" ]; then + max_remote_emoji_size="204800" + ynh_app_setting_set --app=$app --key=max_remote_emoji_size --value=$max_remote_emoji_size +fi + #Remove previous added repository ynh_remove_extra_repo