Browse Source

fix

hosting-provider
Evan Feenstra 5 years ago
parent
commit
83679affd8
  1. 8
      api/network/send.ts
  2. 8
      dist/api/network/send.js
  3. 2
      dist/api/network/send.js.map

8
api/network/send.ts

@ -4,6 +4,7 @@ import {personalizeMessage, decryptMessage} from '../utils/msg'
import * as path from 'path'
import * as tribes from '../utils/tribes'
import {tribeOwnerAutoConfirmation} from '../controllers/confirmations'
import {typesToForward} from './receive'
const constants = require(path.join(__dirname,'../../config/constants.json'))
@ -107,7 +108,7 @@ export function signAndSend(opts, mqttTopic?:string){
try {
if(mqttTopic) {
await tribes.publish(mqttTopic, data, function(){
if(mqttTopic) checkIfConfirmation(opts.data)
if(mqttTopic) checkIfAutoConfirm(opts.data)
})
} else {
await LND.keysendMessage({...opts,data})
@ -119,9 +120,8 @@ export function signAndSend(opts, mqttTopic?:string){
})
}
function checkIfConfirmation(data){
console.log("checkIfConfirmation",data)
if(data.type===constants.message_types.confirmation) {
function checkIfAutoConfirm(data){
if(typesToForward.includes(data.type)){
tribeOwnerAutoConfirmation(data.message.id)
}
}

8
dist/api/network/send.js

@ -15,6 +15,7 @@ const msg_1 = require("../utils/msg");
const path = require("path");
const tribes = require("../utils/tribes");
const confirmations_1 = require("../controllers/confirmations");
const receive_1 = require("./receive");
const constants = require(path.join(__dirname, '../../config/constants.json'));
function sendMessage(params) {
return __awaiter(this, void 0, void 0, function* () {
@ -116,7 +117,7 @@ function signAndSend(opts, mqttTopic) {
if (mqttTopic) {
yield tribes.publish(mqttTopic, data, function () {
if (mqttTopic)
checkIfConfirmation(opts.data);
checkIfAutoConfirm(opts.data);
});
}
else {
@ -131,9 +132,8 @@ function signAndSend(opts, mqttTopic) {
});
}
exports.signAndSend = signAndSend;
function checkIfConfirmation(data) {
console.log("checkIfConfirmation", data);
if (data.type === constants.message_types.confirmation) {
function checkIfAutoConfirm(data) {
if (receive_1.typesToForward.includes(data.type)) {
confirmations_1.tribeOwnerAutoConfirmation(data.message.id);
}
}

2
dist/api/network/send.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save