Options to switch between qvitter and pleroma

This commit is contained in:
Bob Mottram 2017-04-20 19:29:20 +01:00
parent 60adb3ddf2
commit 4ca6024342
3 changed files with 50 additions and 6 deletions

View File

@ -315,11 +315,13 @@ function configure_interactive_gnusocial {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"GNU Social" \
--radiolist $"Choose an operation:" 13 70 4 \
--radiolist $"Choose an operation:" 15 70 6 \
1 $"Set a background image" off \
2 $"Set the title" off \
3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
4 $"Exit" on 2> $data
4 $"Select Qvitter user interface" off \
5 $"Select Pleroma user interface" off \
6 $"Exit" on 2> $data
sel=$?
case $sel in
1) return;;
@ -329,7 +331,9 @@ function configure_interactive_gnusocial {
1) gnusocial_set_background_image;;
2) gnusocial_set_title;;
3) gnusocial_set_expire_months;;
4) break;;
4) gnusocial_use_qvitter gnusocial;;
5) gnusocial_use_pleroma gnusocial;;
6) break;;
esac
done
}

View File

@ -313,11 +313,13 @@ function configure_interactive_postactiv {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \
--title $"PostActiv" \
--radiolist $"Choose an operation:" 13 70 4 \
--radiolist $"Choose an operation:" 15 70 6 \
1 $"Set a background image" off \
2 $"Set the title" off \
3 $"Set post expiry period (currently $POSTACTIV_EXPIRE_MONTHS months)" off \
4 $"Exit" on 2> $data
4 $"Select Qvitter user interface" off \
5 $"Select Pleroma user interface" off \
6 $"Exit" on 2> $data
sel=$?
case $sel in
1) return;;
@ -327,7 +329,9 @@ function configure_interactive_postactiv {
1) postactiv_set_background_image;;
2) postactiv_set_title;;
3) postactiv_set_expire_months;;
4) break;;
4) gnusocial_use_qvitter postactiv;;
5) gnusocial_use_pleroma postactiv;;
6) break;;
esac
done
}

View File

@ -463,4 +463,40 @@ function expire_gnusocial_posts {
fi
}
function gnusocial_use_qvitter {
database_name=$1
domain_name=$(get_completion_param "$database_name domain")
if [ -f /var/www/$domain_name/htdocs/index_qvitter.php ]; then
mv /var/www/$domain_name/htdocs/index_qvitter.php /var/www/$domain_name/htdocs/index.php
fi
if [ -f /etc/nginx/sites-available/$domain_name ]; then
sed -i 's|index_qvitter.php|index.php|g' /etc/nginx/sites-available/$domain_name
sed -i 's|index.html|index.php|g' /etc/nginx/sites-available/$domain_name
fi
systemctl restart nginx
}
function gnusocial_use_pleroma {
database_name=$1
domain_name=$(get_completion_param "$database_name domain")
if [ ! -d /var/www/$domain_name/htdocs/static ]; then
return
fi
if [ -f /var/www/$domain_name/htdocs/index.php ]; then
mv /var/www/$domain_name/htdocs/index.php /var/www/$domain_name/htdocs/index_qvitter.php
fi
if [ -f /etc/nginx/sites-available/$domain_name ]; then
sed -i 's|index.php|index_qvitter.php|g' /etc/nginx/sites-available/$domain_name
sed -i 's|index index_qvitter.php|index index.html|g' /etc/nginx/sites-available/$domain_name
fi
systemctl restart nginx
}
# NOTE: deliberately there is no "exit 0"