mirror of
https://github.com/sileht/bird-lg.git
synced 2024-12-22 04:24:42 +01:00
Allow get svg
This commit is contained in:
parent
6dfd9f7546
commit
2342607092
8
lg.py
8
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("<pre>" + graph.create_dot() + "</pre>")
|
||||
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'
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<div style="float:right">
|
||||
<a href="/bgpmap/?killcache=1&q={{detail}}&fmt=svg" target="_blank">SVG</a>
|
||||
<a href="/bgpmap/?killcache=1&q={{detail}}&fmt=png" target="_blank">PNG</a>
|
||||
</div>
|
||||
<h3>{{session.hosts}}: {{command}}</h3>
|
||||
{% if session.request_args != expression|replace("/32","")|replace("/128","") %}
|
||||
<i>DNS: <a href="/whois/{{session.request_args}}" class="whois">{{session.request_args}}</a> => <a href="/whois/{{ expression|replace("/32","")|replace("/128","") }}" class="whois">{{expression|replace("/32","")|replace("/128","")}}</a></i><br />
|
||||
|
|
Loading…
Reference in a new issue