Pārlūkot izejas kodu

provide to attribute for xmppjs

Dele Olajide 4 gadi atpakaļ
vecāks
revīzija
f903f66c79
2 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 1 1
      packages/offline-reply/offline-reply.js
  2. 1 1
      serviceworker.js

+ 1 - 1
packages/offline-reply/offline-reply.js

@@ -63,7 +63,7 @@
                             avatar = "data:" + image_type + ";base64," + _converse.xmppstatus.vcard.get('image');
                         }
 
-                        const payload = {msgBody: data.get('message'), msgFrom: _converse.bare_jid, msgType: 'chat', avatar: avatar, fullname: fullname, domain: _converse.connection.domain, password: _converse.connection.pass, ws: _converse.api.settings.get("websocket_url"), username: Strophe.getNodeFromJid(_converse.bare_jid)};
+                        const payload = {msgBody: data.get('message'), msgTo: jid, msgFrom: _converse.bare_jid, msgType: 'chat', avatar: avatar, fullname: fullname, domain: _converse.connection.domain, password: _converse.connection.pass, ws: _converse.api.settings.get("websocket_url"), username: Strophe.getNodeFromJid(_converse.bare_jid)};
                         window.WebPushLib.setVapidDetails('xmpp:' + _converse.bare_jid, secret.publicKey, secret.privateKey);
 
                         window.WebPushLib.sendNotification(secret.subscription, JSON.stringify(payload), {TTL: 60}).then(response => {

+ 1 - 1
serviceworker.js

@@ -112,7 +112,7 @@ self.addEventListener('notificationclick', function(event) {
                   console.debug("online", address);
 
                   const body = ">" + event.notification.data.msgBody + "\n\n" + event.reply;
-                  const message = xml("message", { type: event.notification.data.msgType, to: jid(event.notification.data.msgFrom) }, xml("body", {}, body));
+                  const message = xml("message", { from: event.notification.data.msgTo, type: event.notification.data.msgType, to: jid(event.notification.data.msgFrom) }, xml("body", {}, body));
                   await xmpp.send(message);
                   await xmpp.send(xml("presence", { type: "unavailable" }));
                   await xmpp.stop();