mirror of
https://github.com/dobin/avred
synced 2026-06-08 13:54:13 +00:00
ui: file log display
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
from flask import Flask
|
||||
|
||||
UPLOAD_FOLDER = './app/upload'
|
||||
@@ -7,4 +8,7 @@ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
||||
app.jinja_env.auto_reload = True
|
||||
app.config["TEMPLATES_AUTO_RELOAD"] = True
|
||||
|
||||
app.config['SECRET_KEY'] = os.urandom(24)
|
||||
app.config['SESSION_TYPE'] = 'filesystem'
|
||||
|
||||
from app import views
|
||||
|
||||
+9
-1124
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
<pre>{{ logData }}</pre>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,4 @@
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
+13
-3
@@ -31,7 +31,7 @@ def example(path):
|
||||
@app.route("/view_file/<filename>")
|
||||
def view_file(filename):
|
||||
filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename + EXT_INFO)
|
||||
filepathLog = os.path.join(app.config['UPLOAD_FOLDER'],filename + EXT_LOG)
|
||||
filepathLog = os.path.join(app.config['UPLOAD_FOLDER'], filename + EXT_LOG)
|
||||
logData = ""
|
||||
if os.path.isfile(filepathLog):
|
||||
with open(filepathLog) as f:
|
||||
@@ -68,15 +68,25 @@ def file(filename):
|
||||
with open(filename, 'rb') as f:
|
||||
fileContent = f.read()
|
||||
|
||||
# log file
|
||||
filepathLog = filename + EXT_LOG
|
||||
logData = ""
|
||||
if os.path.isfile(filepathLog):
|
||||
with open(filepathLog) as f:
|
||||
logData = f.read()
|
||||
|
||||
# VerifyData
|
||||
verifyDataFile = filename + EXT_INFO
|
||||
fileData: FileData = None
|
||||
if os.path.isfile(verifyDataFile):
|
||||
with open(verifyDataFile, "rb") as input_file:
|
||||
fileData = pickle.load(input_file)
|
||||
|
||||
|
||||
return render_template('file.html',
|
||||
filename=filename, matches=fileData.matches, verifications=fileData.verifications)
|
||||
filename=filename,
|
||||
matches=fileData.matches,
|
||||
verifications=fileData.verifications,
|
||||
logData=logData)
|
||||
|
||||
|
||||
def allowed_file(filename):
|
||||
|
||||
Reference in New Issue
Block a user