diff --git a/conf/config.json b/conf/config.json index 7001039..f1e631e 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1,16 +1,32 @@ { "default_server_config": { "m.homeserver": { - "base_url": "https://__DEFAULT_HOME_SERVER__" + "base_url": "https://__DEFAULT_HOME_SERVER__", + "server_name": "matrix.org" }, "m.identity_server": { "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_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": { "servers": ["matrix.org"] }, @@ -18,7 +34,16 @@ "https://matrix.org": false, "https://matrix-client.matrix.org": false }, - "embedded_pages": { - "login_for_welcome": __LOGIN_FOR_WELCOME__ - } + "setting_defaults": { + "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" } diff --git a/config_panel.toml b/config_panel.toml index 13e7ae1..d7f6022 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -15,15 +15,59 @@ name.fr = "Configuration d'Element" default = "matrix.org" help.en = "Define Matrix default home server address." help.fr = "Définir l'adresse du serveur par défaut de Matrix." - bind = "base_url:__INSTALL_DIR__/config.json" - - [main.config.login_for_welcome] - ask.en = "Display login as welcome page" - ask.fr = "Afficher la connexion comme page d'accueil" + [main.config.disable_custom_urls] + ask.en = "Disable custom URL field on login page" + ask.fr = "Déactiver le champ URL personnalisé sur la page login" type = "boolean" - yes = true - 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." - bind = "login_for_welcome:__INSTALL_DIR__/config.json" + yes = 'true' + no = 'false' + + [main.config.disable_3pid_login] + 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' diff --git a/manifest.toml b/manifest.toml index 507af4e..7812efe 100644 --- a/manifest.toml +++ b/manifest.toml @@ -22,13 +22,13 @@ yunohost = ">= 11.2" architectures = "all" multi_instance = true -ldap = false +ldap = "not_relevant" -sso = false +sso = "not_relevant" -disk = "50M" -ram.build = "50M" -ram.runtime = "50M" +disk = "70M" +ram.build = "0M" +ram.runtime = "0M" [install] [install.domain] @@ -46,8 +46,8 @@ ram.runtime = "50M" default = "matrix.org" [install.init_main_permission] - help.en = "'visitors' permission means that anyone can access the Matrix server." - help.fr = "Autoriser les 'Visiteurs' signifie que n'importe qui peut accéder au server Matrix." + 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 l'application Element." type = "group" default = "visitors" diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..c71aa26 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,13 @@ # 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 #================================================= diff --git a/scripts/config b/scripts/config new file mode 100644 index 0000000..3c2c734 --- /dev/null +++ b/scripts/config @@ -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 diff --git a/scripts/install b/scripts/install index 9edc574..940db4a 100644 --- a/scripts/install +++ b/scripts/install @@ -13,8 +13,23 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -login_for_welcome=true -ynh_app_setting_set --app=$app --key=login_for_welcome --value=$login_for_welcome +disable_custom_urls=false +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 @@ -37,10 +52,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" - -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +configure_element #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index dbb5105..f845b4f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,17 +18,51 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # 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 - default_home_server="matrix.org" - ynh_app_setting_set --app=$app --key=default_home_server --value=$default_home_server + default_home_server='matrix.org' + ynh_app_setting_set --app=$app --key=default_home_server --value=$default_home_server fi -if [ -z "${login_for_welcome:-}" ]; then - login_for_welcome=true - ynh_app_setting_set --app=$app --key=login_for_welcome --value=$login_for_welcome +if [ -z "${disable_custom_urls:-}" ]; then + disable_custom_urls=false + 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 #================================================= @@ -52,12 +86,9 @@ chown -R $app:www-data "$install_dir" #================================================= # 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" - -#chmod -R o-rwx "$install_dir" -#chown -R $app:www-data "$install_dir" +configure_element #================================================= # REAPPLY SYSTEM CONFIGURATIONS diff --git a/tests.toml b/tests.toml index bcd32f2..0545023 100644 --- a/tests.toml +++ b/tests.toml @@ -5,7 +5,7 @@ test_format = 1.0 # ------------------------------- # Default args to use for install # ------------------------------- - + 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.args.domain = "domain.tld" - test_upgrade_from.26a68cb850f5886aa78671e241a897f48910f314.args.is_public = true