Sfoglia il codice sorgente

Enable or disable pleroma registrations

Bob Mottram 7 anni fa
parent
commit
c1ef4567bf
1 ha cambiato i file con 31 aggiunte e 5 eliminazioni
  1. 31
    5
      src/freedombone-app-pleroma

+ 31
- 5
src/freedombone-app-pleroma Vedi File

62
                    MY_EMAIL_ADDRESS
62
                    MY_EMAIL_ADDRESS
63
                    MY_USERNAME)
63
                    MY_USERNAME)
64
 
64
 
65
+function pleroma_recompile {
66
+    # necessary after parameter changes
67
+    sudo -u pleroma mix clean
68
+    sudo -u pleroma mix deps.compile
69
+    sudo -u pleroma mix compile
70
+
71
+    if [ -f /etc/systemd/system/pleroma.service ]; then
72
+        systemctl restart pleroma
73
+    fi
74
+}
75
+
65
 function logging_on_pleroma {
76
 function logging_on_pleroma {
66
     echo -n ''
77
     echo -n ''
67
 }
78
 }
344
     rm $data
355
     rm $data
345
 }
356
 }
346
 
357
 
358
+function pleroma_disable_registrations {
359
+    dialog --title $"Disable new Pleroma user registrations" \
360
+           --backtitle $"Freedombone Control Panel" \
361
+           --yesno $"\nDo you wish to disable new registrations?" 10 60
362
+    sel=$?
363
+    case $sel in
364
+        0) sed -i 's|registrations_open:.*|registrations_open: false|g' $PLEROMA_DIR/config/config.exs;;
365
+        1) sed -i 's|registrations_open:.*|registrations_open: true|g' $PLEROMA_DIR/config/config.exs;;
366
+        255) return;;
367
+    esac
368
+    pleroma_recompile
369
+}
370
+
347
 function configure_interactive_pleroma {
371
 function configure_interactive_pleroma {
348
     read_config_param PLEROMA_EXPIRE_MONTHS
372
     read_config_param PLEROMA_EXPIRE_MONTHS
349
     while true
373
     while true
352
         trap "rm -f $data" 0 1 2 5 15
376
         trap "rm -f $data" 0 1 2 5 15
353
         dialog --backtitle $"Freedombone Control Panel" \
377
         dialog --backtitle $"Freedombone Control Panel" \
354
                --title $"Pleroma" \
378
                --title $"Pleroma" \
355
-               --radiolist $"Choose an operation:" 13 70 4 \
379
+               --radiolist $"Choose an operation:" 14 70 5 \
356
                1 $"Set a background image" off \
380
                1 $"Set a background image" off \
357
                2 $"Set the title" off \
381
                2 $"Set the title" off \
358
-               3 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" off \
359
-               4 $"Exit" on 2> $data
382
+               3 $"Disable new account registrations" off \
383
+               4 $"Set post expiry period (currently $PLEROMA_EXPIRE_MONTHS months)" off \
384
+               5 $"Exit" on 2> $data
360
         sel=$?
385
         sel=$?
361
         case $sel in
386
         case $sel in
362
             1) return;;
387
             1) return;;
365
         case $(cat $data) in
390
         case $(cat $data) in
366
             1) pleroma_set_background_image;;
391
             1) pleroma_set_background_image;;
367
             2) pleroma_set_title;;
392
             2) pleroma_set_title;;
368
-            3) pleroma_set_expire_months;;
369
-            4) break;;
393
+            3) pleroma_disable_registrations;;
394
+            4) pleroma_set_expire_months;;
395
+            5) break;;
370
         esac
396
         esac
371
         rm $data
397
         rm $data
372
     done
398
     done