Automatically render any index.html files available in the path
This commit is contained in:
parent
270c102d27
commit
8c64711e1c
1 changed files with 4 additions and 0 deletions
|
|
@ -128,6 +128,10 @@ def files(path):
|
||||||
render_files = []
|
render_files = []
|
||||||
if os.path.exists(current_path):
|
if os.path.exists(current_path):
|
||||||
render_files = get_files_in_path(current_path)
|
render_files = get_files_in_path(current_path)
|
||||||
|
filenames = [x['name'] for x in render_files]
|
||||||
|
if 'index.html' in filenames:
|
||||||
|
index_path = render_files[filenames.index('index.html')]['path']
|
||||||
|
return redirect(url_for('serve_file', filepath=index_path))
|
||||||
else:
|
else:
|
||||||
return redirect(url_for('files', path=""))
|
return redirect(url_for('files', path=""))
|
||||||
return render_template('usb-file-viewer.html', title='File Viewer', current_path=current_path, render_files=render_files, get_setting=get_setting)
|
return render_template('usb-file-viewer.html', title='File Viewer', current_path=current_path, render_files=render_files, get_setting=get_setting)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue