Firefish v1.0.5-rc (2)

This commit is contained in:
naskya 2023-12-06 05:02:20 +09:00
parent 1c57df5bf8
commit 41a7382ba4
Signed by: naskya
GPG key ID: 164DFF24E2D40139
4411 changed files with 6655 additions and 2902 deletions
packages/sw/src

View file

@ -2,7 +2,6 @@
* Notification manager for SW
*/
import type { BadgeNames, PushNotificationDataMap } from "@/types";
import { char2fileName } from "@/scripts/twemoji-base";
import { cli } from "@/scripts/operations";
import { getAccountFromId } from "@/scripts/get-account-from-id";
import { swLang } from "@/scripts/lang";
@ -19,11 +18,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 +130,7 @@ async function composeNotification(
{
body: data.body.note.text || "",
icon: data.body.user.avatarUrl,
badge: iconUrl("retweet"),
badge: iconUrl("boost"),
data,
actions: [
{
@ -150,7 +149,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 +181,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 +217,7 @@ async function composeNotification(
{
body: data.body.note.text || "",
icon: data.body.user.avatarUrl,
badge: iconUrl("poll-h"),
badge: iconUrl("poll"),
data,
},
];
@ -229,7 +227,7 @@ async function composeNotification(
t("_notification.pollEnded"),
{
body: data.body.note.text || "",
badge: iconUrl("clipboard-check-solid"),
badge: iconUrl("clipboard-check"),
data,
},
];
@ -273,7 +271,7 @@ async function composeNotification(
}),
{
body: data.body.invitation.group.name,
badge: iconUrl("id-card-alt"),
badge: iconUrl("id-card"),
data,
actions: [
{

View file

@ -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";