freedombone-app-gnusocial 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  1. #!/bin/bash
  2. # _____ _ _
  3. # | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
  4. # | __| _| -_| -_| . | . | | . | . | | -_|
  5. # |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
  6. #
  7. # Freedom in the Cloud
  8. #
  9. # gnusocial application
  10. #
  11. # License
  12. # =======
  13. #
  14. # Copyright (C) 2014-2018 Bob Mottram <bob@freedombone.net>
  15. #
  16. # This program is free software: you can redistribute it and/or modify
  17. # it under the terms of the GNU Affero General Public License as published by
  18. # the Free Software Foundation, either version 3 of the License, or
  19. # (at your option) any later version.
  20. #
  21. # This program is distributed in the hope that it will be useful,
  22. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. # GNU Affero General Public License for more details.
  25. #
  26. # You should have received a copy of the GNU Affero General Public License
  27. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  28. VARIANTS='full full-vim social'
  29. IN_DEFAULT_INSTALL=0
  30. SHOW_ON_ABOUT=1
  31. NOT_ON_ONION=1
  32. GNUSOCIAL_DOMAIN_NAME=
  33. GNUSOCIAL_CODE=
  34. GNUSOCIAL_ONION_PORT=8087
  35. GNUSOCIAL_REPO="https://git.gnu.io/gnu/gnu-social.git"
  36. GNUSOCIAL_COMMIT='67a9c0415c395d92adeb784413bb9a88fba7347f'
  37. GNUSOCIAL_ADMIN_PASSWORD=
  38. GNUSOCIAL_BACKGROUND_IMAGE_URL=
  39. GNUSOCIAL_TITLE='Pleroma FE'
  40. # Number of months after which posts expire
  41. GNUSOCIAL_EXPIRE_MONTHS=3
  42. gnusocial_variables=(ONION_ONLY
  43. GNUSOCIAL_DOMAIN_NAME
  44. GNUSOCIAL_CODE
  45. GNUSOCIAL_WELCOME_MESSAGE
  46. GNUSOCIAL_BACKGROUND_IMAGE_URL
  47. DDNS_PROVIDER
  48. GNUSOCIAL_TITLE
  49. GNUSOCIAL_EXPIRE_MONTHS
  50. MY_USERNAME)
  51. function logging_on_gnusocial {
  52. echo -n ''
  53. }
  54. function logging_off_gnusocial {
  55. echo -n ''
  56. }
  57. function gnusocial_fix_endless_reloads {
  58. # This fixes a bug introduced with commit 5f7032dfee1fd202c14e76a9f8b37af35d584901
  59. # and which causes OrFox to endlessly reload the page
  60. sed -i 's| && common_local_referer()||g' "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/lib/apiauthaction.php"
  61. }
  62. function remove_user_gnusocial {
  63. remove_username="$1"
  64. "${PROJECT_NAME}-pass" -u "$remove_username" --rmapp gnusocial
  65. function_check get_completion_param
  66. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  67. if [ -d "/var/www/$GNUSOCIAL_DOMAIN_NAME" ]; then
  68. cd "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" || exit 236482468
  69. php scripts/deleteprofile.php -n "$remove_username" -y
  70. fi
  71. }
  72. function add_user_gnusocial {
  73. new_username="$1"
  74. new_user_password="$2"
  75. "${PROJECT_NAME}-pass" -u "$new_username" -a gnusocial -p "$new_user_password"
  76. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  77. if [ -d "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs" ]; then
  78. cd "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" || exit 27462842
  79. php scripts/registeruser.php -n "$new_username" -w "$new_user_password" -e "$new_username@$HOSTNAME"
  80. "${PROJECT_NAME}-addemail" -u "$new_username" -e "noreply@$GNUSOCIAL_DOMAIN_NAME" -g gnusocial --public no
  81. echo '0'
  82. else
  83. echo '1'
  84. fi
  85. }
  86. function install_interactive_gnusocial {
  87. if [ ! "$ONION_ONLY" ]; then
  88. ONION_ONLY='no'
  89. fi
  90. if [[ $ONION_ONLY != "no" ]]; then
  91. GNUSOCIAL_DOMAIN_NAME='gnusocial.local'
  92. else
  93. GNUSOCIAL_DETAILS_COMPLETE=
  94. while [ ! $GNUSOCIAL_DETAILS_COMPLETE ]
  95. do
  96. data=$(mktemp 2>/dev/null)
  97. if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
  98. dialog --backtitle $"Freedombone Configuration" \
  99. --title $"GNU Social Configuration" \
  100. --form $"\\nPlease enter your GNU Social details. The background image URL can be left blank.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
  101. $"Domain:" 1 1 "$(grep 'GNUSOCIAL_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
  102. $"Title:" 2 1 "$(grep "$GNUSOCIAL_TITLE" temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
  103. $"Background image URL:" 3 1 "$(grep "$GNUSOCIAL_BACKGROUND_IMAGE_URL" temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
  104. $"Code:" 4 1 "$(grep 'GNUSOCIAL_CODE' temp.cfg | awk -F '=' '{print $2}')" 4 25 33 255 \
  105. 2> "$data"
  106. else
  107. dialog --backtitle $"Freedombone Configuration" \
  108. --title $"GNU Social Configuration" \
  109. --form $"\\nPlease enter your GNU Social details. The background image URL can be left blank.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
  110. $"Domain:" 1 1 "$(grep 'GNUSOCIAL_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
  111. $"Title:" 2 1 "$(grep "$GNUSOCIAL_TITLE" temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
  112. $"Background image URL:" 3 1 "$(grep "$GNUSOCIAL_BACKGROUND_IMAGE_URL" temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
  113. 2> "$data"
  114. fi
  115. sel=$?
  116. case $sel in
  117. 1) rm -f "$data"
  118. exit 1;;
  119. 255) rm -f "$data"
  120. exit 1;;
  121. esac
  122. GNUSOCIAL_DOMAIN_NAME=$(sed -n 1p < "$data")
  123. title=$(sed -n 2p < "$data")
  124. if [ ${#title} -gt 1 ]; then
  125. GNUSOCIAL_TITLE="$title"
  126. fi
  127. img_url=$(sed -n 3p < "$data")
  128. if [ ${#img_url} -gt 1 ]; then
  129. GNUSOCIAL_BACKGROUND_IMAGE_URL=$img_url
  130. fi
  131. if [ "$GNUSOCIAL_DOMAIN_NAME" ]; then
  132. if [[ "$GNUSOCIAL_DOMAIN_NAME" == "$HUBZILLA_DOMAIN_NAME" ]]; then
  133. GNUSOCIAL_DOMAIN_NAME=""
  134. fi
  135. TEST_DOMAIN_NAME=$GNUSOCIAL_DOMAIN_NAME
  136. validate_domain_name
  137. if [[ "$TEST_DOMAIN_NAME" != "$GNUSOCIAL_DOMAIN_NAME" ]]; then
  138. GNUSOCIAL_DOMAIN_NAME=
  139. dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
  140. else
  141. if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
  142. GNUSOCIAL_CODE=$(sed -n 4p < "$data")
  143. validate_freedns_code "$GNUSOCIAL_CODE"
  144. if [ ! "$VALID_CODE" ]; then
  145. GNUSOCIAL_DOMAIN_NAME=
  146. fi
  147. fi
  148. fi
  149. fi
  150. if [ $GNUSOCIAL_DOMAIN_NAME ]; then
  151. GNUSOCIAL_DETAILS_COMPLETE="yes"
  152. fi
  153. rm -f "$data"
  154. done
  155. # remove any invalid characters
  156. if [ ${#GNUSOCIAL_TITLE} -gt 0 ]; then
  157. new_title=${GNUSOCIAL_TITLE//\'/}
  158. GNUSOCIAL_TITLE="$new_title"
  159. fi
  160. # save the results in the config file
  161. write_config_param "GNUSOCIAL_CODE" "$GNUSOCIAL_CODE"
  162. write_config_param "GNUSOCIAL_TITLE" "$GNUSOCIAL_TITLE"
  163. write_config_param "GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_BACKGROUND_IMAGE_URL"
  164. fi
  165. write_config_param "GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_DOMAIN_NAME"
  166. APP_INSTALLED=1
  167. }
  168. function change_password_gnusocial {
  169. curr_username="$1"
  170. new_user_password="$2"
  171. read_config_param 'GNUSOCIAL_DOMAIN_NAME'
  172. cd "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/scripts" || exit 246824642
  173. php setpassword.php "$curr_username" "$new_user_password"
  174. "${PROJECT_NAME}-pass" -u "$curr_username" -a gnusocial -p "$new_user_password"
  175. }
  176. function gnusocial_create_database {
  177. if [ -f "$IMAGE_PASSWORD_FILE" ]; then
  178. GNUSOCIAL_ADMIN_PASSWORD="$(printf "%s" "$(cat "$IMAGE_PASSWORD_FILE")")"
  179. else
  180. if [ ! "$GNUSOCIAL_ADMIN_PASSWORD" ]; then
  181. GNUSOCIAL_ADMIN_PASSWORD="$(create_password "${MINIMUM_PASSWORD_LENGTH}")"
  182. fi
  183. fi
  184. if [ ! "$GNUSOCIAL_ADMIN_PASSWORD" ]; then
  185. return
  186. fi
  187. function_check create_database
  188. create_database gnusocial "$GNUSOCIAL_ADMIN_PASSWORD" "$MY_USERNAME"
  189. }
  190. function reconfigure_gnusocial {
  191. echo -n ''
  192. }
  193. function gnusocial_set_background_image {
  194. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  195. data=$(mktemp 2>/dev/null)
  196. dialog --title $"GNU Social" \
  197. --backtitle $"Freedombone Control Panel" \
  198. --inputbox $'Set a background image URL' 10 60 2>"$data"
  199. sel=$?
  200. case $sel in
  201. 0)
  202. temp_background=$(<"$data")
  203. if [ ${#temp_background} -gt 0 ]; then
  204. GNUSOCIAL_BACKGROUND_IMAGE_URL="$temp_background"
  205. write_config_param "GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_BACKGROUND_IMAGE_URL"
  206. if [[ $(pleroma_set_background_image_from_url "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" "$GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE" | tail -n 1) == "0" ]]; then
  207. dialog --title $"Set GNU Social login background" \
  208. --msgbox $"The background image has been set" 6 60
  209. fi
  210. fi
  211. ;;
  212. esac
  213. rm -f "$data"
  214. }
  215. function gnusocial_set_title {
  216. data=$(mktemp 2>/dev/null)
  217. dialog --title $"GNU Social" \
  218. --backtitle $"Freedombone Control Panel" \
  219. --inputbox $'Set a title' 10 60 2>"$data"
  220. sel=$?
  221. case $sel in
  222. 0)
  223. new_title=$(<"$data")
  224. if [ ${#new_title} -gt 0 ]; then
  225. GNUSOCIAL_TITLE="$new_title"
  226. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  227. write_config_param "GNUSOCIAL_TITLE" "$GNUSOCIAL_TITLE"
  228. cd "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/static" || exit 246824242
  229. sed -i "s|\"name\":.*|\"name\": \"${GNUSOCIAL_TITLE}\",|g" config.json
  230. dialog --title $"Set GNU Social title" \
  231. --msgbox $"The title has been set" 6 60
  232. fi
  233. ;;
  234. esac
  235. rm -f "$data"
  236. }
  237. function gnusocial_set_expire_months {
  238. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  239. read_config_param "GNUSOCIAL_EXPIRE_MONTHS"
  240. data=$(mktemp 2>/dev/null)
  241. dialog --title $"GNU Social" \
  242. --backtitle $"Freedombone Control Panel" \
  243. --inputbox $'Set an expiry period for posts in months. Anything older will be deleted. Lower values help to keep the database size small and as fast as possible.' 12 60 "$GNUSOCIAL_EXPIRE_MONTHS" 2>"$data"
  244. sel=$?
  245. case $sel in
  246. 0)
  247. new_expiry_months=$(<"$data")
  248. if [ ${#new_expiry_months} -gt 0 ]; then
  249. # should contain no spaces
  250. if [[ "$new_expiry_months" == *" "* ]]; then
  251. rm -f "$data"
  252. return
  253. fi
  254. # should be a number
  255. re='^[0-9]+$'
  256. if ! [[ $new_expiry_months =~ $re ]] ; then
  257. rm -f "$data"
  258. return
  259. fi
  260. # set the new value
  261. GNUSOCIAL_EXPIRE_MONTHS=$new_expiry_months
  262. write_config_param "GNUSOCIAL_EXPIRE_MONTHS" "$GNUSOCIAL_EXPIRE_MONTHS"
  263. expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
  264. dialog --title $"Set GNU Social post expiry period" \
  265. --msgbox $"Expiry period set to $GNUSOCIAL_EXPIRE_MONTHS months" 6 60
  266. fi
  267. ;;
  268. esac
  269. rm -f "$data"
  270. }
  271. function configure_interactive_gnusocial {
  272. read_config_param GNUSOCIAL_EXPIRE_MONTHS
  273. while true
  274. do
  275. W=(1 $"Set a background image"
  276. 2 $"Set the title"
  277. 3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)"
  278. 4 $"Select Qvitter user interface"
  279. 5 $"Select Pleroma user interface"
  280. 6 $"Select Classic user interface")
  281. # shellcheck disable=SC2068
  282. selection=$(dialog --backtitle $"Freedombone Administrator Control Panel" --title $"GNU Social" --menu $"Choose an operation, or ESC to exit:" 15 60 6 "${W[@]}" 3>&2 2>&1 1>&3)
  283. if [ ! "$selection" ]; then
  284. break
  285. fi
  286. case $selection in
  287. 1) gnusocial_set_background_image;;
  288. 2) gnusocial_set_title;;
  289. 3) gnusocial_set_expire_months;;
  290. 4) gnusocial_use_qvitter gnusocial;;
  291. 5) gnusocial_use_pleroma gnusocial;;
  292. 6) gnusocial_use_classic gnusocial;;
  293. esac
  294. done
  295. }
  296. function upgrade_gnusocial {
  297. CURR_GNUSOCIAL_COMMIT=$(get_completion_param "gnusocial commit")
  298. if [[ "$CURR_GNUSOCIAL_COMMIT" == "$GNUSOCIAL_COMMIT" ]]; then
  299. return
  300. fi
  301. if grep -q "gnusocial domain" "$COMPLETION_FILE"; then
  302. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  303. fi
  304. # update to the next commit
  305. function_check set_repo_commit
  306. set_repo_commit "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" "gnusocial commit" "$GNUSOCIAL_COMMIT" "$GNUSOCIAL_REPO"
  307. gnusocial_fix_endless_reloads
  308. # Ensure that installation script is removed
  309. if [ -f "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/install.php" ]; then
  310. rm "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/install.php"
  311. fi
  312. if [ -f "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/index_qvitter.php" ]; then
  313. if [ -f "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/index.php" ]; then
  314. # shellcheck disable=SC2086
  315. mv /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/index.php /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/index_qvitter.php
  316. fi
  317. fi
  318. gnusocial_block_user_script
  319. gnusocial_block_domain_script gnusocial "$GNUSOCIAL_DOMAIN_NAME"
  320. gnusocial_hourly_script gnusocial "$GNUSOCIAL_DOMAIN_NAME"
  321. if [ -d "$INSTALL_DIR/pleroma" ]; then
  322. upgrade_pleroma_frontend "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
  323. fi
  324. install_gnusocial_default_background "gnusocial" "$GNUSOCIAL_DOMAIN_NAME"
  325. chown -R www-data:www-data "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs"
  326. }
  327. function backup_local_gnusocial {
  328. GNUSOCIAL_DOMAIN_NAME='gnusocial'
  329. if grep -q "gnusocial domain" "$COMPLETION_FILE"; then
  330. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  331. fi
  332. # don't backup more data than we need to
  333. /etc/cron.daily/gnusocial-expire
  334. source_directory="/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/backup"
  335. if [ ! -d "$source_directory" ]; then
  336. mkdir "$source_directory"
  337. fi
  338. cp -p "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/config.php" "$source_directory"
  339. if [ -d "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static" ]; then
  340. cp -rp "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static" "$source_directory"
  341. fi
  342. function_check suspend_site
  343. suspend_site "${GNUSOCIAL_DOMAIN_NAME}"
  344. function_check backup_directory_to_usb
  345. dest_directory=gnusocialconfig
  346. backup_directory_to_usb "$source_directory" "$dest_directory"
  347. source_directory="/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/file"
  348. dest_directory=gnusocialfile
  349. backup_directory_to_usb "$source_directory" "$dest_directory"
  350. function_check backup_database_to_usb
  351. backup_database_to_usb gnusocial
  352. function_check restart_site
  353. restart_site
  354. }
  355. function restore_local_gnusocial {
  356. if ! grep -q "gnusocial domain" "$COMPLETION_FILE"; then
  357. return
  358. fi
  359. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  360. if [ "$GNUSOCIAL_DOMAIN_NAME" ]; then
  361. echo $"Restoring gnusocial"
  362. temp_restore_dir=/root/tempgnusocial
  363. gnusocial_dir="/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs"
  364. # stop the daemons
  365. cd "$gnusocial_dir" || exit 24627248428
  366. scripts/stopdaemons.sh
  367. function_check gnusocial_create_database
  368. gnusocial_create_database
  369. restore_database gnusocial
  370. if [ -d $temp_restore_dir ]; then
  371. rm -rf $temp_restore_dir
  372. fi
  373. function_check restore_directory_from_usb
  374. restore_directory_from_usb $temp_restore_dir gnusocialconfig
  375. if [ -d $temp_restore_dir ]; then
  376. if [ -d "$temp_restore_dir$gnusocial_dir" ]; then
  377. cp "$temp_restore_dir$gnusocial_dir/backup/config.php" "$gnusocial_dir/"
  378. cp -rp "$temp_restore_dir$gnusocial_dir/static" "$gnusocial_dir/"
  379. else
  380. cp "$temp_restore_dir/backup/config.php" "$gnusocial_dir/"
  381. if [ ! -d "$gnusocial_dir/static" ]; then
  382. mkdir "$gnusocial_dir/static"
  383. fi
  384. cp -rp "$temp_restore_dir/static/"* "$gnusocial_dir/static/"
  385. fi
  386. chown www-data:www-data "$gnusocial_dir/config.php"
  387. chown -R www-data:www-data "$gnusocial_dir/static"
  388. rm -rf $temp_restore_dir
  389. fi
  390. restore_directory_from_usb $temp_restore_dir gnusocialfile
  391. if [ -d "$temp_restore_dir" ]; then
  392. if [ -d "$temp_restore_dir$gnusocial_dir/file" ]; then
  393. cp -rp "$temp_restore_dir$gnusocial_dir/file" "$gnusocial_dir/"
  394. else
  395. if [ ! -d "$gnusocial_dir/file" ]; then
  396. mkdir "$gnusocial_dir/file"
  397. fi
  398. cp -rp "$temp_restore_dir/"* "$gnusocial_dir/file"
  399. fi
  400. chown -R www-data:www-data "$gnusocial_dir/file"
  401. rm -rf "$temp_restore_dir"
  402. fi
  403. gnusocial_update_after_restore gnusocial "${GNUSOCIAL_DOMAIN_NAME}"
  404. echo $"Restore of gnusocial complete"
  405. fi
  406. }
  407. function backup_remote_gnusocial {
  408. GNUSOCIAL_DOMAIN_NAME='gnusocial'
  409. if grep -q "gnusocial domain" "$COMPLETION_FILE"; then
  410. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  411. fi
  412. # don't backup more data than we need to
  413. /etc/cron.daily/gnusocial-expire
  414. source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/backup
  415. if [ ! -d "$source_directory" ]; then
  416. mkdir "$source_directory"
  417. fi
  418. cp -p "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/config.php" "$source_directory"
  419. if [ -d "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static" ]; then
  420. cp -rp "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static" "$source_directory"
  421. fi
  422. function_check suspend_site
  423. suspend_site "${GNUSOCIAL_DOMAIN_NAME}"
  424. function_check backup_directory_to_friend
  425. dest_directory=gnusocialconfig
  426. backup_directory_to_friend "$source_directory" "$dest_directory"
  427. source_directory=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/file
  428. dest_directory=gnusocialfile
  429. backup_directory_to_friend "$source_directory" "$dest_directory"
  430. function_check backup_database_to_friend
  431. backup_database_to_friend gnusocial
  432. function_check restart_site
  433. restart_site
  434. }
  435. function restore_remote_gnusocial {
  436. if ! grep -q "gnusocial domain" "$COMPLETION_FILE"; then
  437. return
  438. fi
  439. GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
  440. if [ "$GNUSOCIAL_DOMAIN_NAME" ]; then
  441. echo $"Restoring gnusocial"
  442. temp_restore_dir=/root/tempgnusocial
  443. gnusocial_dir=/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
  444. # stop the daemons
  445. cd "$gnusocial_dir" || exit 2468246824
  446. scripts/stopdaemons.sh
  447. function_check gnusocial_create_database
  448. gnusocial_create_database
  449. function_check restore_database_from_friend
  450. restore_database_from_friend gnusocial
  451. if [ -d $temp_restore_dir ]; then
  452. rm -rf $temp_restore_dir
  453. fi
  454. function_check restore_directory_from_friend
  455. restore_directory_from_friend $temp_restore_dir gnusocialconfig
  456. if [ -d $temp_restore_dir ]; then
  457. if [ -d "$temp_restore_dir$gnusocial_dir" ]; then
  458. cp "$temp_restore_dir$gnusocial_dir/backup/config.php" "$gnusocial_dir/"
  459. cp -rp "$temp_restore_dir$gnusocial_dir/static" "$gnusocial_dir/"
  460. else
  461. cp "$temp_restore_dir/backup/config.php" "$gnusocial_dir/"
  462. if [ ! -d "$gnusocial_dir/static" ]; then
  463. mkdir "$gnusocial_dir/static"
  464. fi
  465. cp -rp "$temp_restore_dir/static/"* "$gnusocial_dir/static/"
  466. fi
  467. chown www-data:www-data "$gnusocial_dir/config.php"
  468. chown -R www-data:www-data "$gnusocial_dir/static"
  469. rm -rf $temp_restore_dir
  470. fi
  471. restore_directory_from_friend $temp_restore_dir gnusocialfile
  472. if [ -d $temp_restore_dir ]; then
  473. if [ ! -d "$temp_restore_dir$gnusocial_dir/file" ]; then
  474. cp -rp "$temp_restore_dir$gnusocial_dir/file" "$gnusocial_dir/"
  475. else
  476. if [ ! -d "$gnusocial_dir/file" ]; then
  477. mkdir "$gnusocial_dir/file"
  478. fi
  479. cp -rp "$temp_restore_dir/"* "$gnusocial_dir/file/"
  480. fi
  481. chown -R www-data:www-data "$gnusocial_dir/file"
  482. rm -rf $temp_restore_dir
  483. fi
  484. gnusocial_update_after_restore gnusocial "${GNUSOCIAL_DOMAIN_NAME}"
  485. echo $"Restore of gnusocial complete"
  486. fi
  487. }
  488. function remove_gnusocial {
  489. if [ ${#GNUSOCIAL_DOMAIN_NAME} -eq 0 ]; then
  490. return
  491. fi
  492. function_check remove_nodejs
  493. remove_nodejs pleroma-gnusocial
  494. read_config_param "GNUSOCIAL_DOMAIN_NAME"
  495. read_config_param "MY_USERNAME"
  496. echo "Removing $GNUSOCIAL_DOMAIN_NAME"
  497. nginx_dissite "$GNUSOCIAL_DOMAIN_NAME"
  498. remove_certs "$GNUSOCIAL_DOMAIN_NAME"
  499. if [ -f /etc/cron.hourly/gnusocial-daemons ]; then
  500. rm /etc/cron.hourly/gnusocial-daemons
  501. fi
  502. if [ -f "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/stopdaemons.sh" ]; then
  503. cd "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" || exit 2648244287
  504. scripts/stopdaemons.sh
  505. fi
  506. kill_pid=$(pgrep "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/queuedaemon.php" | head -n 1)
  507. kill -9 "$kill_pid"
  508. pkill "$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/queuedaemon.php"
  509. if [ -d "/var/www/$GNUSOCIAL_DOMAIN_NAME" ]; then
  510. rm -rf "/var/www/$GNUSOCIAL_DOMAIN_NAME"
  511. fi
  512. if [ -f "/etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME" ]; then
  513. rm "/etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME"
  514. fi
  515. function_check drop_database
  516. drop_database gnusocial
  517. function_check remove_onion_service
  518. remove_onion_service gnusocial ${GNUSOCIAL_ONION_PORT}
  519. if grep -q "gnusocial" /etc/crontab; then
  520. sed -i "/gnusocial/d" /etc/crontab
  521. fi
  522. remove_app gnusocial
  523. remove_completion_param install_gnusocial
  524. sed -i '/gnusocial/d' "$COMPLETION_FILE"
  525. remove_backup_database_local gnusocial
  526. if grep -q 'gnusocial-firewall' /etc/crontab; then
  527. sed -i '/gnusocial-firewall/d' /etc/crontab
  528. fi
  529. sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' /etc/php/7.0/cli/php.ini
  530. sed -i 's|mysqli.reconnect.*|mysqli.reconnect = Off|g' /etc/php/7.0/cli/php.ini
  531. if [ -f /usr/bin/gnusocial-firewall ]; then
  532. rm /usr/bin/gnusocial-firewall
  533. fi
  534. function_check remove_ddns_domain
  535. remove_ddns_domain "$GNUSOCIAL_DOMAIN_NAME"
  536. }
  537. function install_gnusocial_main {
  538. if [ ! "$GNUSOCIAL_DOMAIN_NAME" ]; then
  539. echo $'No domain name was given for gnusocial'
  540. exit 7359
  541. fi
  542. if [[ $(app_is_installed gnusocial_main) == "1" ]]; then
  543. return
  544. fi
  545. gnusocial_hourly_script gnusocial "$GNUSOCIAL_DOMAIN_NAME"
  546. function_check install_mariadb
  547. install_mariadb
  548. function_check get_mariadb_password
  549. get_mariadb_password
  550. function_check repair_databases_script
  551. repair_databases_script
  552. apt-get -yq install php-gettext php-curl php-gd php-mysql git curl
  553. apt-get -yq install memcached php-memcached php-intl exiftool libfcgi0ldbl
  554. if [ ! -d "/var/www/$GNUSOCIAL_DOMAIN_NAME" ]; then
  555. mkdir "/var/www/$GNUSOCIAL_DOMAIN_NAME"
  556. fi
  557. if [ ! -d "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" ]; then
  558. if [ -d /repos/gnusocial ]; then
  559. mkdir "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs"
  560. cp -r -p /repos/gnusocial/. "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs"
  561. cd "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" || exit 24682628424
  562. git pull
  563. else
  564. function_check git_clone
  565. git_clone "$GNUSOCIAL_REPO" "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs"
  566. fi
  567. if [ ! -d "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" ]; then
  568. echo $'Unable to clone gnusocial repo'
  569. exit 87525
  570. fi
  571. fi
  572. cd "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" || exit 26482468482
  573. git checkout "$GNUSOCIAL_COMMIT" -b "$GNUSOCIAL_COMMIT"
  574. set_completion_param "gnusocial commit" "$GNUSOCIAL_COMMIT"
  575. gnusocial_fix_endless_reloads
  576. chmod g+w "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs"
  577. chmod a+w "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/avatar"
  578. chmod a+w "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/file"
  579. chown -R www-data:www-data "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs"
  580. chmod +x "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/maildaemon.php"
  581. function_check gnusocial_create_database
  582. gnusocial_create_database
  583. if [ ! -f "/etc/aliases" ]; then
  584. touch /etc/aliases
  585. fi
  586. if ! grep -q "www-data: root" /etc/aliases; then
  587. echo 'www-data: root' >> /etc/aliases
  588. fi
  589. if ! grep -q "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/maildaemon.php" /etc/aliases; then
  590. echo "*: /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/scripts/maildaemon.php" >> /etc/aliases
  591. fi
  592. function_check add_ddns_domain
  593. add_ddns_domain "$GNUSOCIAL_DOMAIN_NAME"
  594. GNUSOCIAL_ONION_HOSTNAME=$(add_onion_service gnusocial 80 ${GNUSOCIAL_ONION_PORT})
  595. gnusocial_nginx_site=/etc/nginx/sites-available/$GNUSOCIAL_DOMAIN_NAME
  596. if [[ $ONION_ONLY == "no" ]]; then
  597. function_check nginx_http_redirect
  598. nginx_http_redirect "$GNUSOCIAL_DOMAIN_NAME" "index index.php"
  599. { echo 'server {';
  600. echo ' listen 443 ssl;';
  601. echo ' #listen [::]:443 ssl;';
  602. echo " server_name $GNUSOCIAL_DOMAIN_NAME;";
  603. echo ''; } >> "$gnusocial_nginx_site"
  604. function_check nginx_compress
  605. nginx_compress "$GNUSOCIAL_DOMAIN_NAME"
  606. echo '' >> "$gnusocial_nginx_site"
  607. echo ' # Security' >> "$gnusocial_nginx_site"
  608. function_check nginx_ssl
  609. nginx_ssl "$GNUSOCIAL_DOMAIN_NAME"
  610. function_check nginx_security_options
  611. nginx_security_options "$GNUSOCIAL_DOMAIN_NAME"
  612. { echo ' add_header Strict-Transport-Security max-age=15768000;';
  613. echo '';
  614. echo ' # Logs';
  615. echo ' access_log /dev/null;';
  616. echo ' error_log /dev/null;';
  617. echo '';
  618. echo ' # Root';
  619. echo " root /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs;";
  620. echo '';
  621. echo ' # Index';
  622. echo ' index index.php;';
  623. echo '';
  624. echo ' # PHP';
  625. echo ' location ~ \.php {';
  626. echo ' client_max_body_size 50m;';
  627. echo ' client_body_buffer_size 50m;';
  628. echo ' include snippets/fastcgi-php.conf;';
  629. echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
  630. echo ' fastcgi_read_timeout 30;';
  631. echo ' }';
  632. echo '';
  633. echo ' # Location';
  634. echo ' location / {'; } >> "$gnusocial_nginx_site"
  635. function_check nginx_limits
  636. nginx_limits "$GNUSOCIAL_DOMAIN_NAME" '15m'
  637. { echo " try_files \$uri \$uri/ @gnusocial;";
  638. echo ' }';
  639. echo '';
  640. echo ' # Fancy URLs';
  641. echo ' location @gnusocial {';
  642. echo ' client_max_body_size 50m;';
  643. echo ' client_body_buffer_size 50m;';
  644. echo " rewrite ^(.*)\$ /index.php?p=\$1 last;";
  645. echo ' }';
  646. echo '';
  647. echo ' # Restrict access that is unnecessary anyway';
  648. echo ' location ~ /\.(ht|git) {';
  649. echo ' deny all;';
  650. echo ' }';
  651. echo '}'; } >> "$gnusocial_nginx_site"
  652. else
  653. echo -n '' > "$gnusocial_nginx_site"
  654. fi
  655. { echo 'server {';
  656. echo " listen 127.0.0.1:$GNUSOCIAL_ONION_PORT default_server;";
  657. echo " server_name $GNUSOCIAL_ONION_HOSTNAME;";
  658. echo ''; } >> "$gnusocial_nginx_site"
  659. function_check nginx_compress
  660. nginx_compress "$GNUSOCIAL_DOMAIN_NAME"
  661. echo '' >> "$gnusocial_nginx_site"
  662. function_check nginx_security_options
  663. nginx_security_options "$GNUSOCIAL_DOMAIN_NAME"
  664. { echo '';
  665. echo ' # Logs';
  666. echo ' access_log /dev/null;';
  667. echo ' error_log /dev/null;';
  668. echo '';
  669. echo ' # Root';
  670. echo " root /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs;";
  671. echo '';
  672. echo ' # Index';
  673. echo ' index index.php;';
  674. echo '';
  675. echo ' # PHP';
  676. echo ' location ~ \.php {';
  677. echo ' client_max_body_size 50m;';
  678. echo ' client_body_buffer_size 50m;';
  679. echo ' include snippets/fastcgi-php.conf;';
  680. echo ' fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;';
  681. echo ' fastcgi_read_timeout 30;';
  682. echo ' }';
  683. echo '';
  684. echo ' # Location';
  685. echo ' location / {'; } >> "$gnusocial_nginx_site"
  686. function_check nginx_limits
  687. nginx_limits "$GNUSOCIAL_DOMAIN_NAME" '15m'
  688. { echo " try_files \$uri \$uri/ @gnusocial;";
  689. echo ' }';
  690. echo '';
  691. echo ' # Fancy URLs';
  692. echo ' location @gnusocial {';
  693. echo ' client_max_body_size 50m;';
  694. echo ' client_body_buffer_size 50m;';
  695. echo " rewrite ^(.*)\$ /index.php?p=\$1 last;";
  696. echo ' }';
  697. echo '';
  698. echo ' # Restrict access that is unnecessary anyway';
  699. echo ' location ~ /\.(ht|git) {';
  700. echo ' deny all;';
  701. echo ' }';
  702. echo '}'; } >> "$gnusocial_nginx_site"
  703. function_check gnusocial_set_limits
  704. gnusocial_set_limits "$gnusocial_nginx_site"
  705. function_check configure_php
  706. configure_php
  707. function_check create_site_certificate
  708. create_site_certificate "$GNUSOCIAL_DOMAIN_NAME" 'yes'
  709. # Ensure that the database gets backed up locally, if remote
  710. # backups are not being used
  711. function_check backup_databases_script_header
  712. backup_databases_script_header
  713. function_check backup_database_local
  714. backup_database_local gnusocial
  715. function_check nginx_ensite
  716. nginx_ensite "$GNUSOCIAL_DOMAIN_NAME"
  717. # NOTE: For the typical case always enable SSL and only
  718. # disable it if in onion only mode. This is due to complexities
  719. # with the way URLs are generated by gnusocial
  720. gnusocial_ssl='always'
  721. if [[ $ONION_ONLY != 'no' ]]; then
  722. gnusocial_ssl='never'
  723. fi
  724. GNUSOCIAL_SERVER=${GNUSOCIAL_DOMAIN_NAME}
  725. if [[ $ONION_ONLY != 'no' ]]; then
  726. GNUSOCIAL_SERVER=${GNUSOCIAL_ONION_HOSTNAME}
  727. fi
  728. # Create the configuration
  729. gnusocial_installer="/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/scripts/install_cli.php"
  730. if [ ! -f "$gnusocial_installer" ]; then
  731. rm -rf "/var/www/$GNUSOCIAL_DOMAIN_NAME"
  732. echo $'No gnusocial commandline installer found'
  733. exit 53026
  734. fi
  735. ${gnusocial_installer} --server "${GNUSOCIAL_SERVER}" \
  736. --host="localhost" --database="gnusocial" \
  737. --dbtype=mysql --username="root" -v \
  738. --password="$MARIADB_PASSWORD" \
  739. --sitename=$"GNU Social" --fancy='yes' \
  740. --admin-nick="$MY_USERNAME" \
  741. --admin-pass="$GNUSOCIAL_ADMIN_PASSWORD" \
  742. --site-profile="community" \
  743. --ssl=${gnusocial_ssl}
  744. # There can be a lot of warnings here so the return value check is disabled
  745. #if [ ! "$?" = "0" ]; then
  746. # # failed to install
  747. # echo $'Could not install GNU Social'
  748. # exit 72357
  749. #fi
  750. # check gnusocial has a config file
  751. gnusocial_config_file="/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php"
  752. if [ ! -f "$gnusocial_config_file" ]; then
  753. drop_database gnusocial
  754. rm -rf "/var/www/$GNUSOCIAL_DOMAIN_NAME"
  755. echo $'Gnusocial config.php not found'
  756. exit 87586
  757. fi
  758. # Some useful settings
  759. if ! grep -q "Recommended GNU social settings" "$gnusocial_config_file"; then
  760. { echo "";
  761. echo "// Recommended GNU social settings";
  762. echo "\$config['thumbnail']['maxsize'] = 3000;";
  763. echo "\$config['profile']['delete'] = true;";
  764. echo "\$config['profile']['changenick'] = true;";
  765. echo "\$config['public']['localonly'] = false;";
  766. echo "addPlugin('StoreRemoteMedia');";
  767. echo "\$config['queue']['enabled'] = true;";
  768. echo "\$config['queue']['daemon'] = true;";
  769. echo "\$config['ostatus']['hub_retries'] = 3;"; } >> "$gnusocial_config_file"
  770. fi
  771. # turn off logging
  772. echo "\$config['site']['logfile'] = '/dev/null';" >> "$gnusocial_config_file"
  773. echo "\$config['mail']['domain'] = '${DEFAULT_DOMAIN_NAME}';" >> "$gnusocial_config_file"
  774. # This improves performance
  775. sed -i "s|//\$config\\['db'\\]\\['schemacheck'\\].*|\$config\\['db'\\]\\['schemacheck'\\] = 'script';|g" "$gnusocial_config_file"
  776. # remove the install script
  777. if [ -f "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/install.php" ]; then
  778. rm "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/install.php"
  779. fi
  780. # php configuration
  781. sed -i 's|mysqli.allow_persistent.*|mysqli.allow_persistent = On|g' /etc/php/7.0/cli/php.ini
  782. sed -i 's|mysqli.reconnect.*|mysqli.reconnect = On|g' /etc/php/7.0/cli/php.ini
  783. systemctl restart mariadb
  784. systemctl restart php7.0-fpm
  785. systemctl restart nginx
  786. "${PROJECT_NAME}-addemail" -u "$MY_USERNAME" -e "noreply@$GNUSOCIAL_DOMAIN_NAME" -g gnusocial --public no
  787. "${PROJECT_NAME}-pass" -u "$MY_USERNAME" -a gnusocial -p "$GNUSOCIAL_ADMIN_PASSWORD"
  788. gnusocial_block_user_script
  789. gnusocial_block_domain_script gnusocial "$GNUSOCIAL_DOMAIN_NAME"
  790. set_completion_param "gnusocial domain" "$GNUSOCIAL_DOMAIN_NAME"
  791. install_completed gnusocial_main
  792. }
  793. function install_gnusocial {
  794. if [[ "$ONION_ONLY" != 'no' ]]; then
  795. return
  796. fi
  797. install_gnusocial_main
  798. expire_gnusocial_posts "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_EXPIRE_MONTHS"
  799. install_qvitter "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
  800. install_gnusocial_markdown "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
  801. install_gnusocial_plugin_sharings "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
  802. install_gnusocial_plugin_sharings_theme "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
  803. # Currently Pleroma won't install on ARM systems
  804. # because it uses node-sass which doesn't support ARM
  805. if [[ "$(arch)" == "arm"* || "$(arch)" == "aarch"* ]]; then
  806. echo -m $'WARNING: Pleroma currently does not support ARM '
  807. echo $'architecture, so it will not be installed'
  808. else
  809. function_check install_nodejs
  810. install_nodejs pleroma-gnusocial
  811. install_pleroma_front_end "gnusocial" "$GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
  812. install_gnusocial_default_background "gnusocial" "$GNUSOCIAL_DOMAIN_NAME"
  813. sed -i 's|"theme":.*|"theme": "base16-apathy.css",|g' "/var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs/static/config.json"
  814. fi
  815. # this has to be run as root initially, otherwise database tables
  816. # don't get created
  817. cd "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" || exit 236482684
  818. php scripts/checkschema.php
  819. sh scripts/startdaemons.sh
  820. /etc/cron.hourly/gnusocial-daemons
  821. systemctl restart nginx
  822. # Set qvitter to be the default UI. It's probably the most stable.
  823. # And doesn't forget logins
  824. gnusocial_use_qvitter gnusocial
  825. if [ "$GNUSOCIAL_BACKGROUND_IMAGE_URL" ]; then
  826. pleroma_set_background_image_from_url "/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs" "$GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
  827. fi
  828. APP_INSTALLED=1
  829. }
  830. # NOTE: deliberately there is no "exit 0"