Fix form anonymous responses not triggering the notification

This commit is contained in:
yflory 2022-10-26 16:14:45 +02:00
parent 614d3834a3
commit 51c50db166
2 changed files with 17 additions and 1 deletions

View File

@ -1955,7 +1955,7 @@ define([
// If send is true, send the request to the owner.
if (owner) {
if (data.send) {
store.mailbox.sendTo(data.query, {
Mailbox.sendToAnon(store.anon_rpc, data.query, {
channel: data.channel,
data: data.msgData
}, {

View File

@ -164,6 +164,22 @@ proxy.mailboxes = {
});
});
};
Mailbox.sendToAnon = function (anonRpc, type, msg, user, cb) {
var Nacl = Crypto.Nacl;
var curveSeed = Nacl.randomBytes(32);
var curvePair = Nacl.box.keyPair.fromSecretKey(new Uint8Array(curveSeed));
var curvePrivate = Nacl.util.encodeBase64(curvePair.secretKey);
var curvePublic = Nacl.util.encodeBase64(curvePair.publicKey);
sendTo({
store: {
anon_rpc: anonRpc,
proxy: {
curvePrivate: curvePrivate,
curvePublic: curvePublic
}
}
}, type, msg, user, cb);
};
// Mark a message as read
var dismiss = function (ctx, data, cId, cb) {