Add working DM invites
This commit is contained in:
parent
0dcebcb9fc
commit
588d55abf8
7 changed files with 147 additions and 47 deletions
|
|
@ -92,23 +92,7 @@
|
||||||
gap: 1.1rem;
|
gap: 1.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-group {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group label {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
font-weight: 800;
|
|
||||||
margin-left: 0.6rem;
|
|
||||||
margin-bottom: -0.2rem;
|
|
||||||
opacity: 0.4;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.05rem;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -127,9 +111,7 @@
|
||||||
font-size: 1.05rem;
|
font-size: 1.05rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:hover {
|
|
||||||
background-color: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-links {
|
.footer-links {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
@ -160,6 +142,14 @@
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -435,6 +435,16 @@ addDmBtn.addEventListener("click", () => {
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-160v-600q0-33 23.5-56.5T200-840h480q33 0 56.5 23.5T760-760v203q-10-2-20-2.5t-20-.5q-10 0-20 .5t-20 2.5v-203H200v400h283q-2 10-2.5 20t-.5 20q0 10 .5 20t2.5 20H240L120-160Zm160-440h320v-80H280v80Zm0 160h200v-80H280v80Zm400 280v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-360v-400 400Z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-160v-600q0-33 23.5-56.5T200-840h480q33 0 56.5 23.5T760-760v203q-10-2-20-2.5t-20-.5q-10 0-20 .5t-20 2.5v-203H200v400h283q-2 10-2.5 20t-.5 20q0 10 .5 20t2.5 20H240L120-160Zm160-440h320v-80H280v80Zm0 160h200v-80H280v80Zm400 280v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-360v-400 400Z"/></svg>
|
||||||
<herotitle>Add Chat</herotitle>
|
<herotitle>Add Chat</herotitle>
|
||||||
<p>Add a private, encrypted chat by entering a username</p>
|
<p>Add a private, encrypted chat by entering a username</p>
|
||||||
|
<br>
|
||||||
|
<div class="input-group">
|
||||||
|
<label for="addchat-username">Username</label>
|
||||||
|
<input type="text" id="addchat-username" placeholder="@username:serverhost" class="forminput">
|
||||||
|
</div>
|
||||||
|
<div class="input-group">
|
||||||
|
<button class="submit-button">
|
||||||
|
Add chat
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -297,4 +297,42 @@ fullcontainer {
|
||||||
herotitle {
|
herotitle {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
|
||||||
|
width: 80%;
|
||||||
|
max-width: 30rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group label {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-left: 0.6rem;
|
||||||
|
margin-bottom: -0.2rem;
|
||||||
|
opacity: 0.4;
|
||||||
|
|
||||||
|
letter-spacing: 0.05rem;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.submit-button {
|
||||||
|
justify-content: center;
|
||||||
|
background-color: var(--text-color);
|
||||||
|
color: var(--main-bg-color);
|
||||||
|
font-weight: 800;
|
||||||
|
border: none;
|
||||||
|
font-size: 1.05rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-button:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
}
|
}
|
||||||
|
|
@ -84,14 +84,14 @@
|
||||||
Splash
|
Splash
|
||||||
</roomtopbar>
|
</roomtopbar>
|
||||||
<roomcontent2>
|
<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">
|
<img src="favicon.svg" style="width: 6rem">
|
||||||
<herotitle>Welcome to Miarven</herotitle>
|
<herotitle>Welcome to Miarven</herotitle>
|
||||||
<p>First Larpix client. <span class="aqua">v<span class="clientver aqua">1.0</span></span></p>
|
<p>First Larpix client. <span class="aqua">v<span class="clientver aqua">1.0</span></span></p>
|
||||||
</div>
|
</div>
|
||||||
</roomcontent2>
|
</roomcontent2>
|
||||||
</roomcontent>
|
</roomcontent>
|
||||||
<sidebar class="second hidden" id="roomdetailsbar" style="display: none;">
|
<sidebar class="second" id="roomdetailsbar" style="display: none;">
|
||||||
</sidebar>
|
</sidebar>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
@ -105,7 +105,7 @@
|
||||||
showAction("Authenticating...", "startauth");
|
showAction("Authenticating...", "startauth");
|
||||||
let res = await Auth(username, password);
|
let res = await Auth(username, password);
|
||||||
clearAction("startauth");
|
clearAction("startauth");
|
||||||
if (res == "Login successful") {
|
if (res.startsWith("success:")) {
|
||||||
await refreshDms();
|
await refreshDms();
|
||||||
} else {
|
} else {
|
||||||
showNotification("Failed to auth. Redirecting to login...", "error", 3500);
|
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();
|
start();
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -92,23 +92,7 @@
|
||||||
gap: 1.1rem;
|
gap: 1.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-group {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group label {
|
|
||||||
font-size: 0.75rem;
|
|
||||||
font-weight: 800;
|
|
||||||
margin-left: 0.6rem;
|
|
||||||
margin-bottom: -0.2rem;
|
|
||||||
opacity: 0.4;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.05rem;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -127,9 +111,7 @@
|
||||||
font-size: 1.05rem;
|
font-size: 1.05rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:hover {
|
|
||||||
background-color: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-links {
|
.footer-links {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
@ -160,6 +142,14 @@
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
@ -325,7 +315,7 @@
|
||||||
|
|
||||||
let res = await Auth(loginUsername.value, loginPassword.value);
|
let res = await Auth(loginUsername.value, loginPassword.value);
|
||||||
|
|
||||||
if (res == "Login successful")
|
if (res.startsWith("success:"))
|
||||||
{
|
{
|
||||||
showNotification(res, "success", 3500);
|
showNotification(res, "success", 3500);
|
||||||
await delay(1000);
|
await delay(1000);
|
||||||
|
|
@ -424,10 +414,10 @@
|
||||||
if (res.length > 64 || res.length <= 1) {
|
if (res.length > 64 || res.length <= 1) {
|
||||||
throw new Error();
|
throw new Error();
|
||||||
}
|
}
|
||||||
if (res.toLowerCase().includes("incorrect")) {
|
if (res.startsWith("error")) {
|
||||||
showNotification(res, "error", 3500);
|
showNotification(res, "error", 3500);
|
||||||
container.className = 'auth-container show-register';
|
container.className = 'auth-container show-register';
|
||||||
} else if (res.toLowerCase().includes("created")) {
|
} else if (res.startsWith("success")) {
|
||||||
showNotification(res, "success", 3500);
|
showNotification(res, "success", 3500);
|
||||||
await delay(1000);
|
await delay(1000);
|
||||||
localStorage.setItem("username", registerUsername.value);
|
localStorage.setItem("username", registerUsername.value);
|
||||||
|
|
@ -436,6 +426,9 @@
|
||||||
|
|
||||||
window.location.href = "../";
|
window.location.href = "../";
|
||||||
|
|
||||||
|
} else if (res.startsWith("info")) {
|
||||||
|
showNotification(res, "info", 3500);
|
||||||
|
container.className = 'auth-container show-register';
|
||||||
} else {
|
} else {
|
||||||
showNotification(res, "info", 3500);
|
showNotification(res, "info", 3500);
|
||||||
container.className = 'auth-container show-register';
|
container.className = 'auth-container show-register';
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ const roomContentBar = roomContent.children[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function delay(time) {
|
function delay(time) {
|
||||||
return new Promise(resolve => setTimeout(resolve, time));
|
return new Promise(resolve => setTimeout(resolve, time));
|
||||||
}
|
}
|
||||||
|
|
@ -431,10 +432,20 @@ collapseGroupsBtn.addEventListener("click", () => {
|
||||||
addDmBtn.addEventListener("click", () => {
|
addDmBtn.addEventListener("click", () => {
|
||||||
roomContentMain.innerHTML =
|
roomContentMain.innerHTML =
|
||||||
`
|
`
|
||||||
<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;">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-160v-600q0-33 23.5-56.5T200-840h480q33 0 56.5 23.5T760-760v203q-10-2-20-2.5t-20-.5q-10 0-20 .5t-20 2.5v-203H200v400h283q-2 10-2.5 20t-.5 20q0 10 .5 20t2.5 20H240L120-160Zm160-440h320v-80H280v80Zm0 160h200v-80H280v80Zm400 280v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-360v-400 400Z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" width="3rem" viewBox="0 -960 960 960" fill="var(--text-color)"><path d="M120-160v-600q0-33 23.5-56.5T200-840h480q33 0 56.5 23.5T760-760v203q-10-2-20-2.5t-20-.5q-10 0-20 .5t-20 2.5v-203H200v400h283q-2 10-2.5 20t-.5 20q0 10 .5 20t2.5 20H240L120-160Zm160-440h320v-80H280v80Zm0 160h200v-80H280v80Zm400 280v-120H560v-80h120v-120h80v120h120v80H760v120h-80ZM200-360v-400 400Z"/></svg>
|
||||||
<herotitle>Add Chat</herotitle>
|
<herotitle>Add Chat</herotitle>
|
||||||
<p>Add a private, encrypted chat by entering a username</p>
|
<p>Add a private, encrypted chat by entering a username</p>
|
||||||
|
<br>
|
||||||
|
<div class="input-group">
|
||||||
|
<label for="addchat-username">Username</label>
|
||||||
|
<input type="text" id="addchat-username" placeholder="@username:serverhost" class="forminput">
|
||||||
|
</div>
|
||||||
|
<div class="input-group">
|
||||||
|
<button class="submit-button" onclick="addDm()">
|
||||||
|
Add chat
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -297,4 +297,43 @@ fullcontainer {
|
||||||
herotitle {
|
herotitle {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
text-align: left;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
|
||||||
|
width: 90%;
|
||||||
|
max-width: 30rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group label {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-left: 0.6rem;
|
||||||
|
margin-bottom: -0.2rem;
|
||||||
|
opacity: 0.4;
|
||||||
|
|
||||||
|
letter-spacing: 0.05rem;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.submit-button {
|
||||||
|
justify-content: center;
|
||||||
|
background-color: var(--text-color);
|
||||||
|
color: var(--main-bg-color);
|
||||||
|
font-weight: 800;
|
||||||
|
border: none;
|
||||||
|
font-size: 1.05rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit-button:hover {
|
||||||
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue