Bläddra i källkod

Handle onion installs of pleroma

Bob Mottram 7 år sedan
förälder
incheckning
4a39e740b8
1 ändrade filer med 7 tillägg och 1 borttagningar
  1. 7
    1
      src/freedombone-app-pleroma

+ 7
- 1
src/freedombone-app-pleroma Visa fil

@@ -232,7 +232,11 @@ function pleroma_create_database {
232 232
     sed -i "/Pleroma.Web.Endpoint/a pubsub: [name: Pleroma.Web.PubSub, adapter: Phoenix.PubSub.PG2]," $pleroma_secret
233 233
     sed -i 's|pubsub: |  pubsub: |g' $pleroma_secret
234 234
     sed -i 's|watchers: []|watchers: [],|g' $pleroma_secret
235
-    sed -i "/watchers: []/a url: [host: \"$PLEROMA_DOMAIN_NAME\", scheme: \"https\", port: 443]" $pleroma_secret
235
+    if [[ $ONION_ONLY == 'no' ]]; then
236
+        sed -i "/watchers: []/a url: [host: \"$PLEROMA_DOMAIN_NAME\", scheme: \"https\", port: 443]" $pleroma_secret
237
+    else
238
+        sed -i "/watchers: []/a url: [host: \"$PLEROMA_ONION_HOSTNAME\", scheme: \"http\", port: 80]" $pleroma_secret
239
+    fi
236 240
     sed -i 's|url: |  url: |g' $pleroma_secret
237 241
     if ! grep -q "pbkdf2_rounds" $pleroma_secret; then
238 242
         sed -i '/config :logger/a config :comeonin, :pbkdf2_rounds, 1' $pleroma_secret
@@ -455,6 +459,7 @@ function restore_local_pleroma {
455 459
         temp_restore_dir=/root/temppleroma
456 460
         pleroma_dir=$PLEROMA_DIR
457 461
 
462
+        PLEROMA_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_pleroma/hostname)
458 463
         function_check pleroma_create_database
459 464
         pleroma_create_database
460 465
 
@@ -506,6 +511,7 @@ function restore_remote_pleroma {
506 511
         temp_restore_dir=/root/temppleroma
507 512
         pleroma_dir=$PLEROMA_DIR
508 513
 
514
+        PLEROMA_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_pleroma/hostname)
509 515
         function_check pleroma_create_database
510 516
         pleroma_create_database
511 517