增加xpush
This commit is contained in:
@@ -45,7 +45,7 @@ export function updateAdminNotificationConfig(payload: AdminNotificationConfigIn
|
||||
export async function testAdminNotification(payload: AdminNotificationTestInput = {}) {
|
||||
return sendInternalNotification({
|
||||
title: String(payload.title || '订单系统测试通知').trim() || '订单系统测试通知',
|
||||
body: String(payload.body || '这是一条 Bark 内部通知测试。').trim() || '这是一条 Bark 内部通知测试。',
|
||||
body: String(payload.body || '这是一条内部通知测试。').trim() || '这是一条内部通知测试。',
|
||||
category: 'test',
|
||||
url: String(payload.url || '').trim(),
|
||||
})
|
||||
@@ -83,6 +83,7 @@ export async function runAdminScheduledJobNow(jobId: unknown) {
|
||||
|
||||
function mapAdminNotificationConfig(config: JsonObject = {}) {
|
||||
const bark = config.channels?.bark || {}
|
||||
const wpush = config.channels?.wpush || {}
|
||||
|
||||
return {
|
||||
enabled: config.enabled !== false,
|
||||
@@ -98,6 +99,16 @@ function mapAdminNotificationConfig(config: JsonObject = {}) {
|
||||
enabled: item.enabled !== false,
|
||||
})),
|
||||
},
|
||||
wpush: {
|
||||
enabled: wpush.enabled !== false,
|
||||
recipients: (Array.isArray(wpush.recipients) ? wpush.recipients : []).map((item) => ({
|
||||
id: String(item.id || '').trim(),
|
||||
name: String(item.name || '').trim(),
|
||||
apiKey: String(item.apiKey || item.apikey || '').trim(),
|
||||
apiKeyMasked: maskSecret(item.apiKey || item.apikey),
|
||||
enabled: item.enabled !== false,
|
||||
})),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user