diff --git a/lg.py b/lg.py index 8966226..3b5e56e 100644 --- a/lg.py +++ b/lg.py @@ -509,8 +509,12 @@ def show_bgpmap(): graph.add_edge(pydot.Edge(*(_as, _as), label=" %dx" % prepend_as[_as], color="grey", fontcolor="grey")) #response = Response("
" + graph.create_dot() + "
") - response = Response(graph.create_png(), mimetype='image/png') - # response = Response(graph.create_svg(), mimetype='image/svg+xml') + if fmt == "png": + response = Response(graph.create_png(), mimetype='image/png') + elif fmt == "svg": + response = Response(graph.create_svg(), mimetype='image/svg+xml') + else: + abort(400, "Incorrect format") response.headers['Last-Modified'] = datetime.now() response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0' response.headers['Pragma'] = 'no-cache' diff --git a/templates/bgpmap.html b/templates/bgpmap.html index 4dbfa86..0ea72f8 100644 --- a/templates/bgpmap.html +++ b/templates/bgpmap.html @@ -1,5 +1,9 @@ {% extends "layout.html" %} {% block body %} +
+ SVG + PNG +

{{session.hosts}}: {{command}}

{% if session.request_args != expression|replace("/32","")|replace("/128","") %} DNS: {{session.request_args}} => {{expression|replace("/32","")|replace("/128","")}}