Compatibility tweaks
All checks were successful
Android Build / publish (push) Successful in 46s
Linux Build / publish (push) Successful in 56s

- Fix (i hope all) electron issues
- Add complete blah support
- Add userscript
This commit is contained in:
olcxja 2026-05-11 19:22:30 +02:00
commit 7ff648ba3a
19 changed files with 478 additions and 576 deletions

View file

@ -264,11 +264,10 @@
</div>
</div>
</body>
</html>
<script src="../main.js"></script>
<script>
document.getElementById("reg-host").value = window.location.hostname;
document.getElementById("login-host").value = window.location.hostname;
const container = document.getElementById('auth-container');
@ -311,13 +310,12 @@
formLogin.addEventListener('submit', async (e) => {
e.preventDefault();
try {
url = `${window.location.protocol}//${loginHost.value}/_larpix`;
let res = await Auth(loginUsername.value, loginPassword.value);
if (res.startsWith("success:"))
{
showNotification(res, "success", 3500);
showBlahNotification(res);
await delay(1000);
localStorage.setItem("username", loginUsername.value);
localStorage.setItem("password", loginPassword.value);
@ -327,12 +325,12 @@
}
else
{
showNotification(res, "error", 3500);
showBlahNotification(res);
}
} catch (error) {
console.log(error);
showNotification("Something went wrong... (probably wrong password)", "error", 3500);
showBlahNotification("error:something.wrong.mayb.pass");
container.className = 'auth-container';
}
});
@ -342,21 +340,21 @@
try {
captchaCode.value = "";
regKeyInput.value = "";
url = `${window.location.protocol}//${registerHost.value}/_larpix`;
if (!registerUsername.value || registerUsername.value.trim() === '') {
showNotification("Username cannot be empty", "error");
showBlahNotification("error:username.cant.empty");
container.className = 'auth-container show-register';
return;
}
if (!registerPassword.value || registerPassword.value.trim() === '') {
showNotification("Password cannot be empty", "error");
showBlahNotification("error:password.cant.empty");
container.className = 'auth-container show-register';
return;
}
if (registerPassword.value != registerPasswordConfirm.value) {
showNotification("Passwords do not match", "error");
showBlahNotification("error:passwords.not.match");
container.className = 'auth-container show-register';
return;
}
@ -388,13 +386,13 @@
if (res.length > 64 || res.length <= 1) {
throw new Error();
}
showNotification(res, "error", 3500);
showBlahNotification(res);
container.className = 'auth-container show-register';
}
} catch (error) {
console.log(error);
showNotification("Something went wrong...", "error", 3500);
showBlahNotification("error:something.wrong");
container.className = 'auth-container show-register';
}
});
@ -414,11 +412,8 @@
if (res.length > 64 || res.length <= 1) {
throw new Error();
}
if (res.startsWith("error")) {
showNotification(res, "error", 3500);
container.className = 'auth-container show-register';
} else if (res.startsWith("success")) {
showNotification(res, "success", 3500);
if (res.startsWith("success")) {
showBlahNotification(res);
await delay(1000);
localStorage.setItem("username", registerUsername.value);
localStorage.setItem("password", registerPassword.value);
@ -426,16 +421,13 @@
window.location.href = "../";
} else if (res.startsWith("info")) {
showNotification(res, "info", 3500);
container.className = 'auth-container show-register';
} else {
showNotification(res, "info", 3500);
showBlahNotification(res);
container.className = 'auth-container show-register';
}
}
} catch (error) {
showNotification("Something went wrong...", "error", 3500);
showBlahNotification("error:something.wrong");
container.className = 'auth-container show-register';
}
});
@ -453,6 +445,7 @@
async function updateLoginForm(host)
{
try {
await updateProtocolAndUrl(host);
let serverInfo = await getServerInfo(host);
if (serverInfo["registration"] == "disabled")
{
@ -487,5 +480,4 @@
loginHostChanged();
</script>
</body>
</html>
<script src="../userscript.js"></script>