feat(staging): added transfer for data from settings app(part 2)

This commit is contained in:
Savely Savianok
2024-12-21 18:51:28 +03:00
parent f21678b219
commit 3b2e4992a3
7 changed files with 98 additions and 77 deletions

View File

@@ -1,13 +1,16 @@
import { BaseSideService } from "@zeppos/zml/base-side"
AppSideService(
BaseSideService(
{
onInit(){
settings.settingsStorage.addListener('change', async ({ key, newValue, oldValue }) => {
console.log(key)
console.log(newValue)
const totps = settings.settingsStorage.getItem('TOTPs')
const dataBuffer = Buffer.from(totps)
messaging.peerSocket.send(dataBuffer.buffer)
})
},
onRequest(req, res){
if(req.method === 'totps'){
res(null, settings.settingsStorage.getItem('TOTPs'))
}
}
}
)
)
)