Added crawl logs page

This commit is contained in:
Simon
2018-06-18 11:41:26 -04:00
parent 99d64b658b
commit 400abc9a3c
9 changed files with 105 additions and 8 deletions

20
app.py
View File

@@ -26,11 +26,17 @@ taskDispatcher = TaskDispatcher()
searchEngine = ElasticSearchEngine("od-database")
@app.template_filter("datetime_format")
@app.template_filter("date_format")
def datetime_format(value, format='%Y-%m-%d'):
return time.strftime(format, time.gmtime(value))
@app.template_filter("datetime_format")
def datetime_format(value, format='%Y-%m-%d %H:%M:%S'):
return time.strftime(format, time.gmtime(value))
@app.route("/dl")
def downloads():
@@ -293,6 +299,18 @@ def admin_del_token():
return abort(403)
@app.route("/logs", methods=["GET"])
def admin_crawl_logs():
if "username" in session:
results = taskDispatcher.get_task_logs_by_server()
print(results)
return render_template("crawl_logs.html", logs=results)
else:
return abort(403)
if __name__ == '__main__':
if config.USE_SSL:
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)