diff --git a/src/app.py b/src/app.py index 02ff5fc..1492766 100644 --- a/src/app.py +++ b/src/app.py @@ -4,11 +4,13 @@ from werkzeug.wrappers.response import Response from config import init from routes.api.download import router as api_download from routes.api.upload import router as api_upload +from routes.file import router as download from routes.index import router as index app = Flask(__name__, static_url_path="/", static_folder="public") app.register_blueprint(index, url_prefix="/index") app.register_blueprint(api_upload, url_prefix="/api/upload") +app.register_blueprint(download, url_prefix="/file") app.register_blueprint(api_download, url_prefix="/api/download") init() diff --git a/src/routes/api/download.py b/src/routes/api/download.py index f9234f8..a055421 100644 --- a/src/routes/api/download.py +++ b/src/routes/api/download.py @@ -4,8 +4,9 @@ from werkzeug.wrappers.response import Response router = Blueprint("download", __name__) -@router.route("", methods=["POST"]) -def download() -> Response: +@router.route("", methods=["POST"]) +def download(file_hash: str) -> Response: """Download interface""" # TODO: Send the encrypted file to the javascript client + print("download of file", file_hash) return redirect("index") diff --git a/src/routes/file.py b/src/routes/file.py new file mode 100644 index 0000000..175569c --- /dev/null +++ b/src/routes/file.py @@ -0,0 +1,13 @@ +from config import Config +from flask import Blueprint, render_template + +router = Blueprint("file", __name__) + + +@router.route("/") +def file(file_hash: int, key_data: str) -> str: + """Download page""" + print(f"hash : {file_hash}") + key = key_data.split(":") + print(f"key : {key}") + return render_template("index.html", config=Config, download=True)