add webpush switch

This commit is contained in:
jxxghp
2024-06-05 18:42:39 +08:00
parent 157c37c862
commit e649be58a2
3 changed files with 14 additions and 1 deletions

View File

@@ -720,6 +720,7 @@ export interface NotificationSwitch {
slack: boolean
synologychat: boolean
vocechat: boolean
webpush: boolean
}
// 文件浏览接口

View File

@@ -107,7 +107,11 @@ async function subscribeForPushNotifications() {
}
})
// 发送订阅请求
await api.post('/message/subscribe', subscription)
try {
await api.post('/message/webpush/subscribe', subscription)
} catch (e) {
console.log(e)
}
}
}

View File

@@ -56,6 +56,10 @@ const NotificationChannels = [
title: 'VoceChat',
value: 'vocechat',
},
{
title: 'WebPush',
value: 'webpush',
},
]
// 提示框
@@ -430,6 +434,7 @@ onMounted(() => {
<th scope="col">Slack</th>
<th scope="col">SynologyChat</th>
<th scope="col">VoceChat</th>
<th scope="col">WebPush</th>
</tr>
</thead>
<tbody>
@@ -452,6 +457,9 @@ onMounted(() => {
<td>
<VCheckbox v-model="message.vocechat" />
</td>
<td>
<VCheckbox v-model="message.webpush" />
</td>
</tr>
<tr v-if="messagemTypes.length === 0">
<td colspan="6" class="text-center">没有设置任何通知渠道</td>