瀏覽代碼

Option to select the classic UI for gnusocial/postactiv

Bob Mottram 8 年之前
父節點
當前提交
470e0009b7
共有 3 個檔案被更改,包括 47 行新增6 行删除
  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 查看文件

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

+ 5
- 3
src/freedombone-app-postactiv 查看文件

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

+ 37
- 0
src/freedombone-utils-gnusocialtools 查看文件

@@ -629,6 +629,27 @@ function expire_gnusocial_posts {
629 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 653
 function gnusocial_use_qvitter {
633 654
     database_name=$1
634 655
 
@@ -642,6 +663,14 @@ function gnusocial_use_qvitter {
642 663
         sed -i 's|index_qvitter.php|index.php|g' /etc/nginx/sites-available/$domain_name
643 664
         sed -i 's|index.html|index.php|g' /etc/nginx/sites-available/$domain_name
644 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 674
     systemctl restart nginx
646 675
 }
647 676
 
@@ -662,6 +691,14 @@ function gnusocial_use_pleroma {
662 691
         sed -i 's|index.php|index_qvitter.php|g' /etc/nginx/sites-available/$domain_name
663 692
         sed -i 's|index index_qvitter.php|index index.html|g' /etc/nginx/sites-available/$domain_name
664 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 702
     systemctl restart nginx
666 703
 }
667 704