WebPWA: Fix duplicate notification count inside icon (#4571)

This commit is contained in:
Cas_ 2026-09-01 22:48:09 +02:00 • committed by GitHub
parent 3212fb62f0
commit c007dbe5dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 6 deletions

View file

@ -18,7 +18,6 @@
// DO NOT REMOVE UNLESS YOU WISH TO FACE THE WRATH OF THE CIRCULAR DEPENDENCY DEMON!!!!!!!
import "~plugins";
import "./fixWeirdAppRegionBug.css";
export * as Api from "./api";
export * as Plugins from "./api/PluginManager";

View file

@ -1,4 +0,0 @@
/* Works around a very strange issue where *something* (electron?) will inject body { app-region: drag } when using online themes */
body {
app-region: no-drag;
}

View file

@ -26,6 +26,8 @@ function colorToHex(color: string) {
return "#" + [...ctx.getImageData(0, 0, 1, 1).data.slice(0, 3)].map(n => n.toString(16).padStart(2, "0")).join("");
}
const icon = "https://discord.com/assets/favicon.ico";
let linkEl: HTMLLinkElement | undefined;
async function setManifest() {
// need to wait for CSS changes to flush
@ -38,7 +40,6 @@ async function setManifest() {
const endpoint = "https:" + window.GLOBAL_ENV.WEBAPP_ENDPOINT;
const appUrl = endpoint + "/app"; // URL when PWA launches
const icon = document.querySelector<HTMLLinkElement>('link[rel="icon"]')!.href;
const styles = getComputedStyle(document.body);
const manifest = {
id: appUrl,
@ -122,6 +123,7 @@ export default definePlugin({
NotificationSettingsStore.addChangeListener(this.setBadge);
GuildReadStateStore.addChangeListener(this.setBadge);
RelationshipStore.addChangeListener(this.setBadge);
this.setBadge();
if (!IS_USERSCRIPT) {
// keybinds