Add working DM invites

This commit is contained in:
olcxja 2026-05-10 20:55:45 +02:00
commit 588d55abf8
7 changed files with 147 additions and 47 deletions

View file

@ -84,14 +84,14 @@
Splash
</roomtopbar>
<roomcontent2>
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;">
<div style="display: flex;justify-content: center;align-items: center;height:100%;flex-direction: column;text-align: center;">
<img src="favicon.svg" style="width: 6rem">
<herotitle>Welcome to Miarven</herotitle>
<p>First Larpix client. <span class="aqua">v<span class="clientver aqua">1.0</span></span></p>
</div>
</roomcontent2>
</roomcontent>
<sidebar class="second hidden" id="roomdetailsbar" style="display: none;">
<sidebar class="second" id="roomdetailsbar" style="display: none;">
</sidebar>
</body>
@ -105,7 +105,7 @@
showAction("Authenticating...", "startauth");
let res = await Auth(username, password);
clearAction("startauth");
if (res == "Login successful") {
if (res.startsWith("success:")) {
await refreshDms();
} else {
showNotification("Failed to auth. Redirecting to login...", "error", 3500);
@ -135,5 +135,24 @@
}
}
async function addDm() {
try {
showAction("Adding...", "dmadd");
let res = await fetchEncrypted("user/dm/invite", document.getElementById("addchat-username").value);
console.log(res);
let ressplit = res.split(":");
clearAction("dmadd");
showNotification(ressplit[1], ressplit[0], 3500);
}
catch (e) {
console.log(e);
clearAction("dmadd");
showNotification("Failed to add chat", "error", 3500);
}
}
start();
</script>