diff --git a/src/ui/main.py b/src/ui/main.py index 101e10b0a..87da9476d 100755 --- a/src/ui/main.py +++ b/src/ui/main.py @@ -446,7 +446,7 @@ def check(): if "Origin" not in request.headers: return Response(status=403) - return Response(status=200, headers={"Access-Control-Allow-Origin": "*"}) + return Response(status=200, headers={"Access-Control-Allow-Origin": "*"}, response=dumps({"message": "ok"}), content_type="application/json") @app.route("/setup", methods=["GET", "POST"]) diff --git a/src/ui/templates/setup.html b/src/ui/templates/setup.html index f7c87af40..fd4ff1872 100644 --- a/src/ui/templates/setup.html +++ b/src/ui/templates/setup.html @@ -348,7 +348,19 @@ }://${this.servInp.value}/setup/check`; fetch(api) .then((res) => { - this.updateCheck("success"); + // check if status 200 and body = {"message" : "ok"} + if (res.status === 200) { + return res.json(); + } else { + this.updateCheck("error"); + } + }).then(res => { + // check message + if (res.message === "ok") { + this.updateCheck("success"); + } else { + this.updateCheck("error"); + } }) .catch((err) => { this.updateCheck("error");