Get domain name

This commit is contained in:
Bob Mottram 2017-04-03 23:27:10 +01:00
parent ed1df8bdf5
commit 0ae213a7ea
3 changed files with 14 additions and 3 deletions

View File

@ -244,6 +244,8 @@ function reconfigure_gnusocial {
}
function gnusocial_set_background_image {
GNUSOCIAL_DOMAIN_NAME=$(get_completion_param "gnusocial domain")
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"GNU Social" \

View File

@ -228,6 +228,8 @@ function reconfigure_postactiv {
}
function postactiv_set_background_image {
POSTACTIV_DOMAIN_NAME=$(get_completion_param "postactiv domain")
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"PostActiv" \
@ -240,9 +242,11 @@ function postactiv_set_background_image {
if [ ${#temp_background} -gt 0 ]; then
POSTACTIV_BACKGROUND_IMAGE_URL="$temp_background"
write_config_param "POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_BACKGROUND_IMAGE_URL"
pleroma_set_background_image_from_url "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_TITLE"
dialog --title $"Set PostActiv background" \
--msgbox $"The background image has been set" 6 60
if [[ $(pleroma_set_background_image_from_url "$POSTACTIV_DOMAIN_NAME" "$POSTACTIV_BACKGROUND_IMAGE_URL" "$POSTACTIV_TITLE" | tail -n 1) == "0" ]]; then
dialog --title $"Set PostActiv background" \
--msgbox $"The background image has been set" 6 60
fi
fi
;;
esac

View File

@ -39,6 +39,11 @@ function pleroma_set_background_image_from_url {
url="$2"
title="$3"
if [ ${#domain_name} -eq 0 ]; then
echo "1"
return
fi
ext=
if [ ${#url} -gt 0 ]; then
if [[ "$url" == *".jpeg" || "$url" == *".jpg" ]]; then