add delayed redirect

This commit is contained in:
bretello 2024-06-14 20:13:21 +02:00
parent ab83fcef30
commit d9eeb67128
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
2 changed files with 15 additions and 5 deletions

10
app.py
View File

@ -89,10 +89,11 @@ def upload_file():
thread.start()
print(f"thread started for {file.filename=}")
response = make_response("file uploaded succesfully", 301)
response.headers["Location"] = "/"
return response
return render_template(
"upload_successful.html",
url="/",
seconds=3,
)
@app.route("/run/<string:cassetta>", methods=["GET"])
@ -102,7 +103,6 @@ def run(cassetta: str):
response = make_response(make_response("", 301))
response.headers["Location"] = "/"
response.status_code = 301
return response

View File

@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<meta http-equiv="refresh" content="{{seconds}}; URL='{{url}}'" />
<title>Upload successful...</title>
</head>
<body>
<h1>You will be redirected to {{url}} in {{ seconds }} seconds.</h1>
</body>
</html>