Add CORS support and update redirect behavior
This commit is contained in:
parent
3779cc5dc7
commit
a283c35a20
|
@ -29,6 +29,7 @@ from docker.errors import (
|
|||
)
|
||||
from flask import (
|
||||
Flask,
|
||||
Response,
|
||||
flash,
|
||||
jsonify,
|
||||
redirect,
|
||||
|
@ -426,6 +427,7 @@ def setup():
|
|||
"REVERSE_PROXY_URL": request.form["ui_url"] or "/",
|
||||
"AUTO_LETS_ENCRYPT": request.form.get("auto_lets_encrypt", "no"),
|
||||
"INTERCEPTED_ERROR_CODES": "400 404 405 413 429 500 501 502 503 504",
|
||||
"USE_CORS": "yes",
|
||||
},
|
||||
request.form["server_name"],
|
||||
request.form["server_name"],
|
||||
|
@ -433,7 +435,7 @@ def setup():
|
|||
kwargs={"operation": "new"},
|
||||
).start()
|
||||
|
||||
return redirect(url_for("loading", next=url_for("services"), message=f"Creating service {request.form['server_name']} for the web UI"))
|
||||
return Response(status=200)
|
||||
|
||||
return render_template(
|
||||
"setup.html",
|
||||
|
|
|
@ -1693,15 +1693,22 @@
|
|||
this.sslCheck.getAttribute("aria-checked") === "true" ? "s" : ""
|
||||
}://${this.servInp.value}${this.urlInp.value}`;
|
||||
|
||||
fetch(api, {
|
||||
fetch(window.location.href, {
|
||||
method: "POST",
|
||||
body: new FormData(this.formEl),
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
setTimeout(() => {
|
||||
window.location.href = api;
|
||||
}, 400);
|
||||
setInterval(() => {
|
||||
fetch(api, {
|
||||
cache: "no-cache",
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.status === 200 || res.status === 301) {
|
||||
window.location.replace(api);
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
Loading…
Reference in New Issue