diff --git a/website/web/__init__.py b/website/web/__init__.py index 40b880c..5f20938 100644 --- a/website/web/__init__.py +++ b/website/web/__init__.py @@ -342,8 +342,8 @@ def send_mail(tree_uuid: str): @app.route('/tree/', methods=['GET']) -@app.route('/tree//', methods=['GET']) -def tree(tree_uuid: str, urlnode_uuid: Optional[str]=None): +@app.route('/tree//', methods=['GET']) +def tree(tree_uuid: str, node_uuid: Optional[str]=None): if tree_uuid == 'False': flash("Unable to process your request. The domain may not exist, or splash isn't started", 'error') return redirect(url_for('index')) @@ -366,6 +366,22 @@ def tree(tree_uuid: str, urlnode_uuid: Optional[str]=None): b64_thumbnail = lookyloo.get_screenshot_thumbnail(tree_uuid, for_datauri=True) screenshot_size = lookyloo.get_screenshot(tree_uuid).getbuffer().nbytes meta = lookyloo.get_meta(tree_uuid) + hostnode_to_highlight = None + if node_uuid: + try: + urlnode = ct.root_hartree.get_url_node_by_uuid(node_uuid) + if urlnode: + hostnode_to_highlight = urlnode.hostnode_uuid + except IndexError: + # node_uuid is not a urlnode, trying a hostnode + try: + hostnode = ct.root_hartree.get_host_node_by_uuid(node_uuid) + if hostnode: + hostnode_to_highlight = hostnode.uuid + except IndexError as e: + print(e) + pass + return render_template('tree.html', tree_json=ct.to_json(), start_time=ct.start_time.isoformat(), user_agent=ct.user_agent, root_url=ct.root_url, @@ -376,7 +392,7 @@ def tree(tree_uuid: str, urlnode_uuid: Optional[str]=None): enable_context_by_users=enable_context_by_users, enable_categorization=enable_categorization, enable_bookmark=enable_bookmark, - blur_screenshot=blur_screenshot, urlnode_uuid=urlnode_uuid, + blur_screenshot=blur_screenshot, urlnode_uuid=hostnode_to_highlight, auto_trigger_modules=auto_trigger_modules, has_redirects=True if cache.redirects else False) diff --git a/website/web/static/tree.js b/website/web/static/tree.js index 52cb7fe..bcf2b4c 100644 --- a/website/web/static/tree.js +++ b/website/web/static/tree.js @@ -15,6 +15,7 @@ let height = menuHeight * 2; let node_width = 10; let node_height = 55; +let center_node = null; let main_svg = d3.select("body").append("svg") .attr("width", width + margin.right + margin.left) @@ -478,6 +479,7 @@ function update(root, computed_node_width=0) { const thumbnail_size = 64; if (d.data.contains_rendered_urlnode) { + center_node = d.data.uuid; d3.select(this).append("svg").append('rect') .attr('x', selected_node_bbox.width/3) .attr('y', node_height - 3) diff --git a/website/web/templates/tree.html b/website/web/templates/tree.html index 11f69b1..dae88d0 100644 --- a/website/web/templates/tree.html +++ b/website/web/templates/tree.html @@ -66,14 +66,19 @@ }); - {% if urlnode_uuid %} {% endif%} + {% if auto_trigger_modules %}