chg: [corellation graph] hide unsafe screenshots

pull/594/head
Terrtia 2023-04-21 15:38:48 +02:00
parent 6c6a3b48e2
commit e0899e6e0d
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
3 changed files with 10 additions and 5 deletions

View File

@ -86,8 +86,8 @@ class Screenshot(AbstractObject):
meta = {'id': self.id}
meta['img'] = get_screenshot_rel_path(self.id) ######### # TODO: Rename ME ??????
meta['tags'] = self.get_tags(r_list=True)
# TODO: ADD IN ABSTRACT CLASS
#meta['is_tags_safe'] = Tag.is_tags_safe(metadata_dict['tags']) ################## # TODO: ADD IN ABSTRACT CLASS
if 'tags_safe' in options:
meta['tags_safe'] = self.is_tags_safe(meta['tags'])
return meta
def get_screenshot_dir():

View File

@ -157,7 +157,8 @@ def get_description():
return Response(json.dumps({"status": "error", "reason": "404 Not Found"}, indent=2, sort_keys=True), mimetype='application/json'), 404
# object exist
else:
res = ail_objects.get_object_meta(object_type, type_id, correlation_id, options={'tags'}, flask_context=True)
res = ail_objects.get_object_meta(object_type, type_id, correlation_id, options={'tags', 'tags_safe'},
flask_context=True)
if 'tags' in res:
res['tags'] = list(res['tags'])
return jsonify(res)

View File

@ -542,10 +542,14 @@ if (d.popover) {
}
if (data["img"]) {
desc = desc + "<img src={{ url_for('objects_item.screenshot', filename="") }}" + data["img"] +" class=\"img-thumbnail\" />";
if (data["tags_safe"]) {
desc = desc + "<img src={{ url_for('objects_item.screenshot', filename="") }}" + data["img"] +" class=\"img-thumbnail\" />";
} else {
desc = desc + "<span class=\"my-2 fa-stack fa-4x\"><i class=\"fas fa-stack-1x fa-image\"></i><i class=\"fas fa-stack-2x fa-ban\" style=\"color:Red\"></i></span>";
}
}
desc = desc + "</div>"
desc = desc + "</div></div>"
div.html(desc)
.style("left", (d3_pageX) + "px")
.style("top", (d3_pageY - 28) + "px");