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 auto_join_rooms

Auto join rooms config  should be good.
which more ??
This commit is contained in:
rosbeef andino 2023-07-01 14:07:50 +00:00 committed by GitHub
parent c9151251c5
commit 2005c1b1fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,7 +75,30 @@ set__allowed_local_3pids_msisdn() {
ynh_app_setting_set --app=$app --key=allowed_local_3pids_msisdn --value="${allowed_local_3pids_msisdn}"
}
get__auto_join_rooms() {
max_upload_size=$(ynh_app_setting_get --app $app --key auto_join_rooms)
echo "${auto_join_rooms}"
}
set__auto_join_rooms() {
if [ -z ${auto_join_rooms} ] ; then
# remove all values comment header ans example value
sed -i -z -r "s|#?([^\S\n]*auto_join_rooms:\n)#?([^\S\n]*-[^\S\n]*"[^\"]*"\n)*|#\1# - "#example:example.com"\n\n|" "/etc/matrix-$app/homeserver.yaml"
else
IFS=' ' read -r -a arrroom <<< "${auto_join_rooms}";
# print header then all space separated values
myregex='s|#?([^\S\n]*auto_join_rooms:)#?([^\S\n]*-[^\S\n]*"[^\"]*"\n)*|#\1';
for room in "${arrroom[@]}"; do
myregex="${myregex}\n - ${room}";
done;
myregex="${myregex}\n\n|";
sed -i -z -r "${myregex}" "/etc/matrix-$app/homeserver.yaml"
fi
}
#=================================================
# GENERIC FINALIZATION