diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | backend/main.py | 8 |
2 files changed, 5 insertions, 5 deletions
@@ -11,7 +11,7 @@ that lets them download or view the files you want them to have. * Set the directory's owner to the user you want uwsgi to run the application under * Edit `backend/config.py` to match your setup * Edit `configs/nginx.config` to match your setup - * Note that the `client_max_body_size` will limit the maximum size of a single uploaded file + * Note that the `client_max_body_size` directive will limit the maximum size of a single uploaded file * Install `configs/nginx.config` to `/etc/nginx/sites-enabled` * Edit `configs/uwsgi.ini` to match your setup * Note that the `limit-post` option will limit the maximum size of a single uploaded file diff --git a/backend/main.py b/backend/main.py index 8af66ca..1cf577d 100644 --- a/backend/main.py +++ b/backend/main.py @@ -8,8 +8,8 @@ import mimetypes 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"] +def redirect(target): + return ["", [('Content-Type','text/html'), ("Location", target)], "302 Redirect"] def target_filename_internal(session, filename): target = session["path"] + "/" @@ -76,13 +76,13 @@ def route(path, env, session, post): session = resolve_alias(path[0]) if not session: - return home() + return redirect(config.homepage) #print(json.dumps(session)) # Redirect if no slash after alias if len(path) == 1: - return ["", [('Content-Type','text/html'), ("Location", path[0] + "/")], "302 Redirect"] + return redirect(path[0] + "/"); if len(path) > 1 and path[1] == "upload": return upload(session, post) |