1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gotosocial_ynh.git synced 2024-09-03 19:16:06 +02:00

added all configuration parameters

This commit is contained in:
OniriCorpe 2022-03-26 00:43:51 +01:00
parent da5467a96d
commit 709eb9054a
4 changed files with 102 additions and 13 deletions

View file

@ -188,22 +188,22 @@ accounts-reason-required: __REGISTRATION_REASON__
# Int. Maximum allowed image upload size in bytes. # Int. Maximum allowed image upload size in bytes.
# Examples: [2097152, 10485760] # Examples: [2097152, 10485760]
# Default: 2097152 -- aka 2MB # Default: 2097152 -- aka 2MB
media-image-max-size: 2097152 media-image-max-size: __MEDIA_IMAGE_MAX_SIZE__
# Int. Maximum allowed video upload size in bytes. # Int. Maximum allowed video upload size in bytes.
# Examples: [2097152, 10485760] # Examples: [2097152, 10485760]
# Default: 10485760 -- aka 10MB # Default: 10485760 -- aka 10MB
media-video-max-size: 10485760 media-video-max-size: __MEDIA_VIDEO_MAX_SIZE__
# Int. Minimum amount of characters required as an image or video description. # Int. Minimum amount of characters required as an image or video description.
# Examples: [500, 1000, 1500] # Examples: [500, 1000, 1500]
# Default: 0 (not required) # Default: 0 (not required)
media-description-min-chars: 0 media-description-min-chars: __MEDIA_DESCRIPTION_MIN_CHARS__
# Int. Maximum amount of characters permitted in an image or video description. # Int. Maximum amount of characters permitted in an image or video description.
# Examples: [500, 1000, 1500] # Examples: [500, 1000, 1500]
# Default: 500 # Default: 500
media-description-max-chars: 500 media-description-max-chars: __MEDIA_DESCRIPTION_MAX_CHARS__
# Int. Number of days to cache media from remote instances before they are removed from the cache. # Int. Number of days to cache media from remote instances before they are removed from the cache.
# A job will run every day at midnight to clean up any remote media older than the given amount of days. # A job will run every day at midnight to clean up any remote media older than the given amount of days.
@ -214,7 +214,7 @@ media-description-max-chars: 500
# If this is set to 0, then media from remote instances will be cached indefinitely. # If this is set to 0, then media from remote instances will be cached indefinitely.
# Examples: [30, 60, 7, 0] # Examples: [30, 60, 7, 0]
# Default: 30 # Default: 30
media-remote-cache-days: 30 media-remote-cache-days: __MEDIA_REMOTE_CACHE_DAYS__
########################## ##########################
##### STORAGE CONFIG ##### ##### STORAGE CONFIG #####
@ -245,31 +245,31 @@ storage-local-base-path: "__DATADIR__"
# Note that going way higher than the default might break federation. # Note that going way higher than the default might break federation.
# Examples: [140, 500, 5000] # Examples: [140, 500, 5000]
# Default: 5000 # Default: 5000
statuses-max-chars: 5000 statuses-max-chars: __STATUSES_MAX_CHARS__
# Int. Maximum amount of characters allowed in the CW/subject header of a status. # Int. Maximum amount of characters allowed in the CW/subject header of a status.
# Note that going way higher than the default might break federation. # Note that going way higher than the default might break federation.
# Examples: [100, 200] # Examples: [100, 200]
# Default: 100 # Default: 100
statuses-cw-max-chars: 100 statuses-cw-max-chars: __STATUSES_CW_MAX_CHARS__
# Int. Maximum amount of options to permit when creating a new poll. # Int. Maximum amount of options to permit when creating a new poll.
# Note that going way higher than the default might break federation. # Note that going way higher than the default might break federation.
# Examples: [4, 6, 10] # Examples: [4, 6, 10]
# Default: 6 # Default: 6
statuses-poll-max-options: 6 statuses-poll-max-options: __STATUSES_POLL_MAX_OPTIONS__
# Int. Maximum amount of characters to permit per poll option when creating a new poll. # Int. Maximum amount of characters to permit per poll option when creating a new poll.
# Note that going way higher than the default might break federation. # Note that going way higher than the default might break federation.
# Examples: [50, 100, 150] # Examples: [50, 100, 150]
# Default: 50 # Default: 50
statuses-poll-option-max-chars: 50 statuses-poll-option-max-chars: __STATUSES_POLL_OPTION_MAX_OPTIONS__
# Int. Maximum amount of media files that can be attached to a new status. # Int. Maximum amount of media files that can be attached to a new status.
# Note that going way higher than the default might break federation. # Note that going way higher than the default might break federation.
# Examples: [4, 6, 10] # Examples: [4, 6, 10]
# Default: 6 # Default: 6
statuses-media-max-files: 6 statuses-media-max-files: __STATUSES_MEDIA_MAX_FILES__
############################## ##############################
##### LETSENCRYPT CONFIG ##### ##### LETSENCRYPT CONFIG #####

View file

@ -33,10 +33,24 @@ admin=$YNH_APP_ARG_ADMIN
email=$YNH_APP_ARG_EMAIL email=$YNH_APP_ARG_EMAIL
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD
# Config stuff:
registration_open=$YNH_APP_ARG_REGISTRATION_OPEN registration_open=$YNH_APP_ARG_REGISTRATION_OPEN
registration_approval=$YNH_APP_ARG_REGISTRATION_APPROVAL registration_approval=$YNH_APP_ARG_REGISTRATION_APPROVAL
registration_reason=$YNH_APP_ARG_REGISTRATION_REASON registration_reason=$YNH_APP_ARG_REGISTRATION_REASON
media-image-max-size="2097152"
media-video-max-size="10485760"
media-description-min-chars="0"
media-description-max-chars="500"
media-remote-cache-days="30"
statuses-max-chars="5000"
statuses-cw-max-chars="100"
statuses-poll-max-options="6"
statuses-poll-option-max-chars="50"
statuses-media-max-files="6"
### If it's a multi-instance app, meaning it can be installed several times independently ### If it's a multi-instance app, meaning it can be installed several times independently
### The id of the app as stated in the manifest is available as $YNH_APP_ID ### The id of the app as stated in the manifest is available as $YNH_APP_ID
### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2"...) ### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2"...)
@ -90,6 +104,18 @@ ynh_app_setting_set --app=$app --key=registration_open --value=$registration_ope
ynh_app_setting_set --app=$app --key=registration_approval --value=$registration_approval ynh_app_setting_set --app=$app --key=registration_approval --value=$registration_approval
ynh_app_setting_set --app=$app --key=registration_reason --value=$registration_reason ynh_app_setting_set --app=$app --key=registration_reason --value=$registration_reason
ynh_app_setting_set --app=$app --key=media_image_max_size --value=$media_image_max_size
ynh_app_setting_set --app=$app --key=media_video_max_size --value=$media_video_max_size
ynh_app_setting_set --app=$app --key=media_description_min_chars --value=$media_description_min_chars
ynh_app_setting_set --app=$app --key=media_description_max_chars --value=$media_description_max_chars
ynh_app_setting_set --app=$app --key=media_remote_cache_days --value=$media_remote_cache_days
ynh_app_setting_set --app=$app --key=statuses_max_chars --value=$statuses_max_chars
ynh_app_setting_set --app=$app --key=statuses_cw_max_chars --value=$statuses_cw_max_chars
ynh_app_setting_set --app=$app --key=statuses_poll_max_options --value=$statuses_poll_max_options
ynh_app_setting_set --app=$app --key=statuses_poll_option_max_chars --value=$statuses_poll_option_max_chars
ynh_app_setting_set --app=$app --key=statuses_media_max_files --value=$statuses_media_max_files
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================

View file

@ -40,11 +40,23 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
registration_open=$(ynh_app_setting_get --app=$app --key=registration_open) registration_open=$(ynh_app_setting_get --app=$app --key=registration_open)
registration_approval=$(ynh_app_setting_get --app=$app --key=registration_approval) registration_approval=$(ynh_app_setting_get --app=$app --key=registration_approval)
registration_reason=$(ynh_app_setting_get --app=$app --key=registration_reason) registration_reason=$(ynh_app_setting_get --app=$app --key=registration_reason)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) media_image_max_size=$(ynh_app_setting_get --app=$app --key=media_image_max_size)
media_video_max_size=$(ynh_app_setting_get --app=$app --key=media_video_max_size)
media_description_min_chars=$(ynh_app_setting_get --app=$app --key=media_description_min_chars)
media_description_max_chars=$(ynh_app_setting_get --app=$app --key=media_description_max_chars)
media_remote_cache_days=$(ynh_app_setting_get --app=$app --key=media_remote_cache_days)
statuses_max_chars=$(ynh_app_setting_get --app=$app --key=statuses_max_chars)
statuses_cw_max_chars=$(ynh_app_setting_get --app=$app --key=statuses_cw_max_chars)
statuses_poll_max_options=$(ynh_app_setting_get --app=$app --key=statuses_poll_max_options)
statuses_poll_option_max_chars=$(ynh_app_setting_get --app=$app --key=statuses_poll_option_max_chars)
statuses_media_max_files=$(ynh_app_setting_get --app=$app --key=statuses_media_max_files)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED

View file

@ -28,11 +28,23 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user) db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
registration_open=$(ynh_app_setting_get --app=$app --key=registration_open) registration_open=$(ynh_app_setting_get --app=$app --key=registration_open)
registration_approval=$(ynh_app_setting_get --app=$app --key=registration_approval) registration_approval=$(ynh_app_setting_get --app=$app --key=registration_approval)
registration_reason=$(ynh_app_setting_get --app=$app --key=registration_reason) registration_reason=$(ynh_app_setting_get --app=$app --key=registration_reason)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) media_image_max_size=$(ynh_app_setting_get --app=$app --key=media_image_max_size)
media_video_max_size=$(ynh_app_setting_get --app=$app --key=media_video_max_size)
media_description_min_chars=$(ynh_app_setting_get --app=$app --key=media_description_min_chars)
media_description_max_chars=$(ynh_app_setting_get --app=$app --key=media_description_max_chars)
media_remote_cache_days=$(ynh_app_setting_get --app=$app --key=media_remote_cache_days)
statuses_max_chars=$(ynh_app_setting_get --app=$app --key=statuses_max_chars)
statuses_cw_max_chars=$(ynh_app_setting_get --app=$app --key=statuses_cw_max_chars)
statuses_poll_max_options=$(ynh_app_setting_get --app=$app --key=statuses_poll_max_options)
statuses_poll_option_max_chars=$(ynh_app_setting_get --app=$app --key=statuses_poll_option_max_chars)
statuses_media_max_files=$(ynh_app_setting_get --app=$app --key=statuses_media_max_files)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -75,11 +87,50 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
# Upgrade from <0.2.1~ynh4: # Upgrade from <0.2.1~ynh4:
# If client_max_body_size doesn't exist, create it
if [ -z "$client_max_body_size" ]; then if [ -z "$client_max_body_size" ]; then
client_max_body_size="50M" client_max_body_size="50M"
ynh_app_setting_set --app=$app --key=client_max_body_size --value=$client_max_body_size ynh_app_setting_set --app=$app --key=client_max_body_size --value=$client_max_body_size
fi fi
if [ -z "$client_max_body_size" ]; then
media-image-max-size="2097152"
ynh_app_setting_set --app=$app --key=media_image_max_size --value=$media_image_max_size
fi
if [ -z "$client_max_body_size" ]; then
media-video-max-size="10485760"
ynh_app_setting_set --app=$app --key=media_video_max_size --value=$media_video_max_size
fi
if [ -z "$client_max_body_size" ]; then
media-description-min-chars="0"
ynh_app_setting_set --app=$app --key=media_description_min_chars --value=$media_description_min_chars
fi
if [ -z "$client_max_body_size" ]; then
media-description-max-chars="500"
ynh_app_setting_set --app=$app --key=media_description_max_chars --value=$media_description_max_chars
fi
if [ -z "$client_max_body_size" ]; then
media-remote-cache-days="30"
ynh_app_setting_set --app=$app --key=media_remote_cache_days --value=$media_remote_cache_days
fi
if [ -z "$client_max_body_size" ]; then
statuses-max-chars="5000"
ynh_app_setting_set --app=$app --key=statuses_max_chars --value=$statuses_max_chars
fi
if [ -z "$client_max_body_size" ]; then
statuses-cw-max-chars="100"
ynh_app_setting_set --app=$app --key=statuses_cw_max_chars --value=$statuses_cw_max_chars
fi
if [ -z "$client_max_body_size" ]; then
statuses-poll-max-options="6"
ynh_app_setting_set --app=$app --key=statuses_poll_max_options --value=$statuses_poll_max_options
fi
if [ -z "$client_max_body_size" ]; then
statuses-poll-option-max-chars="50"
ynh_app_setting_set --app=$app --key=statuses_poll_option_max_chars --value=$statuses_poll_option_max_chars
fi
if [ -z "$client_max_body_size" ]; then
statuses-media-max-files="6"
ynh_app_setting_set --app=$app --key=statuses_media_max_files --value=$statuses_media_max_files
fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER