diff --git a/lookyloo/lookyloo.py b/lookyloo/lookyloo.py index a6766dc..14a6794 100644 --- a/lookyloo/lookyloo.py +++ b/lookyloo/lookyloo.py @@ -521,20 +521,25 @@ class Lookyloo(): '''Get the thumbnail of the rendered page. Always crop to a square.''' to_return = BytesIO() size = width, width - try: - s = self.get_screenshot(capture_uuid) - orig_screenshot = Image.open(s) - to_thumbnail = orig_screenshot.crop((0, 0, orig_screenshot.width, orig_screenshot.width)) - except Image.DecompressionBombError as e: - # The image is most probably too big: https://pillow.readthedocs.io/en/stable/reference/Image.html - self.logger.warning(f'Unable to generate the screenshot thumbnail of {capture_uuid}: image too big ({e}).') - error_img: Path = get_homedir() / 'website' / 'web' / 'static' / 'error_screenshot.png' - to_thumbnail = Image.open(error_img) - except UnidentifiedImageError as e: - # The image is most probably too big: https://pillow.readthedocs.io/en/stable/reference/Image.html - self.logger.warning(f'Unable to generate the screenshot thumbnail of {capture_uuid}: image too big ({e}).') - error_img = get_homedir() / 'website' / 'web' / 'static' / 'error_screenshot.png' - to_thumbnail = Image.open(error_img) + filename, data = self.get_data(capture_uuid) + if filename: + download_img: Path = get_homedir() / 'website' / 'web' / 'static' / 'download.png' + to_thumbnail = Image.open(download_img) + else: + try: + s = self.get_screenshot(capture_uuid) + orig_screenshot = Image.open(s) + to_thumbnail = orig_screenshot.crop((0, 0, orig_screenshot.width, orig_screenshot.width)) + except Image.DecompressionBombError as e: + # The image is most probably too big: https://pillow.readthedocs.io/en/stable/reference/Image.html + self.logger.warning(f'Unable to generate the screenshot thumbnail of {capture_uuid}: image too big ({e}).') + error_img: Path = get_homedir() / 'website' / 'web' / 'static' / 'error_screenshot.png' + to_thumbnail = Image.open(error_img) + except UnidentifiedImageError as e: + # The image is most probably too big: https://pillow.readthedocs.io/en/stable/reference/Image.html + self.logger.warning(f'Unable to generate the screenshot thumbnail of {capture_uuid}: {e}.') + error_img = get_homedir() / 'website' / 'web' / 'static' / 'error_screenshot.png' + to_thumbnail = Image.open(error_img) to_thumbnail.thumbnail(size) to_thumbnail.save(to_return, 'png') diff --git a/website/web/sri.txt b/website/web/sri.txt index e3d3c17..959a717 100644 --- a/website/web/sri.txt +++ b/website/web/sri.txt @@ -12,6 +12,7 @@ "datatables.min.js": "VUgHTv8zUr1K/xtRWvjLwZx2RiyuMfhxefJuDMNFQ2KYT9Y/qGKxgLJ2PBSQzyqbb9uoCzYzccAeF2hC7Qa91Q==", "down.jpg": "LHRHJ5yCaSjNcDfEoChGIfh7K5HrMYbaGn7EOlxgZ8GoLIwb0nFBkpoOMG9gMHA/pBX2skkXMukvKJC6P6FBGg==", "down_left.jpg": "UwHkJaZGayY1LewuFM3bJHQCUPG1vYyrVeiGG5mCM9MD9FtAhdbD4hBY3JZNDWv93CXeEAbxL1kqEeHTKnyquQ==", + "download.png": "A0K7cyVs9BtVjVBEBJtbWYzdKRCp+HIHRO9S0PKe/VrhCMk5Z90J64F794Q/g1H8NoeUSB0KV545kOQWl9BaOw==", "empty.svg": "6tfMLNzDFV9P6t1rC2tDRQtOGzrxi/VtIBc8aV0jo4i3u+dn1fIe3/fySBFA6z13n+XjISF5bTRUNBsN3LWinQ==", "error_screenshot.png": "IkUKnQ47PYYreukA7Byvx+5ACkcCvqk+jYD0GZoQznsD9qDPWrKAMZxlIku7G3Re19vehIlYawep/THcV/ruTA==", "exe.png": "pWwo9nBLtEss/UJ173zHa6/RpySUyz/XMdNhWc6aRIvwwHMO6a+fLmu2K6TbvO3Jbg4VYL2Af4yhHPyhH3ZeTw==", @@ -34,7 +35,7 @@ "stats.css": "/kY943FwWBTne4IIyf7iBROSfbGd82TeBicEXqKkRwawMVRIvM/Pk5MRa7okUyGIxaDjFQGmV/U1vy+PhN6Jbw==", "stats_graph.js": "0OEouA6NAxLG2wMd7D2vtGoMrXKna7My98Euc6ecyfdO4/6mIJS87vzISOS4zSZ8u4ehpa+p7E0nWhsXXE7H/Q==", "tree.css": "THJ9LnnSJ91DSTvrYoOCxRrenGgwsgG5zKo+eZLH2rRFHn6lpX9UpmRhRic4th9ZYuM9/NJUS7LqYBDRPPnB1Q==", - "tree.js": "H6ibjUxG7eD+Dz+jFBnERtxTIdR1aPssd86rCrwHH8CHUySn70aCE3mCmGYwNWw0GCpGT1IYWuZ+K0us+selNg==", + "tree.js": "GU+5QryGm9FqVNFqPPmw872HA5xCJ30fW2QBe7zkZs89bmMnk7eU1TohmkJ/GKODacjyKvMJ3q/Yfjh3F4gAjQ==", "up.jpg": "d1ljZJ9f5JekyM6RLFFH2Ua44j6neiQBdUIXOenRTjGppQr3JaeglpQIH6BjPCJL177+TH52U3UIRNS5YAyKIg==", "up_right.jpg": "OMmz+n+MxR34P8/fn5t4DkqKqdJRzQbXQ7fAi2lhkZIJGhVs2vIyY1f2hpYoBxDAX1OcYsSE2lqIR2vXNDGZsA==", "video.png": "gJtmkfr8I1Kw43pYEKjg6CAjgmhl1vIBKBQ3ZkxCu3wvxQm+6kf93iLrrFiY2WuiXzxEn2Leu52GJzmVN5id0g==", diff --git a/website/web/static/download.png b/website/web/static/download.png new file mode 100644 index 0000000..a82848e Binary files /dev/null and b/website/web/static/download.png differ diff --git a/website/web/static/tree.js b/website/web/static/tree.js index 3619cff..b13f9ff 100644 --- a/website/web/static/tree.js +++ b/website/web/static/tree.js @@ -691,7 +691,7 @@ function update(root, computed_node_width=0) { .text('This node has only known content'); }) .on('mouseout', (event, d) => d3.select('#tooltip').style('opacity', 0)); - } else if (d.data.all_empty) { + } else if (d.data.all_empty && !d.data.contains_rendered_urlnode) { // set empty d3.select(this).append("svg").append('rect') .attr('x', selected_node_bbox.width - 22 - http_icon_size)