Add eslint config and fix linting issues

This commit is contained in:
Pedro Lopez
2020-02-02 14:50:04 -04:00
parent 8eb461ed32
commit cc477f9545
11 changed files with 1047 additions and 124 deletions

View File

@@ -19,9 +19,9 @@ class Message extends Base {
this.body = this.hasMedia ? data.caption || '' : data.body || '';
this.type = data.type;
this.timestamp = data.t;
this.from = typeof (data.from) === "object" ? data.from._serialized : data.from;
this.to = typeof (data.to) === "object" ? data.to._serialized : data.to;
this.author = typeof (data.author) === "object" ? data.author._serialized : data.author;
this.from = typeof (data.from) === 'object' ? data.from._serialized : data.from;
this.to = typeof (data.to) === 'object' ? data.to._serialized : data.to;
this.author = typeof (data.author) === 'object' ? data.author._serialized : data.author;
this.isForwarded = data.isForwarded;
this.broadcast = data.broadcast;
this.fromMe = data.id.fromMe;
@@ -48,7 +48,7 @@ class Message extends Base {
if (!this.hasQuotedMsg) return undefined;
const quotedMsg = await this.client.pupPage.evaluate((msgId) => {
let msg = Store.Msg.get(msgId);
let msg = window.Store.Msg.get(msgId);
return msg.quotedMsgObj().serialize();
}, this.id._serialized);
@@ -68,10 +68,10 @@ class Message extends Base {
}
const newMessage = await this.client.pupPage.evaluate(async (chatId, quotedMessageId, message) => {
let quotedMessage = Store.Msg.get(quotedMessageId);
let quotedMessage = window.Store.Msg.get(quotedMessageId);
if(quotedMessage.canReply()) {
const chat = Store.Chat.get(chatId);
const newMessage = await WWebJS.sendMessage(chat, message, quotedMessage.msgContextInfo(chat));
const chat = window.Store.Chat.get(chatId);
const newMessage = await window.WWebJS.sendMessage(chat, message, quotedMessage.msgContextInfo(chat));
return newMessage.serialize();
} else {
throw new Error('This message cannot be replied to.');
@@ -87,16 +87,16 @@ class Message extends Base {
}
return await this.client.pupPage.evaluate(async (msgId) => {
const msg = Store.Msg.get(msgId);
const buffer = await WWebJS.downloadBuffer(msg.clientUrl);
const decrypted = await Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
const data = await WWebJS.readBlobAsync(decrypted._blob);
const msg = window.Store.Msg.get(msgId);
const buffer = await window.WWebJS.downloadBuffer(msg.clientUrl);
const decrypted = await window.Store.CryptoLib.decryptE2EMedia(msg.type, buffer, msg.mediaKey, msg.mimetype);
const data = await window.WWebJS.readBlobAsync(decrypted._blob);
return {
data,
mimetype: msg.mimetype,
filename: msg.filename
}
};
}, this.id._serialized);
}