支持一下图表

This commit is contained in:
2019-05-28 10:34:52 +08:00
parent 0cb3987380
commit ee7ddbb1de
2 changed files with 40 additions and 0 deletions

View File

@ -236,6 +236,20 @@ def fileDownload(path):
return Response(status=404)
@app.route("/images/rrd/<filename>")
def rrdGraphGet(filename):
OMV_RRD_PATH = "/var/lib/openmediavault/rrd"
def generate(file):
with open(file, "rb") as f:
for row in f:
yield row
if os.path.isdir(OMV_RRD_PATH):
if os.path.exists(os.path.join(OMV_RRD_PATH, filename)):
return Response(generate(os.path.join(OMV_RRD_PATH, filename)),
mimetype='application/octet-stream')
return Response(status=404)
def SubThread():
t = threading.Thread(target=RUN, args=())
t.setDaemon(True)