From 00f8924030e38792608ed50660366b33dc681162 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 4 Dec 2023 19:07:26 -0800 Subject: [PATCH] fix: :bug: service worker notification badges --- .../assets/notification-badges/boost.png | Bin 0 -> 1902 bytes ...rd-check-solid.png => clipboard-check.png} | Bin .../{id-card-alt.png => id-card.png} | Bin .../{poll-h.png => poll.png} | Bin .../{quote-right.png => quote.png} | Bin .../assets/notification-badges/reaction.png | Bin 0 -> 2418 bytes .../assets/notification-badges/retweet.png | Bin 798 -> 0 bytes packages/firefish-js/src/entities.ts | 6 +++++ .../sw/src/scripts/create-notification.ts | 21 +++++++++--------- packages/sw/src/types.ts | 18 ++++++++------- 10 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 packages/backend/assets/notification-badges/boost.png rename packages/backend/assets/notification-badges/{clipboard-check-solid.png => clipboard-check.png} (100%) rename packages/backend/assets/notification-badges/{id-card-alt.png => id-card.png} (100%) rename packages/backend/assets/notification-badges/{poll-h.png => poll.png} (100%) rename packages/backend/assets/notification-badges/{quote-right.png => quote.png} (100%) create mode 100644 packages/backend/assets/notification-badges/reaction.png delete mode 100644 packages/backend/assets/notification-badges/retweet.png diff --git a/packages/backend/assets/notification-badges/boost.png b/packages/backend/assets/notification-badges/boost.png new file mode 100644 index 0000000000000000000000000000000000000000..ebec4ecd8594ee55d406fb7f09ea982137b5b600 GIT binary patch literal 1902 zcmV-!2a))RP)73b<4NRKTSINCmLJ8GGUw%loY? zpM17=M)Ur7t(CrSwOZ}j_xRB+RS|ex)%tGy(M~{RC)f$t38;)fW%K(A*a@hNKxOm$ z3fKv#j6h}c`wG|zsEok4`7iA9C)N&4>uaCwA8)73U|#_r&;#VJtR1ZZJWY{*OzE|? zpRDnFNVZM@pnq@edBVdZVE$ps-&y0QEL$buTSMqYz{^!Y0smQKC2WlVfIk)R_Ax?U zH8v#Dwn6|Q=Es?VZvkf?cp{;1N^2+JQ=8+@O^jDDDWOLgIx8KmnE<>V@FC&a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1 z13)=Hq`dBI!}lHl7(4Jq!B?Cq1bSCFN`SIqjm7>{wRC6#sknP@%H9hjse7Z~zi(D4 zD{>Zz5})pj53^E>j?$tPihzJap*G0iQ9a_M#$$L<@q*5`c}QqKgGTN`NwP zG8BlKBHk%B;s}cde+~ks0MET_dJyf!T_qJ}A9@iOkZL>7rLP(ZK~Zn=t$(Z$0pM)6 zdZ}o{e#Ca9UspFmz{z^^vJcl_LV>VD%)f{osHbtIyK3M^L(p6VaL^%Cr0PFIAeI_S zRq&$(0Fv^}A&S?bL)DV7MmUKI_o?OZRNvLXj}kySseEyf2PVMd!S|lx$n~jXSp@h| z0?^Nmy-XNS2Xy)I{}pusBC^;0hI~(53h#ZaQ6RG^#A|>07*qoM6N<$g7ABDs{jB1 literal 0 HcmV?d00001 diff --git a/packages/backend/assets/notification-badges/clipboard-check-solid.png b/packages/backend/assets/notification-badges/clipboard-check.png similarity index 100% rename from packages/backend/assets/notification-badges/clipboard-check-solid.png rename to packages/backend/assets/notification-badges/clipboard-check.png diff --git a/packages/backend/assets/notification-badges/id-card-alt.png b/packages/backend/assets/notification-badges/id-card.png similarity index 100% rename from packages/backend/assets/notification-badges/id-card-alt.png rename to packages/backend/assets/notification-badges/id-card.png diff --git a/packages/backend/assets/notification-badges/poll-h.png b/packages/backend/assets/notification-badges/poll.png similarity index 100% rename from packages/backend/assets/notification-badges/poll-h.png rename to packages/backend/assets/notification-badges/poll.png diff --git a/packages/backend/assets/notification-badges/quote-right.png b/packages/backend/assets/notification-badges/quote.png similarity index 100% rename from packages/backend/assets/notification-badges/quote-right.png rename to packages/backend/assets/notification-badges/quote.png diff --git a/packages/backend/assets/notification-badges/reaction.png b/packages/backend/assets/notification-badges/reaction.png new file mode 100644 index 0000000000000000000000000000000000000000..d617a4c5c00a465d58e11a48bdc7903f8aa92029 GIT binary patch literal 2418 zcmV-&361uNP)8UBw%L*b{2nnz)8T)2<$BWkv!lv z!|JUWug*T{%Qo2;I_+oczweB#B>t!b0QS4qK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|i zALNHt4_$I`<6#PC67;)U+k*f$M_7V{BM^~*2mGet<{GPe5s-9&2$CE`=2BC%Wkv`6S zH%s3l?5G4>(-%@8f`+%ymko@5EDfSn2W3j(e3a6PTZjQ{`u07*qoM6N<$f`cGhsQ>@~ literal 0 HcmV?d00001 diff --git a/packages/backend/assets/notification-badges/retweet.png b/packages/backend/assets/notification-badges/retweet.png deleted file mode 100644 index dc6106048107a8459bd6efc921835d9bf2e25d9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 798 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>V0!B5;uumf=k4s=jh_qzTKid4 z6c!3;Efkv2z^oF(Ikf@IpK#%~@^<6e%HJDjr)=h(lb-hfV9qz2DgBceS_GUp6p;x@ z-iB+{g7-a`AMhp2xq7wKHQt3e;lTcf!A^?X4lQR%R(TlQBslAXrlPUo!{r_sj9(by zCfe#||A>w@3_8?5@xr4S2lYD*)ZKqXaqj#zRpavZ8*?6Ji@lLuwXBZivrD4jK9@r$ zH>`L4y2+w6qD_Bdf#JK_3`W&M(>*Fgq7E-)nZolwSS3aH0Z^UO`z^~BG1(lR?(u@* z&c8O@NLLma#hOkQ{xhs|7SzwL)tskXD|&Xdx1@&gGbXFV$(28N5B2k(e9XAFrTUb^ zOhfSkQL~wc=Eu#IVr+P)B^|_e>P+IghRPoeaSRI6KZJ%eY>+=w{lj4n149K@)z+2F zsY^N7{;heEUsioTa$F|LGT@9V5*Ic(uJUdN9 zTtT(HL23a*y2b%Xu7WnEISbL44Z??Xr%QkPU+XQp;N{XqVT`)}?tl61!jaV}!Z>%+ z^e!pZEfMz%|Hf4Mt!daBcTy-zxZv2ovhS*#hD=h9>)l^DY~`%5KdH&6D{jxnDq9x@j(#$C-{bJyEx+lR)-+!7oA#_rzIvgRRk zDThT@%bSPHUpatcrRSrXJbyUEGR0YMj_@?#mS5q0pyTh{@|~(P+W24amsMO-n4>wJ z => { }; const iconUrl = (name: BadgeNames): string => - `/static-assets/tabler-badges/${name}.png`; + `/static-assets/notification-badges/${name}.png`; /* How to add a new badge: - * 1. Find the icon and download png from https://tabler-icons.io/ - * 2. vips resize ~/Downloads/icon-name.png vipswork.png 0.4; vips scRGB2BW vipswork.png ~/icon-name.png"[compression=9,strip]"; rm vipswork.png; - * 3. mv ~/icon-name.png ~/misskey/packages/backend/assets/tabler-badges/ + * 1. Find the icon from https://phosphoricons.com/ + * 2. Choose #000000 as the color, 96px as the size, and bold as the weight + * 3. Move icon-name.png to packages/backend/assets/notification-badges/ * 4. Add 'icon-name' to BadgeNames * 5. Add `badge: iconUrl('icon-name'),` */ @@ -131,7 +131,7 @@ async function composeNotification( { body: data.body.note.text || "", icon: data.body.user.avatarUrl, - badge: iconUrl("retweet"), + badge: iconUrl("boost"), data, actions: [ { @@ -150,7 +150,7 @@ async function composeNotification( { body: data.body.note.text || "", icon: data.body.user.avatarUrl, - badge: iconUrl("quote-right"), + badge: iconUrl("quote"), data, actions: [ { @@ -182,8 +182,7 @@ async function composeNotification( badge = badgeUrl.href; reaction = name.split("@")[0]; } else { - // Unicode絵文字の場合 - badge = `/twemoji-badge/${char2fileName(reaction)}.png`; + badge = iconUrl("reaction"); } if ( @@ -219,7 +218,7 @@ async function composeNotification( { body: data.body.note.text || "", icon: data.body.user.avatarUrl, - badge: iconUrl("poll-h"), + badge: iconUrl("poll"), data, }, ]; @@ -229,7 +228,7 @@ async function composeNotification( t("_notification.pollEnded"), { body: data.body.note.text || "", - badge: iconUrl("clipboard-check-solid"), + badge: iconUrl("clipboard-check"), data, }, ]; @@ -273,7 +272,7 @@ async function composeNotification( }), { body: data.body.invitation.group.name, - badge: iconUrl("id-card-alt"), + badge: iconUrl("id-card"), data, actions: [ { diff --git a/packages/sw/src/types.ts b/packages/sw/src/types.ts index 3de84e5749..991fcfd757 100644 --- a/packages/sw/src/types.ts +++ b/packages/sw/src/types.ts @@ -37,15 +37,17 @@ export type PushNotificationDataMap = { export type BadgeNames = | "null" - | "antenna" - | "arrow-back-up" | "at" - | "chart-arrows" - | "circle-check" - | "medal" + | "boost" + | "check" + | "clipboard-check" + | "clock" + | "comments" + | "id-card" | "messages" | "plus" + | "poll" | "quote" - | "repeat" - | "user-plus" - | "users"; + | "reaction" + | "reply" + | "user-plus";