Option to select the classic UI for gnusocial/postactiv

This commit is contained in:
Bob Mottram 2017-05-01 17:34:32 +01:00
parent 427e910b0f
commit 470e0009b7
3 changed files with 47 additions and 6 deletions

View File

@ -311,13 +311,14 @@ 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:" 15 70 6 \
--radiolist $"Choose an operation:" 16 70 7 \
1 $"Set a background image" off \
2 $"Set the title" off \
3 $"Set post expiry period (currently $GNUSOCIAL_EXPIRE_MONTHS months)" off \
4 $"Select Qvitter user interface" off \
5 $"Select Pleroma user interface" off \
6 $"Exit" on 2> $data
6 $"Select Classic user interface (no Javascript)" off \
7 $"Exit" on 2> $data
sel=$?
case $sel in
1) return;;
@ -329,7 +330,8 @@ function configure_interactive_gnusocial {
3) gnusocial_set_expire_months;;
4) gnusocial_use_qvitter gnusocial;;
5) gnusocial_use_pleroma gnusocial;;
6) break;;
6) gnusocial_use_classic gnusocial;;
7) break;;
esac
done
}

View File

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

View File

@ -629,6 +629,27 @@ function expire_gnusocial_posts {
fi
}
function gnusocial_use_classic {
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
if ! grep -q "//addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
sed -i "s|// addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
sed -i "s|addPlugin('Qvitter')|//addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
fi
systemctl restart nginx
}
function gnusocial_use_qvitter {
database_name=$1
@ -642,6 +663,14 @@ function gnusocial_use_qvitter {
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
if grep -q "//addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
sed -i "s|//addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
fi
if grep -q "// addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
sed -i "s|// addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
fi
systemctl restart nginx
}
@ -662,6 +691,14 @@ function gnusocial_use_pleroma {
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
if grep -q "//addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
sed -i "s|//addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
fi
if grep -q "// addPlugin('Qvitter')" /var/www/$domain_name/htdocs/config.php; then
sed -i "s|// addPlugin('Qvitter')|addPlugin('Qvitter')|g" /var/www/$domain_name/htdocs/config.php
fi
systemctl restart nginx
}