summaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2019-06-26 16:36:20 +0900
committerjaseg <git@jaseg.net>2019-06-26 16:36:20 +0900
commitbf86e740bd1f025af3158ffdaaa05c25d7a2a37a (patch)
tree0afe889adfc23becb64dab14e9c5950e6e9772b4 /server.py
parentfb2f3bcc2a6ec010e1ffc33b78833234f57da11a (diff)
downloadsecure-download-bf86e740bd1f025af3158ffdaaa05c25d7a2a37a.tar.gz
secure-download-bf86e740bd1f025af3158ffdaaa05c25d7a2a37a.tar.bz2
secure-download-bf86e740bd1f025af3158ffdaaa05c25d7a2a37a.zip
Improve encrypt command line interface, add progress bar
Diffstat (limited to 'server.py')
-rw-r--r--server.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/server.py b/server.py
index 694b1ac..4d8e4dc 100644
--- a/server.py
+++ b/server.py
@@ -8,6 +8,7 @@ from flask import Flask, abort, request, Response
import filecrypt
app = Flask(__name__)
+app.config.from_envvar('SECURE_DOWNLOAD_SETTINGS')
BASE64_RE = re.compile('^[A-Za-z0-9+-_]+=*$')
@app.route('/<file_id>/<token>/<filename>')
@@ -17,7 +18,7 @@ def download(file_id, token, filename):
if not BASE64_RE.match(token) or len(token) != filecrypt.TOKEN_LENGTH:
abort(400, 'Invalid token format')
- path = f'{file_id}.enc'
+ path = f'{app.config["SERVE_PATH"]}/{file_id}.enc'
if not os.path.isfile(path):
abort(403) # forbidden