diff --git a/README.md b/README.md index be61cc402..e96f6c39a 100644 --- a/README.md +++ b/README.md @@ -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! + + ## Venom group support free on Telegram @@ -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 diff --git a/src/api/layers/host.layer.ts b/src/api/layers/host.layer.ts index 1445c309e..7b76042a7 100644 --- a/src/api/layers/host.layer.ts +++ b/src/api/layers/host.layer.ts @@ -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 diff --git a/src/config/create-config.ts b/src/config/create-config.ts index 3fb491fda..8b6351683 100644 --- a/src/config/create-config.ts +++ b/src/config/create-config.ts @@ -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 */ @@ -198,6 +202,7 @@ export const defaultOptions: CreateConfig = { logQR: true, browserWS: '', browserArgs: puppeteerConfig.chromiumArgs, + addBrowserArgs: [], puppeteerOptions: {}, disableSpins: false, disableWelcome: false, diff --git a/src/controllers/browser.ts b/src/controllers/browser.ts index 2cae736a2..9464eb31d 100644 --- a/src/controllers/browser.ts +++ b/src/controllers/browser.ts @@ -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 != '') { @@ -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 }) diff --git a/src/controllers/initializer.ts b/src/controllers/initializer.ts index fe9d05d94..c1bdfc97a 100644 --- a/src/controllers/initializer.ts +++ b/src/controllers/initializer.ts @@ -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