aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/main.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/backend/main.py b/backend/main.py
index 76aca81..8af66ca 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -5,8 +5,8 @@ import os
import sqlite3
import mimetypes
-def playout(filename, content = "application/octet-stream"):
- return ["", [('Content-Type', content), ("X-Accel-Redirect", filename)], None]
+def playout(filename, content = "text/html"):
+ return ["", [('Content-Type', content if content else "application/octet-stream"), ("X-Accel-Redirect", filename)], None]
def home():
return ["", [('Content-Type','text/html'), ("Location", config.homepage)], "302 Home"]
@@ -38,9 +38,10 @@ def resolve_alias(alias):
def listing(session):
listing = {"total": 0, "files": [], "access": session["access"], "display": session["display"]}
+ # TODO make sorting configurable
if 'r' in session["access"]:
directory = target_filename(session, None)
- files = os.listdir(directory)
+ files = sorted(os.listdir(directory))
for filename in files:
if os.path.isfile(directory + filename):
@@ -96,7 +97,7 @@ def route(path, env, session, post):
if len(path) > 1 and path[1] == "preview" and session["display"] == "gallery":
return playout("/data/" + target_filename_internal(session, "preview/" + path[2]), mimetypes.guess_type(path[2])[0])
- return playout("/interface/listing.htm", "text/html")
+ return playout("/interface/listing.htm")
def handle_request(env, response):
path = env.get('PATH_INFO', '').lstrip('/').split('/')