From d7c1b3ee021e16f27e982b8e6e7c8f4988a1c6b4 Mon Sep 17 00:00:00 2001 From: Cknight70 Date: Sun, 5 Nov 2023 20:18:02 -0700 Subject: [PATCH 1/4] Update Version number --- recipes/discord/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/discord/package.json b/recipes/discord/package.json index 4371c3c9e..d169ab963 100644 --- a/recipes/discord/package.json +++ b/recipes/discord/package.json @@ -1,7 +1,7 @@ { "id": "discord", "name": "Discord", - "version": "1.8.1", + "version": "1.8.2", "license": "MIT", "config": { "serviceURL": "https://discord.com/login", From 061ee70bfc7155eca6d29f14d17dc5fb784dfab2 Mon Sep 17 00:00:00 2001 From: Cknight70 Date: Sun, 5 Nov 2023 20:27:47 -0700 Subject: [PATCH 2/4] Fix for discord notification Fixes unread counts, as well as for all unreads --- recipes/discord/webview.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index 052ddac32..078614709 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js @@ -8,16 +8,14 @@ module.exports = (Ferdium, settings) => { const getMessages = () => { let directCount = 0; const directCountPerServer = document.querySelectorAll( - '[class*="lowerBadge-"] [class*="numberBadge-"]', + '[class*="lowerBadge_"] [class*="numberBadge_"]', ); for (const directCountBadge of directCountPerServer) { directCount += Ferdium.safeParseInt(directCountBadge.textContent); } - const indirectCountPerServer = document.querySelectorAll( - '[class*="modeUnread-"]', - ).length; + const indirectCountPerServer = document.title.search("•") != -1 ? 1 : 0; Ferdium.setBadge(directCount, indirectCountPerServer); }; From 6aa4ce7444b09c19c78d21e1f25bb56f22c777ac Mon Sep 17 00:00:00 2001 From: Cknight70 Date: Thu, 9 Nov 2023 21:14:27 -0700 Subject: [PATCH 3/4] Better all unread checker --- recipes/discord/webview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index 078614709..ad538aefb 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js @@ -15,7 +15,7 @@ module.exports = (Ferdium, settings) => { directCount += Ferdium.safeParseInt(directCountBadge.textContent); } - const indirectCountPerServer = document.title.search("•") != -1 ? 1 : 0; + const indirectCountPerServer = document.title.search("• Discord") != -1 ? 1 : 0; Ferdium.setBadge(directCount, indirectCountPerServer); }; From 94e321268663dd43662f579c2882d55afb3d6513 Mon Sep 17 00:00:00 2001 From: Cknight70 Date: Thu, 9 Nov 2023 22:21:40 -0700 Subject: [PATCH 4/4] strict equality checking is better --- recipes/discord/webview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/discord/webview.js b/recipes/discord/webview.js index ad538aefb..938b3a1bb 100644 --- a/recipes/discord/webview.js +++ b/recipes/discord/webview.js @@ -15,7 +15,7 @@ module.exports = (Ferdium, settings) => { directCount += Ferdium.safeParseInt(directCountBadge.textContent); } - const indirectCountPerServer = document.title.search("• Discord") != -1 ? 1 : 0; + const indirectCountPerServer = document.title.search('• Discord') === -1 ? 0 : 1; Ferdium.setBadge(directCount, indirectCountPerServer); };