mirror of https://github.com/CIRCL/lookyloo
chg: Use d3v5, cleanup.
parent
28d078aec4
commit
72759850ac
|
@ -48,7 +48,7 @@ sudo docker run -p 8050:8050 -p 5023:5023 scrapinghub/splash --disable-ui --disa
|
|||
```bash
|
||||
pip install -r requirements.txt
|
||||
pip install -e .
|
||||
wget https://d3js.org/d3.v4.min.js -O lookyloo/static/d3.v4.min.js
|
||||
wget https://d3js.org/d3.v5.min.js -O lookyloo/static/d3.v5.min.js
|
||||
wget https://cdn.rawgit.com/eligrey/FileSaver.js/5733e40e5af936eb3f48554cf6a8a7075d71d18a/FileSaver.js -O lookyloo/static/FileSaver.js
|
||||
```
|
||||
# Run the app locally
|
||||
|
|
|
@ -38,12 +38,6 @@ SPLASH = 'http://127.0.0.1:8050'
|
|||
HAR_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
@app.before_request
|
||||
def session_management():
|
||||
# make the session last indefinitely until it is cleared
|
||||
session.permanent = True
|
||||
|
||||
|
||||
def cleanup_old_tmpfiles():
|
||||
for tmpfile in pathlib.Path(tempfile.gettempdir()).glob('lookyloo*'):
|
||||
if time.time() - tmpfile.stat().st_atime > 36000:
|
||||
|
@ -145,6 +139,7 @@ def tree(tree_id):
|
|||
@app.route('/', methods=['GET'])
|
||||
def index():
|
||||
cleanup_old_tmpfiles()
|
||||
session.clear()
|
||||
i = 0
|
||||
titles = []
|
||||
if not HAR_DIR.exists():
|
||||
|
|
|
@ -88,17 +88,9 @@ function str2bytes (str) {
|
|||
|
||||
function urlnode_click(d) {
|
||||
var url = "url/" + d.data.uuid;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
xhr.responseType = "blob";
|
||||
xhr.withCredentials = true;
|
||||
xhr.onreadystatechange = function (){
|
||||
if (xhr.readyState === 4) {
|
||||
var blob = xhr.response;
|
||||
saveAs(blob, 'file.zip');
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
d3.blob(url, {credentials: 'same-origin'}).then(function(data) {
|
||||
saveAs(data, 'file.zip');
|
||||
});
|
||||
};
|
||||
|
||||
d3.selection.prototype.moveToFront = function() {
|
||||
|
@ -154,9 +146,8 @@ function hostnode_click(d) {
|
|||
|
||||
// Modal display
|
||||
var url = "/tree/hostname/" + d.data.uuid;
|
||||
d3.json(url, function(error, urls) {
|
||||
d3.json(url, {credentials: 'same-origin'}).then(function(urls) {
|
||||
var interval_entries = 40;
|
||||
if (error) throw error;
|
||||
urls.forEach(function(url, index, array) {
|
||||
var jdata = JSON.parse(url)
|
||||
overlay_hostname.datum({'data': jdata});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script src='{{ url_for('static', filename='FileSaver.js') }}'></script>
|
||||
<script src='{{ url_for('static', filename='d3.v4.min.js') }}'></script>
|
||||
<script src='{{ url_for('static', filename='d3.v5.min.js') }}'></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
|
|
Loading…
Reference in New Issue