chg: Disable bookmarks by default

pull/135/head
Raphaël Vinot 2020-11-29 23:56:42 +01:00
parent 55ef3ed04d
commit 287fdeb8e6
4 changed files with 25 additions and 16 deletions

View File

@ -18,6 +18,7 @@
"enable_default_blur_screenshot": false, "enable_default_blur_screenshot": false,
"enable_context_by_users": false, "enable_context_by_users": false,
"enable_categorization": false, "enable_categorization": false,
"enable_bookmark": false,
"auto_trigger_modules": false, "auto_trigger_modules": false,
"enable_mail_notification": false, "enable_mail_notification": false,
"email": { "email": {
@ -44,6 +45,7 @@
"enable_default_blur_screenshot": "If true, blur the screenshot by default (useful on public instances)", "enable_default_blur_screenshot": "If true, blur the screenshot by default (useful on public instances)",
"enable_context_by_users": "Allow the users to add context to a response body", "enable_context_by_users": "Allow the users to add context to a response body",
"enable_categorization": "Allow the users to add contextualization to a capture", "enable_categorization": "Allow the users to add contextualization to a capture",
"enable_bookmark": "Allow to bookmark nodes on tree",
"auto_trigger_modules": "Automatically trigger the modules when the tree is loaded", "auto_trigger_modules": "Automatically trigger the modules when the tree is loaded",
"enable_mail_notification": "Enable email notification or not", "enable_mail_notification": "Enable email notification or not",
"email": "Configuration for sending email notifications." "email": "Configuration for sending email notifications."

View File

@ -52,6 +52,7 @@ max_depth = get_config('generic', 'max_depth')
enable_mail_notification = get_config('generic', 'enable_mail_notification') enable_mail_notification = get_config('generic', 'enable_mail_notification')
enable_context_by_users = get_config('generic', 'enable_context_by_users') enable_context_by_users = get_config('generic', 'enable_context_by_users')
enable_categorization = get_config('generic', 'enable_categorization') enable_categorization = get_config('generic', 'enable_categorization')
enable_bookmark = get_config('generic', 'enable_bookmark')
auto_trigger_modules = get_config('generic', 'auto_trigger_modules') auto_trigger_modules = get_config('generic', 'auto_trigger_modules')
logging.basicConfig(level=get_config('generic', 'loglevel')) logging.basicConfig(level=get_config('generic', 'loglevel'))
@ -357,6 +358,7 @@ def tree(tree_uuid: str, urlnode_uuid: Optional[str]=None):
meta=meta, enable_mail_notification=enable_mail_notification, meta=meta, enable_mail_notification=enable_mail_notification,
enable_context_by_users=enable_context_by_users, enable_context_by_users=enable_context_by_users,
enable_categorization=enable_categorization, enable_categorization=enable_categorization,
enable_bookmark=enable_bookmark,
blur_screenshot=blur_screenshot, urlnode_uuid=urlnode_uuid, blur_screenshot=blur_screenshot, urlnode_uuid=urlnode_uuid,
auto_trigger_modules=auto_trigger_modules, auto_trigger_modules=auto_trigger_modules,
has_redirects=True if cache['redirects'] else False) has_redirects=True if cache['redirects'] else False)

View File

@ -453,22 +453,24 @@ function update(root, computed_node_width=0) {
node_width = node_width > selected_node_bbox.width ? node_width : selected_node_bbox.width; node_width = node_width > selected_node_bbox.width ? node_width : selected_node_bbox.width;
// Set Bookmark // Set Bookmark
d3.select(this).append("text") if (enable_bookmark) {
.attr('x', `${selected_node_bbox.width - 12}px`) d3.select(this).append("text")
.attr('y', '20px') .attr('x', `${selected_node_bbox.width - 12}px`)
.style("font-size", "16px") .attr('y', '20px')
.attr("id", "bookmark") .style("font-size", "16px")
.text("🏁") .attr("id", "bookmark")
.attr('cursor', 'pointer') .text("🏁")
.on('click', (event, d) => NodeHighlight(d.data.uuid)) .attr('cursor', 'pointer')
.on('mouseover', (event, d) => { .on('click', (event, d) => NodeHighlight(d.data.uuid))
d3.select('#tooltip') .on('mouseover', (event, d) => {
.style('opacity', 1) d3.select('#tooltip')
.style('left', `${event.pageX + 10}px`) .style('opacity', 1)
.style('top', `${event.pageY + 10}px`) .style('left', `${event.pageX + 10}px`)
.text('Bookmark this node'); .style('top', `${event.pageY + 10}px`)
}) .text('Bookmark this node');
.on('mouseout', (event, d) => d3.select('#tooltip').style('opacity', 0)); })
.on('mouseout', (event, d) => d3.select('#tooltip').style('opacity', 0));
};
const http_icon_size = 24; const http_icon_size = 24;
if (d.data.http_content) { if (d.data.http_content) {

View File

@ -68,6 +68,7 @@
<script> <script>
var treeUUID = "{{ tree_uuid }}"; var treeUUID = "{{ tree_uuid }}";
var enable_bookmark = {{ enable_bookmark|tojson }};
var treeData = {{ tree_json | safe }}; var treeData = {{ tree_json | safe }};
</script> </script>
@ -123,9 +124,11 @@
<a href="{{ url_for('redirects', tree_uuid=tree_uuid) }}" role="button">Download redirects</a> <a href="{{ url_for('redirects', tree_uuid=tree_uuid) }}" role="button">Download redirects</a>
</li> </li>
{% endif %} {% endif %}
{% if enable_bookmark %}
<li> <li>
<a href="#/" role="button" onclick="UnbookmarkAllNodes();">Unbookmark all nodes</a> <a href="#/" role="button" onclick="UnbookmarkAllNodes();">Unbookmark all nodes</a>
</li> </li>
{% endif %}
<li> <li>
<a href="{{ url_for('image', tree_uuid=tree_uuid) }}" role="button">Download screenshot</a> <a href="{{ url_for('image', tree_uuid=tree_uuid) }}" role="button">Download screenshot</a>
</li> </li>