1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/element_ynh.git synced 2024-09-03 18:36:08 +02:00

Merge pull request #136 from YunoHost-Apps/improvements

Improvements
This commit is contained in:
eric_G 2023-12-20 08:52:48 +01:00 committed by GitHub
commit 1fbaa3b47e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 183 additions and 44 deletions

View file

@ -1,16 +1,32 @@
{ {
"default_server_config": { "default_server_config": {
"m.homeserver": { "m.homeserver": {
"base_url": "https://__DEFAULT_HOME_SERVER__" "base_url": "https://__DEFAULT_HOME_SERVER__",
"server_name": "matrix.org"
}, },
"m.identity_server": { "m.identity_server": {
"base_url": "https://vector.im" "base_url": "https://vector.im"
} }
}, },
"brand": "Element", "disable_custom_urls": __DISABLE_CUSTOM_URLS__,
"disable_guests": __DISABLE_GUESTS__,
"disable_login_language_selector": false,
"disable_3pid_login": __DISABLE_3PID_LOGIN__,
"brand": "__BRAND_TEXT__",
"integrations_ui_url": "https://scalar.vector.im/", "integrations_ui_url": "https://scalar.vector.im/",
"integrations_rest_url": "https://scalar.vector.im/api", "integrations_rest_url": "https://scalar.vector.im/api",
"show_labs_settings": false, "integrations_widgets_urls": [
"https://scalar.vector.im/_matrix/integrations/v1",
"https://scalar.vector.im/api",
"https://scalar-staging.vector.im/_matrix/integrations/v1",
"https://scalar-staging.vector.im/api",
"https://scalar-staging.riot.im/scalar/api"
],
"default_country_code": "__DEFAULT_COUNTRY_CODE__",
"show_labs_settings": __SHOW_LABS_SETTINGS__,
"features": {},
"default_federate": __DEFAULT_FEDERATE__,
"default_theme": "__DEFAULT_THEME__",
"room_directory": { "room_directory": {
"servers": ["matrix.org"] "servers": ["matrix.org"]
}, },
@ -18,7 +34,16 @@
"https://matrix.org": false, "https://matrix.org": false,
"https://matrix-client.matrix.org": false "https://matrix-client.matrix.org": false
}, },
"embedded_pages": { "setting_defaults": {
"login_for_welcome": __LOGIN_FOR_WELCOME__ "breadcrumbs": true
} },
"jitsi": {
"preferred_domain": "meet.element.io"
},
"element_call": {
"url": "https://call.element.io",
"participant_limit": 8,
"brand": "Element Call"
},
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"
} }

View file

@ -15,15 +15,59 @@ name.fr = "Configuration d'Element"
default = "matrix.org" default = "matrix.org"
help.en = "Define Matrix default home server address." help.en = "Define Matrix default home server address."
help.fr = "Définir l'adresse du serveur par défaut de Matrix." help.fr = "Définir l'adresse du serveur par défaut de Matrix."
bind = "base_url:__INSTALL_DIR__/config.json"
[main.config.disable_custom_urls]
[main.config.login_for_welcome] ask.en = "Disable custom URL field on login page"
ask.en = "Display login as welcome page" ask.fr = "Déactiver le champ URL personnalisé sur la page login"
ask.fr = "Afficher la connexion comme page d'accueil"
type = "boolean" type = "boolean"
yes = true yes = 'true'
no = false no = 'false'
help.en = "When true, the app will use the login form as a welcome page instead of the welcome page itself. This disables use of welcome_url and all welcome page functionality."
help.fr = "Quand l'option est sélectionnée, l'application utilisera le formulaire de connexion comme page d'accueil au lieu de la page d'accueil elle-même. Cela désactive l'utilisation de welcome_url et de toutes les fonctionnalités de la page d'accueil." [main.config.disable_3pid_login]
bind = "login_for_welcome:__INSTALL_DIR__/config.json" ask.en = "Disable possibility to login with email or phone number"
ask.fr = "Déactiver la possibilité de s'authentifier avec un email ou no de téléphone"
type = "boolean"
yes = 'true'
no = 'false'
[main.config.disable_guests]
ask.en = "Disable guest on login page"
ask.fr = "Déactiver le login en tant qu'invité"
type = "boolean"
yes = 'true'
no = 'false'
[main.config.default_country_code]
ask.en = "Default country code"
ask.fr = "Code du pay par défaut"
type = "string"
example = "GB"
help.en = "By example 'FR' for France. You can refer to this page to find your favourite country code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements"
help.fr = "Par example 'FR' pour la France. Vous pouvez vous référer à la page suivante afin de trouver votre pays favori: https://fr.wikipedia.org/wiki/ISO_3166-1#Table_de_codage"
pattern.regexp = "^[A-Z]{2}$"
[main.config.brand_text]
ask.en = "Branding text for the application"
ask.fr = "Texte de marque pour l'application"
type = "string"
[main.config.default_federate]
ask.en = "Enable fedration features by default"
ask.fr = "Activer les fonctionnalités de fédération par défaut"
type = "boolean"
yes = 'true'
no = 'false'
[main.config.default_theme]
ask.en = "Disable custom URL field on login page"
ask.fr = "Déactiver le champ URL personnalisé sur la page login"
type = "select"
choices = [ "light", "dark" ]
[main.config.show_labs_settings]
ask.en = "Show the experimental feature menu"
ask.fr = "Afficher le menu d'activation des fonctionnalités expérimentales"
type = "boolean"
yes = 'true'
no = 'false'

View file

@ -22,13 +22,13 @@ yunohost = ">= 11.2"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = false ldap = "not_relevant"
sso = false sso = "not_relevant"
disk = "50M" disk = "70M"
ram.build = "50M" ram.build = "0M"
ram.runtime = "50M" ram.runtime = "0M"
[install] [install]
[install.domain] [install.domain]
@ -46,8 +46,8 @@ ram.runtime = "50M"
default = "matrix.org" default = "matrix.org"
[install.init_main_permission] [install.init_main_permission]
help.en = "'visitors' permission means that anyone can access the Matrix server." help.en = "'visitors' permission means that anyone can access the Element application."
help.fr = "Autoriser les 'Visiteurs' signifie que n'importe qui peut accéder au server Matrix." help.fr = "Autoriser les 'Visiteurs' signifie que n'importe qui peut accéder l'application Element."
type = "group" type = "group"
default = "visitors" default = "visitors"

View file

@ -8,6 +8,13 @@
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
configure_element()
{
ynh_add_config --template="config.json" --destination="$install_dir/config.json"
chmod -R u=rwX,g=rX,o= "$install_dir"
chown -R $app:www-data "$install_dir"
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

22
scripts/config Normal file
View file

@ -0,0 +1,22 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ./_common.sh
source /usr/share/yunohost/helpers
ynh_app_config_apply() {
_ynh_app_config_apply
configure_element
}
#=================================================
# GENERIC FINALIZATION
#=================================================
# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT
#=================================================
ynh_app_config_run $1

View file

@ -13,8 +13,23 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
login_for_welcome=true disable_custom_urls=false
ynh_app_setting_set --app=$app --key=login_for_welcome --value=$login_for_welcome disable_guests=false
disable_3pid_login=false
default_country_code=GB
brand_text=Element
default_federate=true
default_theme=light
show_labs_settings=false
ynh_app_setting_set --app=$app --key=disable_custom_urls --value=$disable_custom_urls
ynh_app_setting_set --app=$app --key=disable_guests --value=$disable_guests
ynh_app_setting_set --app=$app --key=disable_3pid_login --value=$disable_3pid_login
ynh_app_setting_set --app=$app --key=default_country_code --value=$default_country_code
ynh_app_setting_set --app=$app --key=brand_text --value=$brand_text
ynh_app_setting_set --app=$app --key=default_federate --value=$default_federate
ynh_app_setting_set --app=$app --key=default_theme --value=$default_theme
ynh_app_setting_set --app=$app --key=show_labs_settings --value=$show_labs_settings
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -37,10 +52,7 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" configure_element
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -18,17 +18,51 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression --message='Ensuring downward compatibility...' --weight=1
# If default_home_server doesn't exist, create it
if [ -z "${default_home_server:-}" ]; then if [ -z "${default_home_server:-}" ]; then
default_home_server="matrix.org" default_home_server='matrix.org'
ynh_app_setting_set --app=$app --key=default_home_server --value=$default_home_server ynh_app_setting_set --app=$app --key=default_home_server --value=$default_home_server
fi fi
if [ -z "${login_for_welcome:-}" ]; then if [ -z "${disable_custom_urls:-}" ]; then
login_for_welcome=true disable_custom_urls=false
ynh_app_setting_set --app=$app --key=login_for_welcome --value=$login_for_welcome ynh_app_setting_set --app=$app --key=disable_custom_urls --value=$disable_custom_urls
fi
if [ -z "${disable_guests:-}" ]; then
disable_guests=false
ynh_app_setting_set --app=$app --key=disable_guests --value=$disable_guests
fi
if [ -z "${disable_3pid_login:-}" ]; then
disable_3pid_login=false
ynh_app_setting_set --app=$app --key=disable_3pid_login --value=$disable_3pid_login
fi
if [ -z "${default_country_code:-}" ]; then
default_country_code=false
ynh_app_setting_set --app=$app --key=default_country_code --value=$default_country_code
fi
if [ -z "${brand_text:-}" ]; then
brand_text=Element
ynh_app_setting_set --app=$app --key=brand_text --value=$brand_text
fi
if [ -z "${default_federate:-}" ]; then
default_federate=true
ynh_app_setting_set --app=$app --key=default_federate --value=$default_federate
fi
if [ -z "${default_theme:-}" ]; then
default_theme=light
ynh_app_setting_set --app=$app --key=default_theme --value=$default_theme
fi
if [ -z "${show_labs_settings:-}" ]; then
show_labs_settings=false
ynh_app_setting_set --app=$app --key=show_labs_settings --value=$show_labs_settings
fi fi
#================================================= #=================================================
@ -52,12 +86,9 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
#================================================= #=================================================
#ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
#ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" configure_element
#chmod -R o-rwx "$install_dir"
#chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS

View file

@ -5,7 +5,7 @@ test_format = 1.0
# ------------------------------- # -------------------------------
# Default args to use for install # Default args to use for install
# ------------------------------- # -------------------------------
args.default_home_server = "matrix.org" args.default_home_server = "matrix.org"
# ------------------------------- # -------------------------------
@ -13,5 +13,3 @@ test_format = 1.0
# ------------------------------- # -------------------------------
test_upgrade_from.26a68cb850f5886aa78671e241a897f48910f314.name = "Upgrade from 1.11.37" test_upgrade_from.26a68cb850f5886aa78671e241a897f48910f314.name = "Upgrade from 1.11.37"
test_upgrade_from.26a68cb850f5886aa78671e241a897f48910f314.args.domain = "domain.tld"
test_upgrade_from.26a68cb850f5886aa78671e241a897f48910f314.args.is_public = true