Move gnusocial web UI to pleroma

Note that qvitter is still needed, but may be deprecated later
This commit is contained in:
Bob Mottram 2017-02-22 20:51:23 +00:00
parent e41728d618
commit 094151d82e
2 changed files with 255 additions and 160 deletions

View File

@ -39,9 +39,7 @@ GNUSOCIAL_ONION_PORT=8087
GNUSOCIAL_REPO="https://git.gnu.io/gnu/gnu-social.git"
GNUSOCIAL_COMMIT='7d67eefdf501f492e29f59971ac288e0414dc5b0'
GNUSOCIAL_ADMIN_PASSWORD=
GNUSOCIAL_THEME_REPO="https://git.gnu.io/h2p/Qvitter.git"
GNUSOCIAL_THEME_COMMIT='a7f82628402db3a7579bb9b2877da3c5737da77b'
GNUSOCIAL_WELCOME_MESSAGE=$'<h1>Welcome to GNU Social a federated social metwork</h1><p>Another Freedombone site</p>'
GNUSOCIAL_BACKGROUND_IMAGE_URL=
GNUSOCIAL_MARKDOWN_REPO="https://git.gnu.io/chimo/markdown.git"
GNUSOCIAL_MARKDOWN_COMMIT='03c53942f94b3376f0946e6e1fe566cc21ccf232'
@ -59,6 +57,8 @@ GNUSOCIAL_NSFW_COMMIT='a096bbe0cfae9a9b177682920ffb58d32a48e136'
# script which causes old posts to expire
gnusocial_expire_script=/usr/bin/gnusocial-expire
GNUSOCIAL_TITLE='Pleroma FE'
gnusocial_variables=(ONION_ONLY
GNUSOCIAL_DOMAIN_NAME
GNUSOCIAL_CODE
@ -71,6 +71,7 @@ gnusocial_variables=(ONION_ONLY
SHARINGS_COMMIT
SHARINGS_THEME_REPO
SHARINGS_THEME_COMMIT
GNUSOCIAL_TITLE
MY_USERNAME)
function gnusocial_fix_endless_reloads {
@ -125,18 +126,18 @@ function install_interactive_gnusocial {
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"GNU Social Configuration" \
--form $"\nPlease enter your GNU Social details. Welcome message and 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 \
--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 \
$"Domain:" 1 1 "$(grep 'GNUSOCIAL_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
$"Welcome Message:" 2 1 "$(grep '$GNUSOCIAL_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
$"Totle:" 2 1 "$(grep '$GNUSOCIAL_TITLE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
$"Background image URL:" 3 1 "$(grep '$GNUSOCIAL_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
$"Code:" 4 1 "$(grep 'GNUSOCIAL_CODE' temp.cfg | awk -F '=' '{print $2}')" 4 25 33 255 \
2> $data
else
dialog --backtitle $"Freedombone Configuration" \
--title $"GNU Social Configuration" \
--form $"\nPlease enter your GNU Social details. Welcome message and 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 \
--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 \
$"Domain:" 1 1 "$(grep 'GNUSOCIAL_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
$"Welcome Message:" 2 1 "$(grep '$GNUSOCIAL_WELCOME_MESSAGE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
$"Title:" 2 1 "$(grep '$GNUSOCIAL_TITLE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
$"Background image URL:" 3 1 "$(grep '$GNUSOCIAL_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
2> $data
fi
@ -146,9 +147,9 @@ function install_interactive_gnusocial {
255) exit 1;;
esac
GNUSOCIAL_DOMAIN_NAME=$(cat $data | sed -n 1p)
welcome_msg=$(cat $data | sed -n 2p)
if [ ${#welcome_msg} -gt 1 ]; then
GNUSOCIAL_WELCOME_MESSAGE=$welcome_msg
title=$(cat $data | sed -n 2p)
if [ ${#title} -gt 1 ]; then
GNUSOCIAL_TITLE=$welcome_msg
fi
img_url=$(cat $data | sed -n 3p)
if [ ${#img_url} -gt 1 ]; then
@ -179,14 +180,14 @@ function install_interactive_gnusocial {
done
# remove any invalid characters
if [ ${#GNUSOCIAL_WELCOME_MESSAGE} -gt 0 ]; then
new_welcome=$(echo "$GNUSOCIAL_WELCOME_MESSAGE" | sed "s|'||g")
GNUSOCIAL_WELCOME_MESSAGE="$new_welcome"
if [ ${#GNUSOCIAL_TITLE} -gt 0 ]; then
new_title=$(echo "$GNUSOCIAL_TITLE" | sed "s|'||g")
GNUSOCIAL_TITLE="$new_title"
fi
# save the results in the config file
write_config_param "GNUSOCIAL_CODE" "$GNUSOCIAL_CODE"
write_config_param "GNUSOCIAL_WELCOME_MESSAGE" "$GNUSOCIAL_WELCOME_MESSAGE"
write_config_param "GNUSOCIAL_TITLE" "$GNUSOCIAL_TITLE"
write_config_param "GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_BACKGROUND_IMAGE_URL"
fi
write_config_param "GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_DOMAIN_NAME"
@ -240,42 +241,6 @@ function reconfigure_gnusocial {
echo -n ''
}
function gnusocial_set_background_image_from_url {
GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT=
if [ $GNUSOCIAL_BACKGROUND_IMAGE_URL ]; then
if [[ $GNUSOCIAL_BACKGROUND_IMAGE_URL == *".jpeg" || $GNUSOCIAL_BACKGROUND_IMAGE_URL == *".jpg" ]]; then
GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT="jpg"
fi
if [[ $GNUSOCIAL_BACKGROUND_IMAGE_URL == *".png" ]]; then
GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT="png"
fi
if [[ $$GNUSOCIAL_BACKGROUND_IMAGE_URL == *".gif" ]]; then
GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT="gif"
fi
fi
if [ $GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT ]; then
read_config_param GNUSOCIAL_DOMAIN_NAME
gnusocial_config_file=/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php
cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Qvitter
wget $GNUSOCIAL_BACKGROUND_IMAGE_URL -O img/custom.${GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT}
if [ ! -f img/custom.${GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT} ]; then
echo "$GNUSOCIAL_BACKGROUND_IMAGE_URL"
echo $'Custom background image for gnusocial could not be downloaded'
echo "1"
return
fi
if grep -q "'img/custom" $gnusocial_config_file; then
sed -i "s|'img/custom.*|'img/custom.${GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT}';|g" $gnusocial_config_file
fi
fi
echo "0"
}
function gnusocial_set_background_image {
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
@ -289,7 +254,7 @@ function gnusocial_set_background_image {
if [ ${#temp_background} -gt 0 ]; then
GNUSOCIAL_BACKGROUND_IMAGE_URL="$temp_background"
write_config_param "GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_BACKGROUND_IMAGE_URL"
if [[ $(gnusocial_set_background_image_from_url) == "0" ]]; then
if [[ $(pleroma_set_background_image_from_url "$domain_name" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE") == "0" ]]; then
dialog --title $"Set GNU Social login background" \
--msgbox $"The background image has been set" 6 60
fi
@ -298,26 +263,23 @@ function gnusocial_set_background_image {
esac
}
function gnusocial_set_welcome_message {
function gnusocial_set_title {
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"GNU Social" \
--backtitle $"Freedombone Control Panel" \
--inputbox $'Set a welcome message, which can include html formatting' 10 60 2>$data
--inputbox $'Set a title' 10 60 2>$data
sel=$?
case $sel in
0)
temp_welcome=$(<$data)
if [ ${#temp_welcome} -gt 0 ]; then
GNUSOCIAL_WELCOME_MESSAGE="$temp_welcome"
gnusocial_config_file=/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php
if grep -q "customwelcometext" $gnusocial_config_file; then
write_config_param "GNUSOCIAL_WELCOME_MESSAGE" "$GNUSOCIAL_WELCOME_MESSAGE"
sed -i "s|customwelcometext.*|customwelcometext']['en'] = '${GNUSOCIAL_WELCOME_MESSAGE}';|g" $gnusocial_config_file
dialog --title $"Set GNU Social welcome message" \
--msgbox $"Welcome message has been set" 6 60
fi
new_title=$(<$data)
if [ ${#new_title} -gt 0 ]; then
GNUSOCIAL_TITLE="$new_title"
write_config_param "GNUSOCIAL_TITLE" "$GNUSOCIAL_TITLE"
cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/static
sed -i "s|\"name\":.*|\"name\": \"${GNUSOCIAL_TITLE}\",|g" config.json
dialog --title $"Set GNU Social title" \
--msgbox $"The title has been set" 6 60
fi
;;
esac
@ -332,7 +294,7 @@ function configure_interactive_gnusocial {
--title $"GNU Social" \
--radiolist $"Choose an operation:" 12 70 3 \
1 $"Set a login screen background image" off \
2 $"Set a welcome message" off \
2 $"Set the title" off \
3 $"Exit" on 2> $data
sel=$?
case $sel in
@ -341,7 +303,7 @@ function configure_interactive_gnusocial {
esac
case $(cat $data) in
1) gnusocial_set_background_image;;
2) gnusocial_set_welcome_message;;
2) gnusocial_set_title;;
3) break;;
esac
done
@ -365,6 +327,8 @@ function upgrade_gnusocial {
function_check gnusocial_running_script
gnusocial_running_script
upgrade_pleroma "$GNUSOCIAL_DOMAIN_NAME" "gnusocial" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
}
@ -472,6 +436,9 @@ function remove_gnusocial {
if [ ${#GNUSOCIAL_DOMAIN_NAME} -eq 0 ]; then
return
fi
function_check remove_nodejs
remove_nodejs pleroma-gnusocial
read_config_param "GNUSOCIAL_DOMAIN_NAME"
read_config_param "MY_USERNAME"
echo "Removing $GNUSOCIAL_DOMAIN_NAME"
@ -933,97 +900,6 @@ function expire_gnusocial_posts {
fi
}
function install_gnusocial_theme {
# update to the next commit
function_check set_repo_commit
set_repo_commit /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Qvitter "gnusocial theme commit" "$GNUSOCIAL_THEME_COMMIT" $GNUSOCIAL_THEME_REPO
# customise with project logo
if [ -f /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Qvitter/img/sprite.png ]; then
if [ -f ~/freedombone/img/gnusocial_sprite.png ]; then
cp ~/freedombone/img/gnusocial_sprite.png /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Qvitter/img/sprite.png
else
if [ -f /home/$MY_USERNAME/freedombone/img/gnusocial_sprite.png ]; then
cp /home/$MY_USERNAME/freedombone/img/gnusocial_sprite.png /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Qvitter/img/sprite.png
fi
fi
fi
if [[ $(app_is_installed gnusocial_theme) == "1" ]]; then
return
fi
apt-get -yq install wget
if [ ! -d /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins ]; then
mkdir -p /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins
fi
cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins
function_check git_clone
git_clone $GNUSOCIAL_THEME_REPO Qvitter
cd /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Qvitter
git checkout $GNUSOCIAL_THEME_COMMIT -b $GNUSOCIAL_THEME_COMMIT
# download a custom background image
if [[ $(gnusocial_set_background_image_from_url) != "0" ]]; then
exit 356723
fi
if [ $GNUSOCIAL_BACKGROUND_IMAGE_URL ]; then
filename=$(basename "$GNUSOCIAL_BACKGROUND_IMAGE_URL")
GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT="${filename##*.}"
fi
gnusocial_config_file=/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/config.php
if ! grep -q "addPlugin('Qvitter')" $gnusocial_config_file; then
GNUSOCIAL_WELCOME_MESSAGE=$(echo $GNUSOCIAL_WELCOME_MESSAGE | sed "s|\$GNUSOCIAL_DOMAIN_NAME|$GNUSOCIAL_DOMAIN_NAME|g")
echo "" >> $gnusocial_config_file
echo "// Qvitter settings" >> $gnusocial_config_file
echo "addPlugin('Qvitter');" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['enabledbydefault'] = true;" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['defaultbackgroundcolor'] = '#f4f4f4';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['defaultlinkcolor'] = '#0084B4';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['timebetweenpolling'] = 30000; // 30 secs" >> $gnusocial_config_file
if [[ $ONION_ONLY != 'no' ]]; then
echo "\$config['site']['qvitter']['urlshortenerapiurl'] = 'http://qttr.at/shortener.php';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['urlshortenersignature'] = 'b6afeec983';" >> $gnusocial_config_file
fi
if [ $GNUSOCIAL_BACKGROUND_IMAGE_URL ]; then
echo "\$config['site']['qvitter']['sitebackground'] = 'img/custom.${GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT}';" >> $gnusocial_config_file
else
echo "\$config['site']['qvitter']['sitebackground'] = 'img/vagnsmossen.jpg';" >> $gnusocial_config_file
fi
echo "\$config['site']['qvitter']['favicon'] = 'img/favicon.ico?v=4';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['sprite'] = Plugin::staticPath('Qvitter', '').'img/sprite.png?v=40';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['enablewelcometext'] = true;" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['customwelcometext']['en'] = '$GNUSOCIAL_WELCOME_MESSAGE';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['customwelcometext']['de'] = '$GNUSOCIAL_WELCOME_MESSAGE';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['customwelcometext']['fr'] = '$GNUSOCIAL_WELCOME_MESSAGE';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['customwelcometext']['es'] = '$GNUSOCIAL_WELCOME_MESSAGE';" >> $gnusocial_config_file
echo "\$config['site']['qvitter']['blocked_ips'] = array();" >> $gnusocial_config_file
else
if [ $GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT ]; then
if [ -f img/custom.${GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT} ]; then
sed -i "s|\$config['site']['qvitter']['sitebackground'].*|\$config['site']['qvitter']['sitebackground'] = 'img/custom.${GNUSOCIAL_BACKGROUND_IMAGE_URL_EXT}';|g" $gnusocial_config_file
fi
fi
fi
# customise with project logo
if [ -f /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Qvitter/img/sprite.png ]; then
if [ -f ~/freedombone/img/gnusocial_sprite.png ]; then
cp ~/freedombone/img/gnusocial_sprite.png /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs/local/plugins/Qvitter/img/sprite.png
fi
fi
set_completion_param "gnusocial theme commit" "$GNUSOCIAL_THEME_COMMIT"
chown -R www-data:www-data /var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
install_completed gnusocial_theme
}
function install_gnusocial_markdown {
GNUSOCIAL_PATH=/var/www/$GNUSOCIAL_DOMAIN_NAME/htdocs
@ -1112,12 +988,16 @@ function install_gnusocial {
install_gnusocial_main
expire_gnusocial_posts
install_gnusocial_theme
install_qvitter "$GNUSOCIAL_DOMAIN_NAME" "gnusocial"
install_gnusocial_markdown
install_gnusocial_plugin_sharings
install_gnusocial_plugin_sharings_theme
#install_gnusocial_plugin_sharings
#install_gnusocial_plugin_sharings_theme
install_gnusocial_plugin_nsfw
function_check install_nodejs
install_nodejs pleroma-gnusocial
install_pleroma "gnusocial" "$GNUSOCIAL_DOMAIN_NAME" "$GNUSOCIAL_BACKGROUND_IMAGE_URL" "$GNUSOCIAL_TITLE"
# unleash the daemons!
/etc/cron.hourly/gnusocial-daemons

View File

@ -0,0 +1,215 @@
#!/bin/bash
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# functions common to GNU Social server varieties
#
# License
# =======
#
# Copyright (C) 2017 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
QVITTER_THEME_REPO="https://git.gnu.io/h2p/Qvitter.git"
QVITTER_THEME_COMMIT='a7f82628402db3a7579bb9b2877da3c5737da77b'
PLEROMA_REPO="https://gitgud.io/lambadalambda/pleroma-fe.git"
PLEROMA_COMMIT='935c0e09'
function pleroma_set_background_image_from_url {
domain_name="$1"
url="$2"
title="$3"
ext=
if [ ${#url} -gt 0 ]; then
if [[ $url == *".jpeg" || $url == *".jpg" ]]; then
ext="jpg"
fi
if [[ $url == *".png" ]]; then
ext="png"
fi
if [[ $url == *".gif" ]]; then
ext="gif"
fi
fi
if [ ${#ext} -gt 0 ]; then
if [ -d /var/www/${domain_name}/htdocs/static ]; then
cd /var/www/${domain_name}/htdocs/static
wget $url -O bg_custom.${ext}
if [ ! -f bg_custom.${ext} ]; then
echo "$url"
echo $'Custom background image for pleroma could not be downloaded'
echo "1"
return
fi
sed -i "s|\"background\":.*|\"background\": \"bg_custom.${ext}\",|g" config.json
fi
fi
# customise the logo
if [ -f /var/www/${domain_name}/htdocs/static/logo.png ]; then
if [ -f ~/freedombone/img/logo_white.png ]; then
cp ~/freedombone/img/logo_white.png /var/www/${domain_name}/htdocs/static/logo.png
else
if [ -f /home/$MY_USERNAME/freedombone/img/logo_white.png ]; then
cp /home/$MY_USERNAME/freedombone/img/logo_white.png /var/www/${domain_name}/htdocs/static/logo.png
fi
fi
fi
# customise the title
if [ -f /var/www/${domain_name}/htdocs/static/config.json ]; then
sed -i "s|\"name\":.*|\"name\": \"${title}\",|g" config.json
fi
echo "0"
}
function install_qvitter {
domain_name=$1
app_name=$2
# update to the next commit
function_check set_repo_commit
set_repo_commit /var/www/${domain_name}/htdocs/local/plugins/Qvitter "${app_name} theme commit" "$QVITTER_THEME_COMMIT" $QVITTER_THEME_REPO
# customise with project logo
if [ -f /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img/sprite.png ]; then
if [ -f ~/freedombone/img/gnusocial_sprite.png ]; then
cp ~/freedombone/img/gnusocial_sprite.png /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img/sprite.png
else
if [ -f /home/$MY_USERNAME/freedombone/img/gnusocial_sprite.png ]; then
cp /home/$MY_USERNAME/freedombone/img/gnusocial_sprite.png /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img/sprite.png
fi
fi
fi
if [[ $(app_is_installed "${app_name}_theme") == "1" ]]; then
return
fi
apt-get -yq install wget
if [ ! -d /var/www/${domain_name}/htdocs/local/plugins ]; then
mkdir -p /var/www/${domain_name}/htdocs/local/plugins
fi
cd /var/www/${domain_name}/htdocs/local/plugins
function_check git_clone
git_clone $QVITTER_THEME_REPO Qvitter
cd /var/www/${domain_name}/htdocs/local/plugins/Qvitter
git checkout $QVITTER_THEME_COMMIT -b $QVITTER_THEME_COMMIT
config_file=/var/www/${domain_name}/htdocs/config.php
if ! grep -q "addPlugin('Qvitter')" $config_file; then
echo "" >> $config_file
echo "// Qvitter settings" >> $config_file
echo "addPlugin('Qvitter');" >> $config_file
echo "\$config['site']['qvitter']['enabledbydefault'] = true;" >> $config_file
echo "\$config['site']['qvitter']['defaultbackgroundcolor'] = '#f4f4f4';" >> $config_file
echo "\$config['site']['qvitter']['defaultlinkcolor'] = '#0084B4';" >> $config_file
echo "\$config['site']['qvitter']['timebetweenpolling'] = 30000; // 30 secs" >> $config_file
if [[ $ONION_ONLY != 'no' ]]; then
echo "\$config['site']['qvitter']['urlshortenerapiurl'] = 'http://qttr.at/shortener.php';" >> $config_file
echo "\$config['site']['qvitter']['urlshortenersignature'] = 'b6afeec983';" >> $config_file
fi
echo "\$config['site']['qvitter']['favicon'] = 'img/favicon.ico?v=4';" >> $config_file
echo "\$config['site']['qvitter']['sprite'] = Plugin::staticPath('Qvitter', '').'img/sprite.png?v=40';" >> $config_file
echo "\$config['site']['qvitter']['enablewelcometext'] = false;" >> $config_file
echo "\$config['site']['qvitter']['blocked_ips'] = array();" >> $config_file
fi
# customise with project logo
if [ -f /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img/sprite.png ]; then
if [ -f ~/freedombone/img/gnusocial_sprite.png ]; then
cp ~/freedombone/img/gnusocial_sprite.png /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img/sprite.png
fi
fi
chown -R www-data:www-data /var/www/${domain_name}/htdocs
set_completion_param "${app_name} theme commit" "$QVITTER_THEME_COMMIT"
install_completed ${app_name}_theme
}
function install_pleroma {
app_name="$1"
pleroma_domain="$1"
background_url="$2"
title="$3"
if [ ! -d ~/build/pleroma ]; then
function_check git_clone
git_clone $PLEROMA_REPO ~/build/pleroma
if [ ! -d ~/build/pleroma ]; then
echo $'Unable to clone pleroma repo'
exit 682252
fi
fi
cd ~/build/pleroma
git checkout $PLEROMA_COMMIT -b $PLEROMA_COMMIT
set_completion_param "${app_name} pleroma commit" "$PLEROMA_COMMIT"
npm install -g yarn
yarn
npm run build
if [ ! -d ~/build/pleroma/dist ]; then
echo 'Unable to build pleroma'
exit 7629352
fi
mv ~/build/pleroma/dist/index.html ~/build/pleroma/dist/pleroma.html
cp -r ~/build/pleroma/dist/* /var/www/$pleroma_domain/htdocs/
gnusocial_set_background_image_from_url "$pleroma_domain" "$background_url" "$title"
nginx_site=/etc/nginx/sites-available/$pleroma_domain
sed -i 's|index index.php;|index pleroma.html;|g' $nginx_site
}
function upgrade_pleroma {
domain_name="$1"
app_name="$2"
background_url="$3"
title="$4"
if [ -d ~/build/pleroma ]; then
set_repo_commit ~/build/pleroma "${app_name} pleroma commit" "$PLEROMA_COMMIT" $PLEROMA_REPO
cd ~/build/pleroma
npm run build
if [ ! -d ~/build/pleroma/dist ]; then
echo 'Unable to build pleroma'
exit 268362
fi
mv ~/build/pleroma/dist/index.html ~/build/pleroma/dist/pleroma.html
cp -r ~/build/pleroma/dist/* /var/www/${domain_name}/htdocs/
pleroma_set_background_image_from_url "$domain_name" "$background_url" "$title"
else
install_pleroma "${app_name}" "${domain_name}" "${background_url}" "${title}"
fi
}
# NOTE: deliberately there is no "exit 0"