fix
This commit is contained in:
parent
b10f2b4668
commit
5a4ac382ad
2 changed files with 6 additions and 3 deletions
|
|
@ -10,7 +10,8 @@ export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSett
|
|||
const app = await mainHandler.storage.applicationStorage.GetApplication(appId || "")
|
||||
let nostrUser = await mainHandler.storage.applicationStorage.GetOrCreateNostrAppUser(app, pub || "")
|
||||
return { user_id: nostrUser.user.user_id, app_user_id: nostrUser.identifier, app_id: appId || "" }
|
||||
}
|
||||
},
|
||||
metricsCallback: metrics => mainHandler.metricsManager.AddMetrics(metrics)
|
||||
})
|
||||
const nostr = new Nostr(nostrSettings, event => {
|
||||
let j: NostrRequest
|
||||
|
|
@ -22,7 +23,7 @@ export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSett
|
|||
}
|
||||
nostrTransport({ ...j, appId: event.appId }, res => {
|
||||
nostr.Send(event.appId, { type: 'content', pub: event.pub, content: JSON.stringify({ ...res, requestId: j.requestId }) })
|
||||
})
|
||||
}, event.startAtNano)
|
||||
})
|
||||
return { Stop: () => nostr.Stop, Send: (...args) => nostr.Send(...args) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export type NostrEvent = {
|
|||
pub: string
|
||||
content: string
|
||||
appId: string
|
||||
startAtNano: bigint
|
||||
}
|
||||
type SettingsRequest = {
|
||||
type: 'settings'
|
||||
|
|
@ -141,9 +142,10 @@ export default class Handler {
|
|||
return
|
||||
}
|
||||
handledEvents.push(eventId)
|
||||
const startAtNano = process.hrtime.bigint()
|
||||
const decoded = decodePayload(e.content)
|
||||
const content = await decryptData(decoded, getSharedSecret(app.privateKey, e.pubkey))
|
||||
this.eventCallback({ id: eventId, content, pub: e.pubkey, appId: app.appId })
|
||||
this.eventCallback({ id: eventId, content, pub: e.pubkey, appId: app.appId, startAtNano })
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue