diff --git a/index.html b/index.html index 2795cd8a8..e7c452045 100644 --- a/index.html +++ b/index.html @@ -30,9 +30,10 @@ + diff --git a/public/fonts/FiraCode-400.woff2 b/public/fonts/FiraCode-400.woff2 new file mode 100644 index 000000000..ed70084f3 Binary files /dev/null and b/public/fonts/FiraCode-400.woff2 differ diff --git a/public/fonts/FiraCode-600.woff2 b/public/fonts/FiraCode-600.woff2 new file mode 100644 index 000000000..ed70084f3 Binary files /dev/null and b/public/fonts/FiraCode-600.woff2 differ diff --git a/public/fonts/JetBrainsMono-400.woff2 b/public/fonts/JetBrainsMono-400.woff2 new file mode 100644 index 000000000..59665942f --- /dev/null +++ b/public/fonts/JetBrainsMono-400.woff2 @@ -0,0 +1,11 @@ + + + + + Error 404 (Not Found)!!1 + + +

404. That’s an error. +

The requested URL /s/jetbrainsmono/v18/tDbY2o-flEEny0FZhsfKu5WU4xD-IQ.woff2 was not found on this server. That’s all we know. diff --git a/public/fonts/JetBrainsMono-600.woff2 b/public/fonts/JetBrainsMono-600.woff2 new file mode 100644 index 000000000..59665942f --- /dev/null +++ b/public/fonts/JetBrainsMono-600.woff2 @@ -0,0 +1,11 @@ + + + + + Error 404 (Not Found)!!1 + + +

404. That’s an error. +

The requested URL /s/jetbrainsmono/v18/tDbY2o-flEEny0FZhsfKu5WU4xD-IQ.woff2 was not found on this server. That’s all we know. diff --git a/public/fonts/JetBrainsMono-700.woff2 b/public/fonts/JetBrainsMono-700.woff2 new file mode 100644 index 000000000..59665942f --- /dev/null +++ b/public/fonts/JetBrainsMono-700.woff2 @@ -0,0 +1,11 @@ + + + + + Error 404 (Not Found)!!1 + + +

404. That’s an error. +

The requested URL /s/jetbrainsmono/v18/tDbY2o-flEEny0FZhsfKu5WU4xD-IQ.woff2 was not found on this server. That’s all we know. diff --git a/public/fonts/JetBrainsMono-italic-400.woff2 b/public/fonts/JetBrainsMono-italic-400.woff2 new file mode 100644 index 000000000..3d3c5d77e Binary files /dev/null and b/public/fonts/JetBrainsMono-italic-400.woff2 differ diff --git a/public/fonts/JetBrainsMono-normal-400.woff2 b/public/fonts/JetBrainsMono-normal-400.woff2 new file mode 100644 index 000000000..4d09cda4a Binary files /dev/null and b/public/fonts/JetBrainsMono-normal-400.woff2 differ diff --git a/public/fonts/JetBrainsMono-normal-700.woff2 b/public/fonts/JetBrainsMono-normal-700.woff2 new file mode 100644 index 000000000..4d09cda4a Binary files /dev/null and b/public/fonts/JetBrainsMono-normal-700.woff2 differ diff --git a/public/fonts/custom-fonts.css b/public/fonts/custom-fonts.css new file mode 100644 index 000000000..a3fa6896f --- /dev/null +++ b/public/fonts/custom-fonts.css @@ -0,0 +1,41 @@ +/* Self-hosted fonts — avoids tracking prevention in desktop WebView2 */ +@font-face { + font-family: 'JetBrains Mono'; + font-style: italic; + font-weight: 400; + font-display: swap; + src: url('/fonts/JetBrainsMono-italic-400.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url('/fonts/JetBrainsMono-normal-400.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} +@font-face { + font-family: 'JetBrains Mono'; + font-style: normal; + font-weight: 700; + font-display: swap; + src: url('/fonts/JetBrainsMono-normal-700.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} +@font-face { + font-family: 'Fira Code'; + font-style: normal; + font-weight: 400; + font-display: swap; + src: url('/fonts/FiraCode-400.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} +@font-face { + font-family: 'Fira Code'; + font-style: normal; + font-weight: 600; + font-display: swap; + src: url('/fonts/FiraCode-600.woff2') format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} diff --git a/src/app/hooks/useUserPresence.ts b/src/app/hooks/useUserPresence.ts index a4535d34f..d47063b4d 100644 --- a/src/app/hooks/useUserPresence.ts +++ b/src/app/hooks/useUserPresence.ts @@ -29,20 +29,24 @@ export const useUserPresence = (userId: string): UserPresence | undefined => { const [presence, setPresence] = useState(() => (user ? getUserPresence(user) : undefined)); useEffect(() => { + // Subscribe on mx (MatrixClient) rather than on individual User objects. + // User objects have a default 10-listener limit; the same user can appear + // in many components simultaneously (avatars, member list, etc.) and + // per-user subscription causes MaxListenersExceededWarning at 11+. const updatePresence: UserEventHandlerMap[UserEvent.Presence] = (event, u) => { if (u.userId === user?.userId) { - setPresence(getUserPresence(user)); + setPresence(getUserPresence(u)); } }; - user?.on(UserEvent.Presence, updatePresence); - user?.on(UserEvent.CurrentlyActive, updatePresence); - user?.on(UserEvent.LastPresenceTs, updatePresence); + mx.on(UserEvent.Presence, updatePresence); + mx.on(UserEvent.CurrentlyActive, updatePresence); + mx.on(UserEvent.LastPresenceTs, updatePresence); return () => { - user?.removeListener(UserEvent.Presence, updatePresence); - user?.removeListener(UserEvent.CurrentlyActive, updatePresence); - user?.removeListener(UserEvent.LastPresenceTs, updatePresence); + mx.removeListener(UserEvent.Presence, updatePresence); + mx.removeListener(UserEvent.CurrentlyActive, updatePresence); + mx.removeListener(UserEvent.LastPresenceTs, updatePresence); }; - }, [user]); + }, [mx, user]); return presence; };