diff --git a/conf/dendrite.yaml b/conf/dendrite.yaml index 06de6b0..df29574 100644 --- a/conf/dendrite.yaml +++ b/conf/dendrite.yaml @@ -152,7 +152,7 @@ client_api: # Prevents new users from being able to register on this homeserver, except when # using the registration shared secret below. - registration_disabled: __REGISTRATION__ + registration_disabled: __REGISTRATION_DISABLED__ # Prevents new guest accounts from being created. Guest registration is also # disabled implicitly by setting 'registration_disabled' above. diff --git a/conf/systemd.service b/conf/systemd.service index 5ad0e2d..e961638 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/bin/dendrite-monolith-server --tls-cert=/etc/yunohost/certs/__DOMAIN__/crt.pem --tls-key=/etc/yunohost/certs/__DOMAIN__/key.pem --config=dendrite.yaml --http-bind-address=:__PORT__ --https-bind-address=:__TLS_PORT__ +ExecStart=__FINALPATH__/bin/dendrite-monolith-server --tls-cert=/etc/yunohost/certs/__DOMAIN__/crt.pem --tls-key=/etc/yunohost/certs/__DOMAIN__/key.pem --config=dendrite.yaml --http-bind-address=:__PORT__ --https-bind-address=:__TLS_PORT__ __REALLY_ENABLE_OPEN_REGISTRATION__ StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 765a28c..0a6bfe8 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,5 +1,9 @@ :warning: The upstream app is still in beta. Tread carefully. +## Features + +* Registration can be opened in the app config panel. + ## Limitations -* Upstream app still in beta. +* Dendrite does not implement secondary user registration schemes yet, so YunoHost users cannot be integrated at the moment. diff --git a/manifest.json b/manifest.json index ed2d06b..d990735 100644 --- a/manifest.json +++ b/manifest.json @@ -53,9 +53,13 @@ } }, { - "name": "is_public", + "name": "registration", "type": "boolean", - "default": false + "default": false, + "help": { + "en": "Should the server allow any visitor to register as a user?", + "fr": "Le serveur doit-il permettre à quiconque de s'enregistrer comme utilisateur?" + } } ] } diff --git a/scripts/change_url b/scripts/change_url index 21718ca..4932b26 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -127,7 +127,7 @@ ynh_add_systemd_config ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="/var/log/$app/Monolith.log" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index b06a6c1..289e6e5 100644 --- a/scripts/install +++ b/scripts/install @@ -27,10 +27,20 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" server_name=$YNH_APP_ARG_SERVER_NAME -is_public=$YNH_APP_ARG_IS_PUBLIC +registration=$YNH_APP_ARG_REGISTRATION app=$YNH_APP_INSTANCE_NAME +# Allow or deny registration based on is_public +if [ $registration -eq 1 ] +then + registration_disabled="false" + really_enable_open_registration="--really-enable-open-registration" +else + registration_disabled="true" + really_enable_open_registration="" +fi + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -50,6 +60,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 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=server_name --value=$server_name +ynh_app_setting_set --app=$app --key=registration --value=$registration #================================================= # STANDARD MODIFICATIONS @@ -169,13 +180,6 @@ chown -R $app:root "$final_path" #================================================= ynh_script_progression --message="Adding a configuration file..." -# Allow or deny registration based of is_public -registration=false -if [ $is_public -eq 1 ] -then - registration=true -fi - # Copy and modify the config file ynh_add_config --template="../conf/dendrite.yaml" --destination="$final_path/dendrite.yaml" @@ -197,7 +201,7 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -ynh_permission_update --permission=main --show_tile=false --protected=true +ynh_permission_update --permission=main --show_tile=false ynh_permission_create --permission=server_api --url=$domain/_matrix \ --label="Server access for client apps." --show_tile=false --allowed=visitors \ @@ -235,7 +239,7 @@ yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="/var/log/$app/Monolith.log" #================================================= # RELOAD NGINX diff --git a/scripts/restore b/scripts/restore index 7875645..6bf8a10 100644 --- a/scripts/restore +++ b/scripts/restore @@ -112,7 +112,7 @@ yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="/var/log/$app/Monolith.log" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index d5ab64b..8019612 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -26,6 +26,7 @@ tls_port=$(ynh_app_setting_get --app=$app --key=tls_port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +registration=$(ynh_app_setting_get --app=$app --key=registration) #================================================= # CHECK VERSION @@ -56,7 +57,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Dendrite Matrix homeserver" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped external Monolith listener" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -67,13 +68,23 @@ if ! groups $app | grep -q 'ssl-cert'; then adduser $app ssl-cert fi - # Define $server_name if not already defined if [ -z $server_name ]; then server_name=$domain ynh_app_setting_set --app=$app --key=server_name --value=$domain fi +# Load up registration variables +if [[ $registration -eq 1 ]] +then + registration_disabled="false" + really_enable_open_registration="--really-enable-open-registration" +else + registration_disabled="true" + really_enable_open_registration="" + ynh_app_setting_set --app=$app --key=registration --value=0 +fi + #================================================= # CREATE DEDICATED USER #================================================= @@ -152,13 +163,6 @@ chown -R $app:root "$final_path" #================================================= ynh_script_progression --message="Updating a configuration file..." -if ynh_permission_has_user --permission=main --user=visitors -then - registration="true" -else - registration="false" -fi - ynh_add_config --template="../conf/dendrite.yaml" --destination="$final_path/dendrite.yaml" chmod 400 "$final_path/dendrite.yaml" @@ -179,8 +183,6 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -ynh_permission_update --permission=main --show_tile=false --protected=true - if ! ynh_permission_exists --permission=server_api; then ynh_permission_create --permission=server_api --url=$domain/_matrix \ --label="Server access for client apps." --show_tile=false --allowed=visitors \ @@ -226,7 +228,7 @@ yunohost service add $app --description="Dendrite Matrix homeserver" --log="/var #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --line_match="Starting external Monolith listener" --log_path="/var/log/$app/Monolith.log" #================================================= # RELOAD NGINX