mirror of
https://github.com/simon987/Simple-Incremental-Search-Tool.git
synced 2025-12-14 07:39:05 +00:00
Search page cleanup, added download/view button
This commit is contained in:
17
run.py
17
run.py
@@ -39,7 +39,7 @@ def document(doc_id):
|
||||
return render_template("document.html", doc=doc, directory=directory, doc_id=doc_id)
|
||||
|
||||
|
||||
@app.route("/file/<doc_id>")
|
||||
@app.route("/dl/<doc_id>")
|
||||
def file(doc_id):
|
||||
|
||||
doc = search.get_doc(doc_id)["_source"]
|
||||
@@ -47,6 +47,17 @@ def file(doc_id):
|
||||
|
||||
full_path = os.path.join(directory.path, doc["path"], doc["name"])
|
||||
|
||||
return send_file(full_path, mimetype=doc["mime"], as_attachment=True, attachment_filename=doc["name"])
|
||||
|
||||
|
||||
@app.route("/file/<doc_id>")
|
||||
def download(doc_id):
|
||||
|
||||
doc = search.get_doc(doc_id)["_source"]
|
||||
directory = storage.dirs()[doc["directory"]]
|
||||
|
||||
full_path = os.path.join(directory.path, doc["path"], doc["name"])
|
||||
|
||||
return send_file(full_path)
|
||||
|
||||
|
||||
@@ -113,7 +124,7 @@ def directory_add():
|
||||
def directory_manage(dir_id):
|
||||
|
||||
directory = storage.dirs()[dir_id]
|
||||
tn_size = get_dir_size("thumbnails/" + str(dir_id))
|
||||
tn_size = get_dir_size("static/thumbnails/" + str(dir_id))
|
||||
tn_size_formatted = humanfriendly.format_size(tn_size)
|
||||
|
||||
index_size = search.get_index_size()
|
||||
@@ -236,4 +247,4 @@ def dashboard():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run("0.0.0.0", 8080)
|
||||
app.run("0.0.0.0", 8080, threaded=True)
|
||||
|
||||
Reference in New Issue
Block a user