Skip to content

Commit

Permalink
feat: addBrowserArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Apr 27, 2022
1 parent 1fb3622 commit 6541669
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Use it in your favorite language like PHP, Python, C# and others. as long as you

## Get our official API Venom ! Contact us!

<a target="_blank" href="https://web.whatsapp.com/send?phone=5511959389975&text=I%20want%20access%20to%20API%20Venom" target="_blank"><img title="whatzapp" height="100" width="375" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/WhatsApp_logo.svg/2000px-WhatsApp_logo.svg.png"></a>

<a target="_blank" href="https://web.whatsapp.com/send?phone=556181590153&text=I%20want%20access%20to%20API%20Venom" target="_blank"><img title="whatzapp" height="100" width="375" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f7/WhatsApp_logo.svg/2000px-WhatsApp_logo.svg.png"></a>

## Venom group support free on Telegram
Expand Down Expand Up @@ -190,7 +192,8 @@ venom
debug: false, // Opens a debug session
logQR: true, // Logs QR automatically in terminal
browserWS: '', // If u want to use browserWSEndpoint
browserArgs: [''], //Original parameters ---Parameters to be added into the chrome browser instance
browserArgs: [''], // Original parameters ---Parameters to be added into the chrome browser instance
addBrowserArgs: [''], // Add broserArgs without overwriting the project's original
puppeteerOptions: {}, // Will be passed to puppeteer.launch
disableSpins: true, // Will disable Spinnies animation, useful for containers (docker) for a better log
disableWelcome: true, // Will disable the welcoming message which appears in the beginning
Expand Down
1 change: 0 additions & 1 deletion src/api/layers/host.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ export class HostLayer {
statusFind?: (statusGet: string, session: string) => void
) {
this.statusFind = statusFind;

this.spin('Waiting page load', 'spinning');

await this.page
Expand Down
5 changes: 5 additions & 0 deletions src/config/create-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ export interface CreateConfig {
* Parameters to be added into the chrome browser instance
*/
browserArgs?: string[];
/**
* Add broserArgs without overwriting the project's original
*/
addBrowserArgs?: string[];
/**
* Will be passed to puppeteer.launch
*/
Expand Down Expand Up @@ -198,6 +202,7 @@ export const defaultOptions: CreateConfig = {
logQR: true,
browserWS: '',
browserArgs: puppeteerConfig.chromiumArgs,
addBrowserArgs: [],
puppeteerOptions: {},
disableSpins: false,
disableWelcome: false,
Expand Down
22 changes: 19 additions & 3 deletions src/controllers/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,21 @@ export async function initBrowser(
]);
// console.log(puppeteerConfig.chromiumArgs);
}
if (
Array.isArray(options?.addBrowserArgs) &&
options?.addBrowserArgs.length
) {
for (
let index: number = 0;
index < options?.addBrowserArgs.length;
index++
) {
const element = options?.addBrowserArgs[index];
if (!puppeteerConfig.chromiumArgs.includes(element)) {
puppeteerConfig.chromiumArgs.push(element);
}
}
}

let browser = null;
if (options.browserWS && options.browserWS != '') {
Expand All @@ -285,9 +300,10 @@ export async function initBrowser(
.launch({
headless: options.headless,
devtools: options.devtools,
args: options.browserArgs
? options.browserArgs
: [...puppeteerConfig.chromiumArgs],
args:
Array.isArray(options.browserArgs) && options.browserArgs.length
? options.browserArgs
: [...puppeteerConfig.chromiumArgs],
...options.puppeteerOptions,
...extras
})
Expand Down
6 changes: 6 additions & 0 deletions src/controllers/initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ export async function create(
welcomeScreen();
}

logger.info(
`Need help?: ${chalk.underline(
'https://web.whatsapp.com/send?phone=5511959389975&text=Hi! I need help on Venom!'
)}\n`
);

statusFind && statusFind('initBrowser', this.session);

// Initialize whatsapp
Expand Down

0 comments on commit 6541669

Please sign in to comment.