freedombone-app-gnusocial 36KB

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