mirror of
https://github.com/simon987/od-database.git
synced 2025-12-13 23:09:01 +00:00
Added crawl logs page
This commit is contained in:
20
app.py
20
app.py
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user