diff --git a/src/freedombone-utils-gnusocialtools b/src/freedombone-utils-gnusocialtools index 09afbed0..940064f7 100755 --- a/src/freedombone-utils-gnusocialtools +++ b/src/freedombone-utils-gnusocialtools @@ -87,6 +87,31 @@ function pleroma_set_background_image_from_url { echo "\$config['site']['qvitter']['sitebackground'] = 'img/bg_custom.${ext}';" >> /var/www/${domain_name}/htdocs/config.php fi fi + else + # qvitter background + if [ -d /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img ]; then + cd /var/www/${domain_name}/htdocs/local/plugins/Qvitter/img + + # remove any existing image + if [ -f bg_custom.${ext} ]; then + rm bg_custom.${ext} + fi + + # get the new image + wget "$url" -O bg_custom.${ext} + if [ ! -f bg_custom.${ext} ]; then + echo "$url" + echo $'Custom background image for Qvitter could not be downloaded' + echo "3" + return + fi + if ! grep -q "bg_custom.${ext}" /var/www/${domain_name}/htdocs/config.php; then + if grep -q 'sitebackground' /var/www/${domain_name}/htdocs/config.php; then + sed -i '/sitebackground/d' /var/www/${domain_name}/htdocs/config.php + fi + echo "\$config['site']['qvitter']['sitebackground'] = 'img/bg_custom.${ext}';" >> /var/www/${domain_name}/htdocs/config.php + fi + fi fi else echo "2"