diff --git a/src/freedombone-app-matrix b/src/freedombone-app-matrix index 4ca614d3..09c7741d 100755 --- a/src/freedombone-app-matrix +++ b/src/freedombone-app-matrix @@ -48,6 +48,7 @@ matrix_variables=(ONION_ONLY DEFAULT_DOMAIN_NAME) function matrix_nginx { + matrix_changed= matrix_proxy_str=' \ location /matrix { \ proxy_pass https://localhost:8448; \ @@ -147,18 +148,25 @@ function matrix_nginx { fi nginx_ensite $DEFAULT_DOMAIN_NAME + matrix_changed=1 fi if ! grep "localhost:${MATRIX_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then sed -i "s|:443 ssl;|:443 ssl;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} sed -i "s| default_server;| default_server;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} + matrix_changed=1 fi if ! grep "localhost:${TURN_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then sed -i "s|:443 ssl;|:443 ssl;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} sed -i "s| default_server;| default_server;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME} + matrix_changed=1 + fi + + if [ $matrix_changed ]; then + systemctl restart nginx + sleep 5 fi - systemctl restart nginx } function matrix_generate_synapse_file { @@ -247,9 +255,8 @@ function add_user_matrix { ${PROJECT_NAME}-pass -u $new_username -a matrix -p "$new_user_password" - read_config_param 'MATRIX_SECRET' matrix_nginx - register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a + retval=$(register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a) echo "0" }