Quellcode durchsuchen

Option to select the classic UI for gnusocial/postactiv

Bob Mottram vor 8 Jahren
Ursprung
Commit
470e0009b7
3 geänderte Dateien mit 47 neuen und 6 gelöschten Zeilen
  1. 5
    3
      src/freedombone-app-gnusocial
  2. 5
    3
      src/freedombone-app-postactiv
  3. 37
    0
      src/freedombone-utils-gnusocialtools

+ 5
- 3
src/freedombone-app-gnusocial Datei anzeigen

311
         trap "rm -f $data" 0 1 2 5 15
311
         trap "rm -f $data" 0 1 2 5 15
312
         dialog --backtitle $"Freedombone Control Panel" \
312
         dialog --backtitle $"Freedombone Control Panel" \
313
                --title $"GNU Social" \
313
                --title $"GNU Social" \
314
-               --radiolist $"Choose an operation:" 15 70 6 \
314
+               --radiolist $"Choose an operation:" 16 70 7 \
315
                1 $"Set a background image" off \
315
                1 $"Set a background image" off \
316
                2 $"Set the title" off \
316
                2 $"Set the title" off \
317
                3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
317
                3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
318
                4 $"Select Qvitter user interface" off \
318
                4 $"Select Qvitter user interface" off \
319
                5 $"Select Pleroma user interface" off \
319
                5 $"Select Pleroma user interface" off \
320
-               6 $"Exit" on 2> $data
320
+               6 $"Select Classic user interface (no Javascript)" off \
321
+               7 $"Exit" on 2> $data
321
         sel=$?
322
         sel=$?
322
         case $sel in
323
         case $sel in
323
             1) return;;
324
             1) return;;
329
             3) gnusocial_set_expire_months;;
330
             3) gnusocial_set_expire_months;;
330
             4) gnusocial_use_qvitter gnusocial;;
331
             4) gnusocial_use_qvitter gnusocial;;
331
             5) gnusocial_use_pleroma gnusocial;;
332
             5) gnusocial_use_pleroma gnusocial;;
332
-            6) break;;
333
+            6) gnusocial_use_classic gnusocial;;
334
+            7) break;;
333
         esac
335
         esac
334
     done
336
     done
335
 }
337
 }

+ 5
- 3
src/freedombone-app-postactiv Datei anzeigen

313
         trap "rm -f $data" 0 1 2 5 15
313
         trap "rm -f $data" 0 1 2 5 15
314
         dialog --backtitle $"Freedombone Control Panel" \
314
         dialog --backtitle $"Freedombone Control Panel" \
315
                --title $"PostActiv" \
315
                --title $"PostActiv" \
316
-               --radiolist $"Choose an operation:" 15 70 6 \
316
+               --radiolist $"Choose an operation:" 16 70 7 \
317
                1 $"Set a background image" off \
317
                1 $"Set a background image" off \
318
                2 $"Set the title" off \
318
                2 $"Set the title" off \
319
                3 $"Set post expiry period (currently $POSTACTIV_EXPIRE_MONTHS months)" off \
319
                3 $"Set post expiry period (currently $POSTACTIV_EXPIRE_MONTHS months)" off \
320
                4 $"Select Qvitter user interface" off \
320
                4 $"Select Qvitter user interface" off \
321
                5 $"Select Pleroma user interface" off \
321
                5 $"Select Pleroma user interface" off \
322
-               6 $"Exit" on 2> $data
322
+               6 $"Select Classic user interface (no Javascript)" off \
323
+               7 $"Exit" on 2> $data
323
         sel=$?
324
         sel=$?
324
         case $sel in
325
         case $sel in
325
             1) return;;
326
             1) return;;
331
             3) postactiv_set_expire_months;;
332
             3) postactiv_set_expire_months;;
332
             4) gnusocial_use_qvitter postactiv;;
333
             4) gnusocial_use_qvitter postactiv;;
333
             5) gnusocial_use_pleroma postactiv;;
334
             5) gnusocial_use_pleroma postactiv;;
334
-            6) break;;
335
+            6) gnusocial_use_classic postactiv;;
336
+            7) break;;
335
         esac
337
         esac
336
     done
338
     done
337
 }
339
 }

+ 37
- 0
src/freedombone-utils-gnusocialtools Datei anzeigen

629
     fi
629
     fi
630
 }
630
 }
631
 
631
 
632
+function gnusocial_use_classic {
633
+    database_name=$1
634
+
635
+    domain_name=$(get_completion_param "$database_name domain")
636
+
637
+    if [ -f /var/www/$domain_name/htdocs/index_qvitter.php ]; then
638
+        mv /var/www/$domain_name/htdocs/index_qvitter.php /var/www/$domain_name/htdocs/index.php
639
+    fi
640
+
641
+    if [ -f /etc/nginx/sites-available/$domain_name ]; then
642
+        sed -i 's|index_qvitter.php|index.php|g' /etc/nginx/sites-available/$domain_name
643
+        sed -i 's|index.html|index.php|g' /etc/nginx/sites-available/$domain_name
644
+    fi
645
+
646
+    if ! grep -q "//addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
647
+        sed -i "s|// addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
648
+        sed -i "s|addPlugin('Qvitter')|//addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
649
+    fi
650
+    systemctl restart nginx
651
+}
652
+
632
 function gnusocial_use_qvitter {
653
 function gnusocial_use_qvitter {
633
     database_name=$1
654
     database_name=$1
634
 
655
 
642
         sed -i 's|index_qvitter.php|index.php|g' /etc/nginx/sites-available/$domain_name
663
         sed -i 's|index_qvitter.php|index.php|g' /etc/nginx/sites-available/$domain_name
643
         sed -i 's|index.html|index.php|g' /etc/nginx/sites-available/$domain_name
664
         sed -i 's|index.html|index.php|g' /etc/nginx/sites-available/$domain_name
644
     fi
665
     fi
666
+
667
+    if grep -q "//addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
668
+        sed -i "s|//addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
669
+    fi
670
+    if grep -q "// addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
671
+        sed -i "s|// addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
672
+    fi
673
+
645
     systemctl restart nginx
674
     systemctl restart nginx
646
 }
675
 }
647
 
676
 
662
         sed -i 's|index.php|index_qvitter.php|g' /etc/nginx/sites-available/$domain_name
691
         sed -i 's|index.php|index_qvitter.php|g' /etc/nginx/sites-available/$domain_name
663
         sed -i 's|index index_qvitter.php|index index.html|g' /etc/nginx/sites-available/$domain_name
692
         sed -i 's|index index_qvitter.php|index index.html|g' /etc/nginx/sites-available/$domain_name
664
     fi
693
     fi
694
+
695
+    if grep -q "//addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
696
+        sed -i "s|//addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
697
+    fi
698
+    if grep -q "// addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
699
+        sed -i "s|// addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
700
+    fi
701
+
665
     systemctl restart nginx
702
     systemctl restart nginx
666
 }
703
 }
667
 
704