Pārlūkot izejas kodu

Options to switch between qvitter and pleroma

Bob Mottram 8 gadus atpakaļ
vecāks
revīzija
4ca6024342

+ 7
- 3
src/freedombone-app-gnusocial Parādīt failu

@@ -315,11 +315,13 @@ function configure_interactive_gnusocial {
315 315
         trap "rm -f $data" 0 1 2 5 15
316 316
         dialog --backtitle $"Freedombone Control Panel" \
317 317
                --title $"GNU Social" \
318
-               --radiolist $"Choose an operation:" 13 70 4 \
318
+               --radiolist $"Choose an operation:" 15 70 6 \
319 319
                1 $"Set a background image" off \
320 320
                2 $"Set the title" off \
321 321
                3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
322
-               4 $"Exit" on 2> $data
322
+               4 $"Select Qvitter user interface" off \
323
+               5 $"Select Pleroma user interface" off \
324
+               6 $"Exit" on 2> $data
323 325
         sel=$?
324 326
         case $sel in
325 327
             1) return;;
@@ -329,7 +331,9 @@ function configure_interactive_gnusocial {
329 331
             1) gnusocial_set_background_image;;
330 332
             2) gnusocial_set_title;;
331 333
             3) gnusocial_set_expire_months;;
332
-            4) break;;
334
+            4) gnusocial_use_qvitter gnusocial;;
335
+            5) gnusocial_use_pleroma gnusocial;;
336
+            6) break;;
333 337
         esac
334 338
     done
335 339
 }

+ 7
- 3
src/freedombone-app-postactiv Parādīt failu

@@ -313,11 +313,13 @@ 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:" 13 70 4 \
316
+               --radiolist $"Choose an operation:" 15 70 6 \
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
-               4 $"Exit" on 2> $data
320
+               4 $"Select Qvitter user interface" off \
321
+               5 $"Select Pleroma user interface" off \
322
+               6 $"Exit" on 2> $data
321 323
         sel=$?
322 324
         case $sel in
323 325
             1) return;;
@@ -327,7 +329,9 @@ function configure_interactive_postactiv {
327 329
             1) postactiv_set_background_image;;
328 330
             2) postactiv_set_title;;
329 331
             3) postactiv_set_expire_months;;
330
-            4) break;;
332
+            4) gnusocial_use_qvitter postactiv;;
333
+            5) gnusocial_use_pleroma postactiv;;
334
+            6) break;;
331 335
         esac
332 336
     done
333 337
 }

+ 36
- 0
src/freedombone-utils-gnusocialtools Parādīt failu

@@ -463,4 +463,40 @@ function expire_gnusocial_posts {
463 463
     fi
464 464
 }
465 465
 
466
+function gnusocial_use_qvitter {
467
+    database_name=$1
468
+
469
+    domain_name=$(get_completion_param "$database_name domain")
470
+
471
+    if [ -f /var/www/$domain_name/htdocs/index_qvitter.php ]; then
472
+        mv /var/www/$domain_name/htdocs/index_qvitter.php /var/www/$domain_name/htdocs/index.php
473
+    fi
474
+
475
+    if [ -f /etc/nginx/sites-available/$domain_name ]; then
476
+        sed -i 's|index_qvitter.php|index.php|g' /etc/nginx/sites-available/$domain_name
477
+        sed -i 's|index.html|index.php|g' /etc/nginx/sites-available/$domain_name
478
+    fi
479
+    systemctl restart nginx
480
+}
481
+
482
+function gnusocial_use_pleroma {
483
+    database_name=$1
484
+
485
+    domain_name=$(get_completion_param "$database_name domain")
486
+
487
+    if [ ! -d /var/www/$domain_name/htdocs/static ]; then
488
+        return
489
+    fi
490
+
491
+    if [ -f /var/www/$domain_name/htdocs/index.php ]; then
492
+        mv /var/www/$domain_name/htdocs/index.php /var/www/$domain_name/htdocs/index_qvitter.php
493
+    fi
494
+
495
+    if [ -f /etc/nginx/sites-available/$domain_name ]; then
496
+        sed -i 's|index.php|index_qvitter.php|g' /etc/nginx/sites-available/$domain_name
497
+        sed -i 's|index index_qvitter.php|index index.html|g' /etc/nginx/sites-available/$domain_name
498
+    fi
499
+    systemctl restart nginx
500
+}
501
+
466 502
 # NOTE: deliberately there is no "exit 0"