Add check endpoint and remove USE_CORS flag
This commit is contained in:
parent
a283c35a20
commit
589df19c14
|
@ -353,6 +353,14 @@ def loading():
|
|||
)
|
||||
|
||||
|
||||
@app.route("/check", methods=["GET"])
|
||||
def check():
|
||||
if "Origin" not in request.headers:
|
||||
return Response(status=403)
|
||||
|
||||
return Response(status=200, headers={"Access-Control-Allow-Origin": "*"})
|
||||
|
||||
|
||||
@app.route("/setup", methods=["GET", "POST"])
|
||||
def setup():
|
||||
if app.config["USER"]:
|
||||
|
@ -427,7 +435,6 @@ 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"],
|
||||
|
|
|
@ -1699,15 +1699,19 @@
|
|||
})
|
||||
.then((res) => {
|
||||
if (res.status === 200) {
|
||||
setTimeout(() => {
|
||||
window.open(`${api}/login`, "_self");
|
||||
}, 60000);
|
||||
setInterval(() => {
|
||||
fetch(api, {
|
||||
fetch(`${api}/check`, {
|
||||
cache: "no-cache",
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.status === 200 || res.status === 301) {
|
||||
window.location.replace(api);
|
||||
if (res.status === 200) {
|
||||
window.open(`${api}/login`, "_self");
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {});
|
||||
}, 5000);
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue