增加xpush

This commit is contained in:
yml
2026-05-25 17:20:18 +08:00
parent 28c8575a11
commit 30728c40be
22 changed files with 794 additions and 81 deletions
@@ -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,
})),
},
},
}
}