diff options
Diffstat (limited to 'lib/httracker')
-rw-r--r-- | lib/httracker/functions | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/httracker/functions b/lib/httracker/functions index 36286d5..7d3b4b5 100644 --- a/lib/httracker/functions +++ b/lib/httracker/functions @@ -66,19 +66,16 @@ function httracker_get { rm -rf $TARGET fi - # Get a screenshot - # https://github.com/paulhammond/webkit2png/ - # https://github.com/adamn/python-webkit2png - # https://snippets.aktagon.com/snippets/504-how-to-generate-screenshots-on-debian-linux-with-python-webkit2png - if [ "$WEBKIT2PNG" == "1" ] && which xvfb-run &> /dev/null; then - xvfb-run -a $DIRNAME/webkit2png/webkit2png/webkit2png.py -o $TARGET/screenshot.png "$url" - fi - - # Build a PDF + # Save as PDF if [ "$WKHTMLTOPDF" == "1" ] && which xvfb-run &> /dev/null && which wkhtmltopdf &> /dev/null; then xvfb-run -a wkhtmltopdf "$url" $TARGET/screenshot.pdf fi + # Save as PNG + if [ "$WKHTMLTOIMAGE" == "1" ] && which xvfb-run &> /dev/null && which wkhtmltoimage &> /dev/null; then + xvfb-run -a wkhtmltoimage "$url" $TARGET/screenshot.png + fi + # See https://www.insecure.ws/linux/serverless_screenshot.html # http://gfdsa.gfdsa.org/2012/08/15/making-web-pages-screenshots-with-webkit2png-flash-included/ if [ ! -d "$TARGET/screenshot.pdf" ]; then @@ -87,6 +84,16 @@ function httracker_get { fi fi + # Get a screenshot + # https://github.com/paulhammond/webkit2png/ + # https://github.com/adamn/python-webkit2png + # https://snippets.aktagon.com/snippets/504-how-to-generate-screenshots-on-debian-linux-with-python-webkit2png + if [ ! -d "$TARGET/screenshot.png" ]; then + if [ "$WEBKIT2PNG" == "1" ] && which xvfb-run &> /dev/null; then + xvfb-run -a $DIRNAME/webkit2png/webkit2png/webkit2png.py -o $TARGET/screenshot.png "$url" + fi + fi + # Fix permissions again if [ "`whoami`" != "$USER" ] && [ "`whoami`" == "root" ]; then echo "Fixing $TARGET permissions..." |