More supported attatchment types and cancel uploads

This commit is contained in:
MathMan05 2024-06-28 19:15:10 -05:00
parent 039491ca87
commit a05c74bb3c
13 changed files with 416 additions and 103 deletions

View file

@ -72,7 +72,9 @@ class Localuser{
}
for(const thing of ready.d.read_state.entries){
const guild=this.resolveChannelFromID(thing.id).guild;
const channel=this.resolveChannelFromID(thing.id);
if(!channel){continue;}
const guild=channel.guild;
if(guild===undefined){
continue
}
@ -246,9 +248,11 @@ class Localuser{
return;
}
resolveChannelFromID(ID:string):Channel{
let resolve=this.guilds.find(guild => guild.channelids[ID]).channelids[ID];
resolve??=undefined;
return resolve;
let resolve=this.guilds.find(guild => guild.channelids[ID]);
if(resolve){
return resolve.channelids[ID];
}
return undefined;
}
updateChannel(JSON):void{
this.guildids[JSON.guild_id].updateChannel(JSON);
@ -273,12 +277,13 @@ class Localuser{
}
init():void{
const location=window.location.href.split("/");
this.buildservers();
if(location[3]==="channels"){
const guild=this.loadGuild(location[4]);
guild.loadChannel(location[5]);
this.channelfocus=guild.channelids[location[5]];
}
this.buildservers();
}
loaduser():void{
document.getElementById("username").textContent=this.user.username;
@ -293,6 +298,12 @@ class Localuser{
if(!guild){
guild=this.guildids["@me"];
}
if(this.lookingguild){
this.lookingguild.html.classList.remove("serveropen");
}
if(guild.html){
guild.html.classList.add("serveropen")
}
this.lookingguild=guild;
document.getElementById("serverName").textContent=guild.properties.name;
//console.log(this.guildids,id)
@ -302,12 +313,20 @@ class Localuser{
}
buildservers():void{
const serverlist=document.getElementById("servers");//
const outdiv=document.createElement("div");
const div=document.createElement("div");
div.textContent="⌂";
div.classList.add("home","servericon")
div["all"]=this.guildids["@me"];
serverlist.appendChild(div)
this.guildids["@me"].html=outdiv;
const unread=document.createElement("div");
unread.classList.add("unread");
outdiv.append(unread);
outdiv.appendChild(div);
outdiv.classList.add("servernoti")
serverlist.append(outdiv);
div.onclick=function(){
this["all"].loadGuild();
this["all"].loadChannel();