Bob Mottram 8 lat temu
rodzic
commit
f0eb273dc6
1 zmienionych plików z 10 dodań i 3 usunięć
  1. 10
    3
      src/freedombone-app-matrix

+ 10
- 3
src/freedombone-app-matrix Wyświetl plik

@@ -48,6 +48,7 @@ matrix_variables=(ONION_ONLY
48 48
                   DEFAULT_DOMAIN_NAME)
49 49
 
50 50
 function matrix_nginx {
51
+    matrix_changed=
51 52
     matrix_proxy_str=' \
52 53
     location /matrix { \
53 54
         proxy_pass https://localhost:8448; \
@@ -147,18 +148,25 @@ function matrix_nginx {
147 148
         fi
148 149
 
149 150
         nginx_ensite $DEFAULT_DOMAIN_NAME
151
+        matrix_changed=1
150 152
     fi
151 153
 
152 154
     if ! grep "localhost:${MATRIX_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
153 155
         sed -i "s|:443 ssl;|:443 ssl;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
154 156
         sed -i "s| default_server;| default_server;${matrix_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
157
+        matrix_changed=1
155 158
     fi
156 159
     if ! grep "localhost:${TURN_PORT}" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}; then
157 160
         sed -i "s|:443 ssl;|:443 ssl;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
158 161
         sed -i "s| default_server;| default_server;${turn_proxy_str}|g" /etc/nginx/sites-available/${DEFAULT_DOMAIN_NAME}
162
+        matrix_changed=1
163
+    fi
164
+
165
+    if [ $matrix_changed ]; then
166
+        systemctl restart nginx
167
+        sleep 5
159 168
     fi
160 169
 
161
-    systemctl restart nginx
162 170
 }
163 171
 
164 172
 function matrix_generate_synapse_file {
@@ -247,9 +255,8 @@ function add_user_matrix {
247 255
 
248 256
     ${PROJECT_NAME}-pass -u $new_username -a matrix -p "$new_user_password"
249 257
 
250
-    read_config_param 'MATRIX_SECRET'
251 258
     matrix_nginx
252
-    register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a
259
+    retval=$(register_new_matrix_user -c ${MATRIX_DATA_DIR}/homeserver.yaml -u "${new_username}" -p "${new_user_password}" -a)
253 260
     echo "0"
254 261
 }
255 262