From 4a8bc7b6404100353ee5ea44178287c7f70f2e17 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Mon, 2 Mar 2026 11:26:20 -0600 Subject: [PATCH] no pings in hidden channels --- src/webpage/guild.ts | 2 +- src/webpage/localuser.ts | 9 ++++++--- src/webpage/user.ts | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/webpage/guild.ts b/src/webpage/guild.ts index 2914cd1..748de40 100644 --- a/src/webpage/guild.ts +++ b/src/webpage/guild.ts @@ -1659,7 +1659,7 @@ class Guild extends SnowFlake { get mentions() { let mentions = 0; for (const thing of this.channels) { - mentions += thing.mentions; + if (thing.visible) mentions += thing.mentions; } return mentions; } diff --git a/src/webpage/localuser.ts b/src/webpage/localuser.ts index d27d2d8..83a1def 100644 --- a/src/webpage/localuser.ts +++ b/src/webpage/localuser.ts @@ -425,8 +425,6 @@ class Localuser { } this.pingEndpoint(); - - this.generateFavicon(); } inrelation = new Set(); outoffocus(): void { @@ -537,7 +535,11 @@ class Localuser { console.log("in here?"); returny(); } - } catch {} + } catch (e) { + if (!(e instanceof SyntaxError)) { + console.error(e); + } + } } })(); } @@ -1557,6 +1559,7 @@ class Localuser { async init() { const location = window.location.href.split("/"); this.buildservers(); + this.generateFavicon(); if (location[3] === "channels") { const guild = this.loadGuild(location[4]); if (!guild) { diff --git a/src/webpage/user.ts b/src/webpage/user.ts index 4fe952f..e3d38d0 100644 --- a/src/webpage/user.ts +++ b/src/webpage/user.ts @@ -932,6 +932,26 @@ class User extends SnowFlake { } static async resolve(id: string, localuser: Localuser): Promise { + const time = SnowFlake.stringToUnixTime(id); + + if (time < 1420070400000 + 100) + return new User( + { + id: "0", + public_flags: 0, + username: I18n.friends.notfound(), + avatar: null, + discriminator: "0000", + bio: "", + bot: false, + premium_type: 0, + premium_since: "", + accent_color: 0, + theme_colors: null, + badge_ids: [], + }, + localuser, + ); let user: User | undefined; if ((user = localuser.userMap.get(id))) return user; const json = await fetch(localuser.info.api.toString() + "/users/" + id + "/profile", {