mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-26 00:35:15 +00:00
Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop
This commit is contained in:
commit
e7f4ec72b4
3 changed files with 7 additions and 1 deletions
|
@ -64,6 +64,7 @@ export async function pushNotification<T extends keyof pushNotificationsTypes>(u
|
|||
type,
|
||||
body: type === 'notification' ? truncateNotification(body as Packed<'Notification'>) : body,
|
||||
userId,
|
||||
dateTime: (new Date()).getTime(),
|
||||
}), {
|
||||
proxy: config.proxy,
|
||||
}).catch((err: any) => {
|
||||
|
|
|
@ -42,8 +42,12 @@ self.addEventListener('push', ev => {
|
|||
// case 'driveFileCreated':
|
||||
case 'notification':
|
||||
case 'unreadMessagingMessage':
|
||||
// 1日以上経過している場合は無視
|
||||
if ((new Date()).getTime() - data.dateTime > 1000 * 60 * 60 * 24) break;
|
||||
|
||||
// クライアントがあったらストリームに接続しているということなので通知しない
|
||||
if (clients.length != 0) return;
|
||||
if (clients.length !== 0) break;
|
||||
|
||||
return createNotification(data);
|
||||
case 'readAllNotifications':
|
||||
for (const n of await self.registration.getNotifications()) {
|
||||
|
|
|
@ -24,6 +24,7 @@ export type pushNotificationData<K extends keyof pushNotificationDataSourceMap>
|
|||
type: K;
|
||||
body: pushNotificationDataSourceMap[K];
|
||||
userId: string;
|
||||
dateTime: number;
|
||||
};
|
||||
|
||||
export type pushNotificationDataMap = {
|
||||
|
|
Loading…
Reference in a new issue