fix login/register page stuff
This commit is contained in:
@@ -84,8 +84,6 @@ if (instancein) {
|
|||||||
} else {
|
} else {
|
||||||
(instancein as HTMLInputElement).value = json.wellknown;
|
(instancein as HTMLInputElement).value = json.wellknown;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
checkInstance("https://spacebar.chat/");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +222,7 @@ if (switchurl) {
|
|||||||
console.log(instance);
|
console.log(instance);
|
||||||
if (instance) {
|
if (instance) {
|
||||||
instancein.value = instance;
|
instancein.value = instance;
|
||||||
checkInstance("");
|
//checkInstance("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trimswitcher();
|
trimswitcher();
|
||||||
|
@@ -206,7 +206,9 @@ const instancefetch = fetch("/instances.json")
|
|||||||
}
|
}
|
||||||
datalist.append(option);
|
datalist.append(option);
|
||||||
}
|
}
|
||||||
checkInstance("");
|
if (json.length !== 0 && !localStorage.getItem("instanceinfo")) {
|
||||||
|
checkInstance(json[0].name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -332,7 +334,11 @@ export async function getapiurls(str: string): Promise<
|
|||||||
export async function checkInstance(instance: string) {
|
export async function checkInstance(instance: string) {
|
||||||
await instancefetch;
|
await instancefetch;
|
||||||
const verify = document.getElementById("verify");
|
const verify = document.getElementById("verify");
|
||||||
|
const loginButton = (document.getElementById("loginButton") ||
|
||||||
|
document.getElementById("createAccount") ||
|
||||||
|
document.createElement("button")) as HTMLButtonElement;
|
||||||
try {
|
try {
|
||||||
|
loginButton.disabled = true;
|
||||||
verify!.textContent = I18n.getTranslation("login.checking");
|
verify!.textContent = I18n.getTranslation("login.checking");
|
||||||
const instanceValue = instance;
|
const instanceValue = instance;
|
||||||
const instanceinfo = (await getapiurls(instanceValue)) as {
|
const instanceinfo = (await getapiurls(instanceValue)) as {
|
||||||
@@ -347,6 +353,7 @@ export async function checkInstance(instance: string) {
|
|||||||
instanceinfo.value = instanceValue;
|
instanceinfo.value = instanceValue;
|
||||||
localStorage.setItem("instanceinfo", JSON.stringify(instanceinfo));
|
localStorage.setItem("instanceinfo", JSON.stringify(instanceinfo));
|
||||||
verify!.textContent = I18n.getTranslation("login.allGood");
|
verify!.textContent = I18n.getTranslation("login.allGood");
|
||||||
|
loginButton.disabled = false;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (checkInstance.alt) {
|
if (checkInstance.alt) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -358,10 +365,12 @@ export async function checkInstance(instance: string) {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
} else {
|
} else {
|
||||||
verify!.textContent = I18n.getTranslation("login.invalid");
|
verify!.textContent = I18n.getTranslation("login.invalid");
|
||||||
|
loginButton.disabled = true;
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
console.log("catch");
|
console.log("catch");
|
||||||
verify!.textContent = I18n.getTranslation("login.invalid");
|
verify!.textContent = I18n.getTranslation("login.invalid");
|
||||||
|
loginButton.disabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function getInstances() {
|
export function getInstances() {
|
||||||
|
Reference in New Issue
Block a user