1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Update config registrations_require_3pid ok

registrations_require_3pid should be ok
keep allowed_local_3pid_(email|msisdn)
autojoin_rooms
autocreate_auto_join_rooms
This commit is contained in:
rosbeef andino 2023-07-01 08:25:47 +00:00 committed by GitHub
parent 1e51a9e661
commit da52218aeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,19 +29,20 @@ get__registrations_require_3pid() {
} }
set__registrations_require_3pid() { set__registrations_require_3pid() {
# sed -z do the trick on this king of multline replacement
case ${registrations_require_3pid} in case ${registrations_require_3pid} in
email) email)
sed -i -r -e "s|\#?[^\S\n]*registrations_require_3pid:\s(\#?[^\S\n]*- .*\s){0,2}|registrations_require_3pid:\n - email\n# - msisdn|g" "/etc/matrix-$app/homeserver.yaml"
sed -i -z -r "s|#?([^\S\n]*registrations_require_3pid:\n)#?([^\S\n]*-[^\S\n]*email\n)#?([^\S\n]*-[^\S\n]*msisdn)|\1\2#\3|" "/etc/matrix-$app/homeserver.yaml"
;; ;;
msisdn) msisdn)
sed -i -r -e "s|\#?[^\S\n]*registrations_require_3pid:\s(\#?[^\S\n]*- .*\s){0,2}|registrations_require_3pid:\n# - email\n - msisdn|g" "/etc/matrix-$app/homeserver.yaml" sed -i -z -r "s|#?([^\S\n]*registrations_require_3pid:\n)#?([^\S\n]*-[^\S\n]*email\n)#?([^\S\n]*-[^\S\n]*msisdn)|\1#\2\3|" "/etc/matrix-$app/homeserver.yaml"
;; ;;
email&msisdn) email&msisdn)
sed -i -r -e "s|\#?[^\S\n]*registrations_require_3pid:\s(\#?[^\S\n]*- .*\s){0,2}|registrations_require_3pid:\n - email\n - msisdn|g" "/etc/matrix-$app/homeserver.yaml" sed -i -z -r "s|#?([^\S\n]*registrations_require_3pid:\n)#?([^\S\n]*-[^\S\n]*email\n)#?([^\S\n]*-[^\S\n]*msisdn)|\1\2\3|" "/etc/matrix-$app/homeserver.yaml"
;; ;;
*) *)
sed -i -r -e "s|\#?[^\S\n]*registrations_require_3pid:\s(\#?[^\S\n]*- .*\s){0,2}|#registrations_require_3pid:\n# - email\n# - msisdn|g" "/etc/matrix-$app/homeserver.yaml" sed -i -z -r "s|#?([^\S\n]*registrations_require_3pid:\n)#?([^\S\n]*-[^\S\n]*email\n)#?([^\S\n]*-[^\S\n]*msisdn)|#\1#\2#\3|" "/etc/matrix-$app/homeserver.yaml"
;; ;;
esac esac
@ -54,13 +55,13 @@ get__allowed_local_3pids_email() {
} }
set__allowed_local_3pids_email() { set__allowed_local_3pids_email() {
sed -i -z -r "s|(\#?[^\S\n]*allowed_local_3pids:\s(\#?[^\S\n]*- medium:.*\s\#?[^\S\n]*pattern:.*\s)?\#?[^\S\n]*- medium: email\s\#?[^\S\n]*pattern: )(.*)(\s)|$1'${allowed_local_3pids_email}'$3\2|g" "/etc/matrix-$app/homeserver.yaml"
sed -i -r -e "s|(\#?[^\S\n]*allowed_local_3pids:\s(\#?[^\S\n]*- medium:.*\s\#?[^\S\n]*pattern:.*\s)?\#?[^\S\n]*- medium: email\s\#?[^\S\n]*pattern: )(.*)(\s)|$1'${allowed_local_3pids_email}'$3\2|g" "/etc/matrix-$app/homeserver.yaml"
ynh_app_setting_set --app=$app --key=fpm_footprint --value="${registrations_require_3pid}" ynh_app_setting_set --app=$app --key=fpm_footprint --value="${registrations_require_3pid}"
} }
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================