Browse Source

fix parsepayload

loopout2
Evan Feenstra 4 years ago
parent
commit
bc1e153691
  1. 14
      dist/src/network/receive.js
  2. 2
      dist/src/network/receive.js.map
  3. 14
      src/network/receive.ts

14
dist/src/network/receive.js

@ -244,6 +244,17 @@ function initTribesSubscriptions() {
});
}
exports.initTribesSubscriptions = initTribesSubscriptions;
function parsePayload(data) {
const li = data.lastIndexOf('}');
const msg = data.substring(0, li + 1);
try {
const payload = JSON.parse(msg);
return payload;
}
catch (e) {
throw e;
}
}
// VERIFY PUBKEY OF SENDER from sig
function parseAndVerifyPayload(data) {
return __awaiter(this, void 0, void 0, function* () {
@ -305,8 +316,9 @@ function parseKeysendInvoice(i) {
if (data) {
console.log("HEY GOT A KEYSENEEDDDDD!!!!!", data);
try {
const payload = JSON.parse(data);
const payload = parsePayload(data);
if (payload.type === constants_1.default.message_types.keysend) {
console.log("HEY ISSSS A TPY 28", payload);
isAnonymous = true;
memo = payload.message.content;
}

2
dist/src/network/receive.js.map

File diff suppressed because one or more lines are too long

14
src/network/receive.ts

@ -222,6 +222,17 @@ export async function initTribesSubscriptions(){
})
}
function parsePayload(data){
const li = data.lastIndexOf('}')
const msg = data.substring(0,li+1)
try {
const payload = JSON.parse(msg)
return payload
} catch(e) {
throw e
}
}
// VERIFY PUBKEY OF SENDER from sig
async function parseAndVerifyPayload(data){
let payload
@ -277,8 +288,9 @@ export async function parseKeysendInvoice(i){
if(data){
console.log("HEY GOT A KEYSENEEDDDDD!!!!!",data)
try {
const payload = JSON.parse(data)
const payload = parsePayload(data)
if(payload.type===constants.message_types.keysend) {
console.log("HEY ISSSS A TPY 28",payload)
isAnonymous = true
memo = payload.message.content
}

Loading…
Cancel
Save