Add notification feature with permission handling and UI toggle
This commit is contained in:
@@ -1330,6 +1330,22 @@ export async function sendChat(chatProcessIndex = -1,arg:{
|
||||
})
|
||||
}
|
||||
|
||||
if(DBState.db.notification){
|
||||
try {
|
||||
const permission = await Notification.requestPermission()
|
||||
if(permission === 'granted'){
|
||||
const noti = new Notification('RisuAI', {
|
||||
body: result
|
||||
})
|
||||
noti.onclick = () => {
|
||||
window.focus()
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
chatProcessStage.set(4)
|
||||
|
||||
peerSync()
|
||||
|
||||
@@ -848,6 +848,7 @@ export interface Database{
|
||||
translateBeforeHTMLFormatting:boolean
|
||||
autoTranslateCachedOnly:boolean
|
||||
lightningRealmImport:boolean
|
||||
notification: boolean
|
||||
}
|
||||
|
||||
interface SeparateParameters{
|
||||
|
||||
Reference in New Issue
Block a user