Browse Source

typesToReplay

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

2
api/controllers/chatTribes.ts

@ -156,7 +156,7 @@ async function replayChatHistory(chat, contact) {
})
const owner = await models.Contact.findOne({ where: { isOwner: true } })
asyncForEach(msgs, async m=>{
if(!network.typesToForward.includes(m.type)) return // only for message for now
if(!network.typesToReplay.includes(m.type)) return // only for message for now
const sender = {
...owner.dataValues,
...m.senderAlias && {alias: m.senderAlias},

6
api/network/modify.ts

@ -66,16 +66,14 @@ export async function modifyPayloadAndSaveMediaKey(payload, chat, sender) {
skipSigning: amt ? true : false // only sign if its free
}
const keyToEncrypt = newKey.slice()
const encKey = rsa.encrypt(chat.groupKey, keyToEncrypt)
const keyToSave = encKey.slice()
const encKey = rsa.encrypt(chat.groupKey, newKey.slice())
var date = new Date();
date.setMilliseconds(0)
console.log('[modify] save media key!',{
muid:json.muid,
chatId:chat.id,
key: keyToSave,
key: encKey,
messageId: (payload.message&&payload.message.id)||0,
receiver: 0,
sender: sender.id, // the og sender

2
dist/api/controllers/chatTribes.js

@ -154,7 +154,7 @@ function replayChatHistory(chat, contact) {
});
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
asyncForEach(msgs, (m) => __awaiter(this, void 0, void 0, function* () {
if (!network.typesToForward.includes(m.type))
if (!network.typesToReplay.includes(m.type))
return; // only for message for now
const sender = Object.assign(Object.assign({}, owner.dataValues), m.senderAlias && { alias: m.senderAlias });
let content = '';

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

File diff suppressed because one or more lines are too long

6
dist/api/network/modify.js

@ -64,15 +64,13 @@ function modifyPayloadAndSaveMediaKey(payload, chat, sender) {
meta: Object.assign({}, amt && { amt }),
skipSigning: amt ? true : false // only sign if its free
};
const keyToEncrypt = newKey.slice();
const encKey = rsa.encrypt(chat.groupKey, keyToEncrypt);
const keyToSave = encKey.slice();
const encKey = rsa.encrypt(chat.groupKey, newKey.slice());
var date = new Date();
date.setMilliseconds(0);
console.log('[modify] save media key!', {
muid: json.muid,
chatId: chat.id,
key: keyToSave,
key: encKey,
messageId: (payload.message && payload.message.id) || 0,
receiver: 0,
sender: sender.id,

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

@ -1 +1 @@
{"version":3,"file":"modify.js","sourceRoot":"","sources":["../../../api/network/modify.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAC5B,kDAA0C;AAC1C,oCAAmC;AACnC,wCAAuC;AACvC,qCAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,sCAAqC;AACrC,qCAAqC;AAErC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,6BAA6B,CAAC,CAAC,CAAA;AAC7E,MAAM,QAAQ,GAAG,SAAS,CAAC,aAAa,CAAA;AAExC,SAAsB,4BAA4B,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM;;QACtE,IAAG,OAAO,CAAC,IAAI,KAAG,QAAQ,CAAC,UAAU,EAAE;YAErC,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAA;YACxD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAA;YACvD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAA;YACxD,IAAG,CAAC,EAAE,IAAI,CAAC,GAAG;gBAAE,OAAO,OAAO,CAAA;YAE9B,MAAM,KAAK,GAAG,gBAAS,CAAC,EAAE,CAAC,CAAA;YAC3B,IAAG,CAAC,KAAK,CAAC,IAAI;gBAAE,OAAO,OAAO,CAAA;YAE9B,IAAI;gBACF,MAAM,CAAC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