add config panel

This commit is contained in:
Éric Gaspar 2024-11-07 09:26:42 +01:00
parent 8e5ef1a4b3
commit e50cf3a545
4 changed files with 86 additions and 3 deletions

View File

@ -156,7 +156,7 @@ const conf = convict({
max_file_size: { max_file_size: {
format: Number, format: Number,
default: 1024 * 1024 * 1024 * 2.5, default: 1024 * 1024 * 1024 * 2.5,
env: 'MAX_FILE_SIZE' env: '__MAX_FILE_SIZE__'
}, },
l10n_dev: { l10n_dev: {
format: Boolean, format: Boolean,
@ -171,12 +171,12 @@ const conf = convict({
custom_title: { custom_title: {
format: String, format: String,
default: 'Send', default: 'Send',
env: 'CUSTOM_TITLE' env: '__CUSTOM_TITLE__'
}, },
custom_description: { custom_description: {
format: String, format: String,
default: 'Encrypt and send files with a link that automatically expires to ensure your important documents dont stay online forever.', default: 'Encrypt and send files with a link that automatically expires to ensure your important documents dont stay online forever.',
env: 'CUSTOM_DESCRIPTION' env: '__CUSTOM_DESCRIPTION__'
}, },
detect_base_url: { detect_base_url: {
format: Boolean, format: Boolean,

42
config_panel.toml Normal file
View File

@ -0,0 +1,42 @@
version = "1.0"
[main]
name.en = "Send configuration"
name.fr = "Configuration de Send"
services = ["__APP__"]
[main.config]
name.en = "Configuration Options"
name.fr = "Options de configuration"
[main.config.max_file_size]
ask.en = "Max File Size"
ask.fr = "Taille maximale du fichier"
type = "number"
default = "2684354560"
help.en = "Define the maximum file size limit"
help.fr = "Définir la limite de taille maximale du fichier"
bind = ":__INSTALL_DIR__/server/config.js"
[main.config.max_download]
ask.en = "Max download"
ask.fr = "Téléchargement maximal"
type = "number"
default = "100"
help.en = "Define the maximum download limit"
help.fr = "Définir la limite maximale du nombre de téléchargement"
bind = ":__INSTALL_DIR__/server/config.js"
[main.config.custom_title]
ask.en = "Custom Title"
ask.fr = "Titre personnalisé"
type = "string"
help = "Add a custom title for Send"
bind = ":__INSTALL_DIR__/server/config.js"
[main.config.custom_description]
ask.en = "Custom Description"
ask.fr = "Description personnalisée"
type = "string"
help = "Add a custom description for Send"
bind = ":__INSTALL_DIR__/server/config.js"

View File

@ -3,6 +3,22 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
custom_title="Send"
ynh_app_setting_set --key=custom_title --value="$custom_title"
custom_description="Encrypt and send files with a link that automatically expires to ensure your important documents dont stay online forever."
ynh_app_setting_set --key=custom_description --value="$custom_description"
max_file_size="2684354560"
ynh_app_setting_set --key=cmax_file_size --value="$max_file_size"
max_download="100"
ynh_app_setting_set --key=max_download --value="$max_download"
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================

View File

@ -3,6 +3,31 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
if [ -z ${custom_title:-} ]; then
custom_title=Send
ynh_app_setting_set --key=custom_title --value="$custom_title"
fi
if [ -z ${custom_description:-} ]; then
custom_description="Encrypt and send files with a link that automatically expires to ensure your important documents dont stay online forever."
ynh_app_setting_set --key=custom_description --value="$custom_description"
fi
if [ -z ${max_file_size:-} ]; then
max_file_size="2684354560"
ynh_app_setting_set --key=cmax_file_size --value="$max_file_size"
fi
if [ -z ${max_download:-} ]; then
max_download="100"
ynh_app_setting_set --key=max_download --value="$max_download"
fi
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================