Browse Source

logz

feature/dockerfile-arm
Evan Feenstra 5 years ago
parent
commit
5c8ff131d2
  1. 3
      api/controllers/media.ts
  2. 18
      api/network/modify.ts
  3. 4
      dist/api/controllers/media.js
  4. 2
      dist/api/controllers/media.js.map
  5. 14
      dist/api/network/modify.js
  6. 2
      dist/api/network/modify.js.map

3
api/controllers/media.ts

@ -249,6 +249,7 @@ const receivePurchase = async (payload) => {
muid, receiver: sender.id,
}})
console.log('mediaKey found!',mediaKey)
if(!mediaKey) return // this is from another person (admin is forwarding)
const terms = parseLDAT(mediaToken)
// get info
@ -394,7 +395,7 @@ const receivePurchaseDeny = async (payload) => {
}
const receiveAttachment = async (payload) => {
console.log('received attachment', { payload })
// console.log('received attachment', { payload })
var date = new Date();
date.setMilliseconds(0)

18
api/network/modify.ts

@ -61,15 +61,25 @@ export async function purchaseFromOriginalSender(payload, chat, purchaser){
} else {
console.log("NO MEDIA KEY EXISTS YET")
const ogmsg = await models.Message.findOne({where:{chatId:chat.id,mediaToken:mt}})
const ogSender = await models.Contact.findOne({where:{id:ogmsg.sender}})
// purchase it from creator (send "purchase")
const msg={amount, mediaToken:mt}
console.log("GO AHEARD AND BUY!!!")
console.log("GO AHEARD AND BUY!!! from:",ogmsg.sender,{
chat: {...chat.dataValues, contactIds:[ogmsg.sender]},
sender: {
...owner.dataValues,
...purchaser&&purchaser.alias && {alias:purchaser.alias}
},
type: constants.message_types.purchase,
message: msg,
amount: amount,
success: ()=>{},
failure: ()=>{}
})
sendMessage({
chat: {...chat.dataValues, contactIds:[ogmsg.sender]},
sender: {
...owner.dataValues,
...ogSender&&ogSender.alias && {alias:ogSender.alias}
...purchaser&&purchaser.alias && {alias:purchaser.alias}
},
type: constants.message_types.purchase,
message: msg,
@ -83,6 +93,8 @@ export async function purchaseFromOriginalSender(payload, chat, purchaser){
export async function sendFinalMemeIfFirstPurchaser(payload, chat, sender){
if(payload.type!==msgtypes.purchase_accept) return
console.log("PURCHASE ACCEPT!!!!!")
const mt = payload.message && payload.message.mediaToken
const typ = payload.message && payload.message.mediaType
if(!mt) return

4
dist/api/controllers/media.js

@ -222,6 +222,8 @@ const receivePurchase = (payload) => __awaiter(void 0, void 0, void 0, function*
muid, receiver: sender.id,
} });
console.log('mediaKey found!', mediaKey);
if (!mediaKey)
return; // this is from another person (admin is forwarding)
const terms = ldat_1.parseLDAT(mediaToken);
// get info
let TTL = terms.meta && terms.meta.ttl;
@ -363,7 +365,7 @@ const receivePurchaseDeny = (payload) => __awaiter(void 0, void 0, void 0, funct
});
exports.receivePurchaseDeny = receivePurchaseDeny;
const receiveAttachment = (payload) => __awaiter(void 0, void 0, void 0, function* () {
console.log('received attachment', { payload });
// console.log('received attachment', { payload })
var date = new Date();
date.setMilliseconds(0);
const { owner, sender, chat, mediaToken, mediaKey, mediaType, content, msg_id, chat_type, sender_alias, msg_uuid } = yield helpers.parseReceiveParams(payload);

2
dist/api/controllers/media.js.map

File diff suppressed because one or more lines are too long

14
dist/api/network/modify.js

@ -74,13 +74,20 @@ function purchaseFromOriginalSender(payload, chat, purchaser) {
else {
console.log("NO MEDIA KEY EXISTS YET");
const ogmsg = yield models_1.models.Message.findOne({ where: { chatId: chat.id, mediaToken: mt } });
const ogSender = yield models_1.models.Contact.findOne({ where: { id: ogmsg.sender } });
// purchase it from creator (send "purchase")
const msg = { amount, mediaToken: mt };
console.log("GO AHEARD AND BUY!!!");
console.log("GO AHEARD AND BUY!!! from:", ogmsg.sender, {
chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [ogmsg.sender] }),
sender: Object.assign(Object.assign({}, owner.dataValues), purchaser && purchaser.alias && { alias: purchaser.alias }),
type: constants.message_types.purchase,
message: msg,
amount: amount,
success: () => { },
failure: () => { }
});
send_1.sendMessage({
chat: Object.assign(Object.assign({}, chat.dataValues), { contactIds: [ogmsg.sender] }),
sender: Object.assign(Object.assign({}, owner.dataValues), ogSender && ogSender.alias && { alias: ogSender.alias }),
sender: Object.assign(Object.assign({}, owner.dataValues), purchaser && purchaser.alias && { alias: purchaser.alias }),
type: constants.message_types.purchase,
message: msg,
amount: amount,
@ -95,6 +102,7 @@ function sendFinalMemeIfFirstPurchaser(payload, chat, sender) {
return __awaiter(this, void 0, void 0, function* () {
if (payload.type !== msgtypes.purchase_accept)
return;
console.log("PURCHASE ACCEPT!!!!!");
const mt = payload.message && payload.message.mediaToken;
const typ = payload.message && payload.message.mediaType;
if (!mt)

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

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