From 0710685e502fd65246d85fbc3156e662cfacf53e Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Sun, 18 Aug 2024 12:28:29 -0500 Subject: [PATCH] Bug fixes --- .dist/channel.js | 4 +++- .dist/index.js | 4 +++- .dist/login.js | 7 +++++++ webpage/channel.ts | 4 +++- webpage/index.ts | 4 +++- webpage/login.ts | 7 +++++++ 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.dist/channel.js b/.dist/channel.js index 83091e2..8011fe1 100644 --- a/.dist/channel.js +++ b/.dist/channel.js @@ -189,7 +189,9 @@ class Channel { }.bind(this), async function (id) { const message = SnowFlake.getSnowFlakeFromID(id, Message).getObject(); try { - message.deleteDiv(); + if (message) { + message.deleteDiv(); + } } catch (e) { console.error(e); diff --git a/.dist/index.js b/.dist/index.js index 2c36ff7..284441c 100644 --- a/.dist/index.js +++ b/.dist/index.js @@ -85,6 +85,7 @@ function showAccountSwitcher() { } let thisuser; try { + console.log(users.users, users.currentuser); thisuser = new Localuser(users.users[users.currentuser]); thisuser.initwebsocket().then(_ => { thisuser.loaduser(); @@ -94,7 +95,8 @@ try { console.log("done loading"); }); } -catch { +catch (e) { + console.error(e); document.getElementById("load-desc").textContent = "Account unable to start"; thisuser = new Localuser(-1); } diff --git a/.dist/login.js b/.dist/login.js index 1537ed8..969c405 100644 --- a/.dist/login.js +++ b/.dist/login.js @@ -42,6 +42,13 @@ function trimswitcher() { map.set(wellknown, [thing, user]); } } + for (const thing in json.users) { + if (thing[thing.length - 1] === "/") { + const user = json.users[thing]; + delete json.users[thing]; + json.users[thing.slice(0, -1)] = user; + } + } localStorage.setItem("userinfos", JSON.stringify(json)); console.log(json); } diff --git a/webpage/channel.ts b/webpage/channel.ts index 6f1e2d5..74c8d22 100644 --- a/webpage/channel.ts +++ b/webpage/channel.ts @@ -202,7 +202,9 @@ class Channel{ async function(this:Channel,id:string){ const message=SnowFlake.getSnowFlakeFromID(id,Message).getObject(); try{ - message.deleteDiv(); + if(message){ + message.deleteDiv(); + } }catch(e){console.error(e)}finally{} }.bind(this), this.readbottom.bind(this) diff --git a/webpage/index.ts b/webpage/index.ts index e84ca69..4a9501c 100644 --- a/webpage/index.ts +++ b/webpage/index.ts @@ -95,6 +95,7 @@ function showAccountSwitcher(){ } let thisuser:Localuser; try{ + console.log(users.users,users.currentuser) thisuser=new Localuser(users.users[users.currentuser]); thisuser.initwebsocket().then(_=>{ thisuser.loaduser(); @@ -103,7 +104,8 @@ try{ document.getElementById("loading").classList.remove("loading"); console.log("done loading") }); -}catch{ +}catch(e){ + console.error(e); document.getElementById("load-desc").textContent="Account unable to start"; thisuser=new Localuser(-1); } diff --git a/webpage/login.ts b/webpage/login.ts index 0950f25..c16c73a 100644 --- a/webpage/login.ts +++ b/webpage/login.ts @@ -41,6 +41,13 @@ function trimswitcher(){ map.set(wellknown,[thing,user]); } } + for(const thing in json.users){ + if(thing[thing.length-1]==="/"){ + const user=json.users[thing]; + delete json.users[thing]; + json.users[thing.slice(0, -1)]=user; + } + } localStorage.setItem("userinfos",JSON.stringify(json)); console.log(json); }