Include background image and title in postactiv interactive install

This commit is contained in:
Bob Mottram 2017-02-22 21:08:12 +00:00
parent 89b37d8bc0
commit 35bbaca5a7
1 changed files with 24 additions and 5 deletions

View File

@ -100,15 +100,19 @@ function install_interactive_postactiv {
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"PostActiv Configuration" \
--form $"\nPlease enter your postactiv details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
--form $"\nPlease enter your PostActiv 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 'POSTACTIV_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
$"Code:" 2 1 "$(grep 'POSTACTIV_CODE' temp.cfg | awk -F '=' '{print $2}')" 2 25 33 255 \
$"Totle:" 2 1 "$(grep '$POSTACTIV_TITLE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
$"Background image URL:" 3 1 "$(grep '$POSTACTIV_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
$"Code:" 4 1 "$(grep 'POSTACTIV_CODE' temp.cfg | awk -F '=' '{print $2}')" 4 25 33 255 \
2> $data
else
dialog --backtitle $"Freedombone Configuration" \
--title $"PostActiv Configuration" \
--form $"\nPlease enter your postactiv details.\n\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
--form $"\nPlease enter your PostActiv 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 'POSTACTIV_DOMAIN_NAME' temp.cfg | awk -F '=' '{print $2}')" 1 25 33 40 \
$"Title:" 2 1 "$(grep '$POSTACTIV_TITLE' temp.cfg | awk -F '=' '{print $2}')" 2 25 255 255 \
$"Background image URL:" 3 1 "$(grep '$POSTACTIV_BACKGROUND_IMAGE_URL' temp.cfg | awk -F '=' '{print $2}')" 3 25 255 255 \
2> $data
fi
sel=$?
@ -117,7 +121,14 @@ function install_interactive_postactiv {
255) exit 1;;
esac
POSTACTIV_DOMAIN_NAME=$(cat $data | sed -n 1p)
title=$(cat $data | sed -n 2p)
if [ ${#title} -gt 1 ]; then
POSTACTIV_TITLE=$welcome_msg
fi
img_url=$(cat $data | sed -n 3p)
if [ ${#img_url} -gt 1 ]; then
POSTACTIV_BACKGROUND_IMAGE_URL=$img_url
fi
if [ $POSTACTIV_DOMAIN_NAME ]; then
if [[ $POSTACTIV_DOMAIN_NAME == "$HUBZILLA_DOMAIN_NAME" ]]; then
POSTACTIV_DOMAIN_NAME=""
@ -129,7 +140,7 @@ function install_interactive_postactiv {
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
POSTACTIV_CODE=$(cat $data | sed -n 2p)
POSTACTIV_CODE=$(cat $data | sed -n 4p)
validate_freedns_code "$POSTACTIV_CODE"
if [ ! $VALID_CODE ]; then
POSTACTIV_DOMAIN_NAME=
@ -142,8 +153,16 @@ function install_interactive_postactiv {
fi
done
# remove any invalid characters
if [ ${#POSTACTIV_TITLE} -gt 0 ]; then
new_title=$(echo "$POSTACTIV_TITLE" | sed "s|'||g")
POSTACTIV_TITLE="$new_title"
fi
# save the results in the config file
write_config_param "POSTACTIV_CODE" "$POSTACTIV_CODE"
write_config_param "POSTACTIV_TITLE" "$POSTACTIV_TITLE"
write_config_param "POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_BACKGROUND_IMAGE_URL"
fi
write_config_param "POSTACTIV_DOMAIN_NAME" "$POSTACTIV_DOMAIN_NAME"
APP_INSTALLED=1
@ -685,7 +704,7 @@ function install_postactiv {
install_qvitter "$POSTACTIV_DOMAIN_NAME" "postactiv"
function_check install_nodejs
install_nodejs pleroma-gnusocial
install_nodejs pleroma-postactiv
install_pleroma "postactiv" "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_TITLE"
expire_postactiv_posts