fix: 🐛 service worker notification badges
BIN
packages/backend/assets/notification-badges/boost.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 889 B After Width: | Height: | Size: 889 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
packages/backend/assets/notification-badges/reaction.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 798 B |
@ -222,6 +222,12 @@ export type Notification = {
|
||||
userId: User["id"];
|
||||
note: Note;
|
||||
}
|
||||
| {
|
||||
type: "pollEnded";
|
||||
user: User;
|
||||
userId: User["id"];
|
||||
note: Note;
|
||||
}
|
||||
| {
|
||||
type: "follow";
|
||||
user: User;
|
||||
|
@ -19,11 +19,11 @@ const closeNotificationsByTags = async (tags: string[]): Promise<void> => {
|
||||
};
|
||||
|
||||
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: [
|
||||
{
|
||||
|
@ -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";
|
||||
|