优化后端鉴权与日志安全
This commit is contained in:
@@ -8,6 +8,7 @@ import { sendBarkNotification } from './bark-service.js'
|
||||
import { sendWpushNotification } from './wpush-service.js'
|
||||
|
||||
type JsonObject = Record<string, any>
|
||||
type NotificationResult = ReturnType<typeof mapNotificationResult>
|
||||
type NotificationInput = {
|
||||
title?: string
|
||||
body?: string
|
||||
@@ -31,12 +32,12 @@ export async function sendInternalNotification(input: NotificationInput = {}) {
|
||||
successCount: 0,
|
||||
failedCount: 0,
|
||||
skippedCount: barkRecipients.length + wpushRecipients.length,
|
||||
results: [],
|
||||
results: [] as NotificationResult[],
|
||||
}
|
||||
}
|
||||
|
||||
const results = [
|
||||
...(await Promise.all(barkRecipients.map(async (recipient) => {
|
||||
...(await Promise.all(barkRecipients.map(async (recipient: JsonObject) => {
|
||||
try {
|
||||
const result = await sendBarkNotification({
|
||||
serverUrl: bark.serverUrl,
|
||||
@@ -64,7 +65,7 @@ export async function sendInternalNotification(input: NotificationInput = {}) {
|
||||
)
|
||||
}
|
||||
}))),
|
||||
...(await Promise.all(wpushRecipients.map(async (recipient) => {
|
||||
...(await Promise.all(wpushRecipients.map(async (recipient: JsonObject) => {
|
||||
try {
|
||||
const result = await sendWpushNotification({
|
||||
recipient,
|
||||
|
||||
Reference in New Issue
Block a user