server: improve comments
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
This commit is contained in:
parent
c49f529ccb
commit
486be564e8
1 changed files with 5 additions and 8 deletions
|
@ -15,20 +15,21 @@ type pushNotificationsTypes = {
|
|||
'readAllMessagingMessagesOfARoom': { userId: string } | { groupId: string };
|
||||
};
|
||||
|
||||
// プッシュメッセージサーバーには文字数制限があるため、内容を削減します
|
||||
// Reduce the content of the push message because of the character limit
|
||||
function truncateNotification(notification: Packed<'Notification'>): any {
|
||||
if (notification.note) {
|
||||
return {
|
||||
...notification,
|
||||
note: {
|
||||
...notification.note,
|
||||
// textをgetNoteSummaryしたものに置き換える
|
||||
// replace text with getNoteSummary
|
||||
text: getNoteSummary(notification.type === 'renote' ? notification.note.renote as Packed<'Note'> : notification.note),
|
||||
|
||||
cw: undefined,
|
||||
reply: undefined,
|
||||
renote: undefined,
|
||||
user: undefined as any, // 通知を受け取ったユーザーである場合が多いのでこれも捨てる
|
||||
// unnecessary, since usually the user who is receiving the notification knows who they are
|
||||
user: undefined as any,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -41,7 +42,7 @@ export async function pushNotification<T extends keyof pushNotificationsTypes>(u
|
|||
|
||||
if (!meta.enableServiceWorker || meta.swPublicKey == null || meta.swPrivateKey == null) return;
|
||||
|
||||
// アプリケーションの連絡先と、サーバーサイドの鍵ペアの情報を登録
|
||||
// Register key pair information
|
||||
push.setVapidDetails(config.url,
|
||||
meta.swPublicKey,
|
||||
meta.swPrivateKey);
|
||||
|
@ -65,10 +66,6 @@ export async function pushNotification<T extends keyof pushNotificationsTypes>(u
|
|||
}), {
|
||||
proxy: config.proxy,
|
||||
}).catch((err: any) => {
|
||||
//swLogger.info(err.statusCode);
|
||||
//swLogger.info(err.headers);
|
||||
//swLogger.info(err.body);
|
||||
|
||||
if (err.statusCode === 410) {
|
||||
SwSubscriptions.delete({
|
||||
userId,
|
||||
|
|
Loading…
Reference in a new issue