Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Feb 27, 2021
1 parent d6ae549 commit 29aa079
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 127 deletions.
8 changes: 4 additions & 4 deletions src/api/layers/host.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class HostLayer {
this.spin('Waiting page load', 'spinning');

await this.page
.waitForFunction(`!document.querySelector('#initial_startup')`)
.waitForFunction(`!document.querySelector('#initial_startup')`)
.catch(() => {});

this.spin('Checking is logged...');
Expand Down Expand Up @@ -297,9 +297,9 @@ export class HostLayer {
}

if (authenticated === true) {
// Reinicia o contador do autoclose
this.cancelAutoClose();
this.startAutoClose();
// Reinicia o contador do autoclose
this.cancelAutoClose();
this.startAutoClose();
// Wait for interface update
await sleep(200);
this.spin('Checking phone is connected...');
Expand Down
52 changes: 22 additions & 30 deletions src/api/layers/sender.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,42 +334,34 @@ export class SenderLayer extends ListenerLayer {
* @param to Chat id
* @param base64 base64 data
*/
public async sendVoice(
to: string,
filePath: string,
){
let base64 = await downloadFileToBase64(filePath, [
'audio/mpeg',
]);
public async sendVoice(to: string, filePath: string) {
let base64 = await downloadFileToBase64(filePath, ['audio/mpeg']);

if (!base64) {
base64 = await fileToBase64(filePath);
}
if (!base64) {
base64 = await fileToBase64(filePath);
}

if (!base64) {
const obj = {
erro: true,
to: to,
text: 'No such file or directory, open "' + filePath + '"',
};
return obj;
}

if (!base64) {
const obj = {
erro: true,
to: to,
text: 'No such file or directory, open "' + filePath + '"',
};
return obj;
}

path.basename(filePath);
path.basename(filePath);

let filename = '';
let filename = '';

let caption = '';

return this.page.evaluate(
({ to, base64, filename, caption }) => {
WAPI.sendPtt(base64, to, filename, caption)
},
{ to, base64, filename, caption }
);
let caption = '';


return this.page.evaluate(
({ to, base64, filename, caption }) => {
WAPI.sendPtt(base64, to, filename, caption);
},
{ to, base64, filename, caption }
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/api/model/enum/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ export { GroupNotificationType } from './group-notification-type';
export { SocketState } from './socket-state';
export { MessageType, MediaType } from './message-type';
export * from './interface-mode';
export * from './interface-state';
export * from './interface-state';
74 changes: 37 additions & 37 deletions src/api/model/enum/interface-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,40 +53,40 @@ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNMMNNNMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
*/
export enum InterfaceMode {
/**
* QR code page.
*/
QR = 'QR',
/**
* Chat page.
*/
MAIN = 'CONNECTION',
/**
* Loading page, waiting data from smartphone.
*/
SYNCING = 'SYNCING',
/**
* Offline page, when there are no internet.
*/
OFFLINE = 'OFFLINE',
/**
* Conflic page, when there are another whatsapp web openned.
*/
CONFLICT = 'CONFLICT',
/**
* Blocked page, by proxy.
*/
PROXYBLOCK = 'PROXYBLOCK',
/**
* Blocked page.
*/
TOS_BLOCK = 'TOS_BLOCK',
/**
* Blocked page.
*/
SMB_TOS_BLOCK = 'SMB_TOS_BLOCK',
/**
* Deprecated page.
*/
DEPRECATED_VERSION = 'DEPRECATED_VERSION',
}
/**
* QR code page.
*/
QR = 'QR',
/**
* Chat page.
*/
MAIN = 'CONNECTION',
/**
* Loading page, waiting data from smartphone.
*/
SYNCING = 'SYNCING',
/**
* Offline page, when there are no internet.
*/
OFFLINE = 'OFFLINE',
/**
* Conflic page, when there are another whatsapp web openned.
*/
CONFLICT = 'CONFLICT',
/**
* Blocked page, by proxy.
*/
PROXYBLOCK = 'PROXYBLOCK',
/**
* Blocked page.
*/
TOS_BLOCK = 'TOS_BLOCK',
/**
* Blocked page.
*/
SMB_TOS_BLOCK = 'SMB_TOS_BLOCK',
/**
* Deprecated page.
*/
DEPRECATED_VERSION = 'DEPRECATED_VERSION',
}
66 changes: 33 additions & 33 deletions src/api/model/enum/interface-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,36 @@ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNMMNNNMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
*/
export enum InterfaceState {
/**
* When there are no internet.
*/
OFFLINE = 'OFFLINE',
/**
* When the whatsapp web page is loading.
*/
OPENING = 'OPENING',
/**
* When the whatsapp web is connecting to smartphone after QR code scan.
*/
PAIRING = 'PAIRING',
/**
* When the whatsapp web is syncing messages with smartphone.
*/
SYNCING = 'SYNCING',
/**
* When the whatsapp web is syncing messages with smartphone after a disconnection.
*/
RESUMING = 'RESUMING',
/**
* When the whatsapp web is connecting to whatsapp server.
*/
CONNECTING = 'CONNECTING',
/**
* When the whatsapp web is ready.
*/
NORMAL = 'NORMAL',
/**
* When the whatsapp web couldn't connect to smartphone.
*/
WITHOUT_INTERNET = 'WITHOUT INTERNET',
}
/**
* When there are no internet.
*/
OFFLINE = 'OFFLINE',
/**
* When the whatsapp web page is loading.
*/
OPENING = 'OPENING',
/**
* When the whatsapp web is connecting to smartphone after QR code scan.
*/
PAIRING = 'PAIRING',
/**
* When the whatsapp web is syncing messages with smartphone.
*/
SYNCING = 'SYNCING',
/**
* When the whatsapp web is syncing messages with smartphone after a disconnection.
*/
RESUMING = 'RESUMING',
/**
* When the whatsapp web is connecting to whatsapp server.
*/
CONNECTING = 'CONNECTING',
/**
* When the whatsapp web is ready.
*/
NORMAL = 'NORMAL',
/**
* When the whatsapp web couldn't connect to smartphone.
*/
WITHOUT_INTERNET = 'WITHOUT INTERNET',
}
2 changes: 1 addition & 1 deletion src/api/whatsapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,4 @@ export class Whatsapp extends ControlsLayer {
const buff = Buffer.from(res.data, 'binary');
return magix(buff, message.mediaKey, message.type, message.size);
}
}
}
2 changes: 1 addition & 1 deletion src/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const getInterfaceStatus = async (
window['Store'] &&
window['Store'].Stream &&
window['Store'].Stream.displayInfo;
if (['PAIRING', 'RESUMING', 'SYNCING'].includes(streamStatus)) {
if (['PAIRING', 'RESUMING', 'SYNCING'].includes(streamStatus)) {
return 'PAIRING';
}
const elChat = document.querySelector('.app,.two') as HTMLDivElement;
Expand Down
12 changes: 6 additions & 6 deletions src/controllers/welcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as boxen from 'boxen';
import * as chalk from 'chalk';
import latestVersion from 'latest-version';
import * as Spinnies from 'spinnies';
import {yo} from 'yoo-hoo';
import { yo } from 'yoo-hoo';
import { upToDate } from '../utils/semver';
const { version } = require('../../package.json');

Expand All @@ -15,8 +15,8 @@ export function welcomeScreen() {
return;
}
welcomeShown = true;
yo('VENOM', { color: 'cyan'});
console.log("\n\n")
yo('VENOM', { color: 'cyan' });
console.log('\n\n');
}

export async function checkUpdates(spinnies: Spinnies) {
Expand Down Expand Up @@ -55,9 +55,9 @@ async function checkVenomVersion(spinnies: Spinnies) {
function logUpdateAvailable(current: string, latest: string) {
// prettier-ignore
const newVersionLog =
`There is a new version of ${chalk.bold(`Venom`)} ${chalk.gray(current)}${chalk.bold.green(latest)}\n` +
`Update your package by running:\n\n` +
`${chalk.bold('\>')} ${chalk.blueBright('npm update venom-bot')}`;
`There is a new version of ${chalk.bold(`Venom`)} ${chalk.gray(current)}${chalk.bold.green(latest)}\n` +
`Update your package by running:\n\n` +
`${chalk.bold('\>')} ${chalk.blueBright('npm update venom-bot')}`;

console.log(boxen(newVersionLog, { padding: 1 }));
console.log(
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { tokenSession } from './config/tokenSession.config';
/*
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
Expand Down Expand Up @@ -72,4 +71,3 @@ export {
CreateOptions,
StatusFind,
} from './controllers/initializer';

2 changes: 1 addition & 1 deletion src/lib/wapi/functions/add-participant.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ export async function addParticipant(groupId, contactsId) {
await window.Store.Participants.addParticipants(chat, contactsId);

return true;
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/download-media.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ export async function downloadMedia(messageId) {
reader.onerror = reject;
reader.readAsDataURL(blob);
});
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/process-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ export async function processFiles(chat, blobs) {
1
);
return mediaCollection;
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/promote-participant.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ export async function promoteParticipant(groupId, contactsId, done) {

typeof done === 'function' && done(true);
return true;
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/remove-participant.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ export async function removeParticipant(groupId, contactsId, done) {

typeof done === 'function' && done(true);
return true;
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/send-contact-vcard-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ export async function sendContactVcardList(chatId, contacts) {
} else {
return chat;
}
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/send-contact-vcard.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ export async function sendContactVcard(chatId, contact, name) {
} else {
return chat;
}
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/send-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ export async function sendLocation(
} else {
return chat;
}
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/sendMessageOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ export async function sendMessageOptions(chatId, content, options = {}) {
await window.Store.addAndSendMsgToChat(chat, message);

return newMsgId._serialized;
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/set-profile-pic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export async function setProfilePic(obj, id) {
}
let base64 = 'data:image/jpeg;base64,';
return await Store.Profile.sendSetPicture(id, base64 + obj.b, base64 + obj.a);
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/listeners/add-on-state-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ export function addOnStateChange() {
});
return true;
};
}
}
2 changes: 1 addition & 1 deletion src/lib/wapi/serializers/serialize-contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ export const _serializeContactObj = (obj) => {
statusMute: obj.statusMute,
msgs: null,
});
};
};

0 comments on commit 29aa079

Please sign in to comment.