now connection check actually working
Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
parent
57e2e6a9f3
commit
ec43674695
1 changed files with 2 additions and 3 deletions
|
@ -269,8 +269,7 @@ async function testHostConnection() {
|
||||||
try {
|
try {
|
||||||
// Check if API is available
|
// Check if API is available
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
document.getElementById("host").value + "/sdapi/v1/options",
|
document.getElementById("host").value + "/sdapi/v1/options"
|
||||||
{method: "OPTIONS"}
|
|
||||||
);
|
);
|
||||||
switch (response.status) {
|
switch (response.status) {
|
||||||
case 200: {
|
case 200: {
|
||||||
|
@ -295,7 +294,7 @@ async function testHostConnection() {
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
setConnectionStatus("offline");
|
setConnectionStatus("offline");
|
||||||
const message = `The host is online, but the API seems to be disabled. Have you run the webui with the flag --api?`;
|
const message = `The connection with the host returned an error: ${response.status} - ${response.statusText}`;
|
||||||
console.error(message);
|
console.error(message);
|
||||||
if (notify) alert(message);
|
if (notify) alert(message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue