Parcourir la source

Ensure that registrations are not re-enabled by upgrades

Bob Mottram il y a 7 ans
Parent
révision
875bb191e7
1 fichiers modifiés avec 17 ajouts et 1 suppressions
  1. 17
    1
      src/freedombone-app-pleroma

+ 17
- 1
src/freedombone-app-pleroma Voir le fichier

@@ -245,7 +245,6 @@ function pleroma_recompile {
245 245
     if [ -f /etc/systemd/system/pleroma.service ]; then
246 246
         systemctl restart pleroma
247 247
     fi
248
-
249 248
 }
250 249
 
251 250
 function logging_on_pleroma {
@@ -724,6 +723,11 @@ function upgrade_pleroma {
724 723
         return
725 724
     fi
726 725
 
726
+    pleroma_registrations=open
727
+    if grep -q 'registrations_open: false' $PLEROMA_DIR/config/config.exs; then
728
+        pleroma_registrations=
729
+    fi
730
+
727 731
     # make a copy of the configuration
728 732
     cp $PLEROMA_DIR/priv/static/static/config.json $PLEROMA_DIR/priv/static/static/config_prev.json
729 733
 
@@ -751,6 +755,11 @@ function upgrade_pleroma {
751 755
 
752 756
     sudo -u pleroma mix deps.get
753 757
 
758
+    if [ ! $pleroma_registrations ]; then
759
+        sed -i 's|registrations_open: true|registrations_open: false|g' $PLEROMA_DIR/config/config.exs
760
+        sed -i 's|registrations_open: True|registrations_open: false|g' $PLEROMA_DIR/config/config.exs
761
+    fi
762
+
754 763
     pleroma_recompile
755 764
 
756 765
     # migrate database
@@ -1180,6 +1189,13 @@ function install_pleroma {
1180 1189
     sed -i 's|registrations_open:.*|registrations_open: true,|g' $PLEROMA_DIR/config/config.exs
1181 1190
     sed -i 's|"registrationOpen":.*|"registrationOpen": true,|g' $PLEROMA_DIR/priv/static/static/config.json
1182 1191
 
1192
+    if ! grep -q "media_proxy" $PLEROMA_DIR/priv/static/static/config.json; then
1193
+        sed -i '/"name":/a "media_proxy": false,' $PLEROMA_DIR/priv/static/static/config.json
1194
+        sed -i 's|"media_proxy"|  "media_proxy"|g' $PLEROMA_DIR/priv/static/static/config.json
1195
+    else
1196
+        sed -i 's|"media_proxy".*|"media_proxy": false,|g' $PLEROMA_DIR/priv/static/static/config.json
1197
+    fi
1198
+
1183 1199
     systemctl daemon-reload
1184 1200
     systemctl enable pleroma
1185 1201
     systemctl start pleroma