Various Improvements

Meant to fix some behavures and create some improvements
This commit is contained in:
MathMan05 2024-06-08 07:55:51 -05:00
parent 88b60e95bc
commit 8543415a94
4 changed files with 8 additions and 10 deletions

View file

@ -41,7 +41,7 @@
<img id="userpfp" class="pfp"> <img id="userpfp" class="pfp">
</td> </td>
<td> <td>
<div id="userinfo"> <div>
<p id="username">USERNAME</p> <p id="username">USERNAME</p>
<p id="status">SATUS</p> <p id="status">SATUS</p>
</div> </div>

View file

@ -1,7 +1,5 @@
function getCookie(name) { function getCookie(name) {
const value = `; ${document.cookie}`; return localStorage.getItem(name);
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
} }
async function login(username, password){ async function login(username, password){
const options={ const options={
@ -22,7 +20,7 @@ async function login(username, password){
return response.errors.login._errors[0].message; return response.errors.login._errors[0].message;
console.log("test") console.log("test")
} }
document.cookie = "token="+response.token+"; expires="+new Date(Date.now()+(6.048e+8*2)); localStorage.setItem("token",response.token);
window.location.href = '/channels/@me'; window.location.href = '/channels/@me';
return response.token; return response.token;
}) })
@ -31,7 +29,8 @@ async function login(username, password){
}; };
} }
function gettoken(){ function gettoken(){
const temp=getCookie("token"); let temp=getCookie("token");
temp??=undefined;
if(temp===undefined){ if(temp===undefined){
window.location.href = '/login.html'; window.location.href = '/login.html';
} }

View file

@ -122,7 +122,7 @@ class cmessage{
} }
} }
div.appendChild(attatch) messagedwrap.appendChild(attatch)
} }
// //
}else if(this.type===7){ }else if(this.type===7){

View file

@ -219,8 +219,7 @@ div{
} }
p{ p{
transition: background 0.1s ease-in-out; transition: background 0.1s ease-in-out,color 0.1s ease-in-out;
transition: color 0.1s ease-in-out;
width: 100%; width: 100%;
} }
.username{ .username{
@ -626,4 +625,4 @@ span{
} }
.servernoti{ .servernoti{
position:relative; position:relative;
} }