From 5a4c95dad3f3cdbc7f4063249a0e54eefb708315 Mon Sep 17 00:00:00 2001 From: jonalan Date: Mon, 28 Oct 2024 21:38:28 -0300 Subject: [PATCH] feat: files corrections and config puppeter --- src/webpack/assets/help/inject-config.js | 4 --- src/webpack/assets/help/process-files.js | 14 ++++----- src/webpack/help/check-webpack.ts | 38 ------------------------ src/webpack/help/config-puppeter.ts | 8 ++--- 4 files changed, 11 insertions(+), 53 deletions(-) delete mode 100644 src/webpack/assets/help/inject-config.js delete mode 100644 src/webpack/help/check-webpack.ts diff --git a/src/webpack/assets/help/inject-config.js b/src/webpack/assets/help/inject-config.js deleted file mode 100644 index 2a80751..0000000 --- a/src/webpack/assets/help/inject-config.js +++ /dev/null @@ -1,4 +0,0 @@ -export const injectConfig = { - webpack: 'webpackChunkwhatsapp_web_client', - parasite: Math.random().toString(36).substring(7) -} \ No newline at end of file diff --git a/src/webpack/assets/help/process-files.js b/src/webpack/assets/help/process-files.js index b1c86e1..247e72a 100644 --- a/src/webpack/assets/help/process-files.js +++ b/src/webpack/assets/help/process-files.js @@ -8,16 +8,16 @@ export async function processFiles(chat, blobs) { }); await mediaCollection.processAttachments( - Debug.VERSION === '0.4.613' ? - blobs : blobs.map((blob) => { - return { - file: blob, - }; + return { + file: blob, + filename: blob.name, + mimetype: blob.type, + }; }), - chat, + true, chat - ); + ); return mediaCollection; } \ No newline at end of file diff --git a/src/webpack/help/check-webpack.ts b/src/webpack/help/check-webpack.ts deleted file mode 100644 index d60c4db..0000000 --- a/src/webpack/help/check-webpack.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Page } from 'puppeteer'; -import { sleep } from './index'; -declare global { - interface Window { - webpackChunkwhatsapp_web_client: any; - qtd_web_client: number; - } -} -export async function checkWebPack( - page: Page, - callback: (status: boolean) => void -): Promise { - const result = await page - .evaluate(() => { - window.qtd_web_client = 0; - }) - .catch(() => {}); - while (true) { - await page.waitForFunction('window.webpackChunkwhatsapp_web_client.length').catch(); - const result = await page - .evaluate(() => { - const webPack = window.webpackChunkwhatsapp_web_client.length; - const webPackLast = window.webpackChunkwhatsapp_web_client.length - 1; - if (!window.webpackChunkwhatsapp_web_client[webPackLast][0].includes("parasitesnake") && window.qtd_web_client !== webPack) { - console.log(window.webpackChunkwhatsapp_web_client); - window.qtd_web_client = webPack; - return true; - } - return false; - }) - .catch(() => { }); - if (result) { - callback && callback(true); - } - - await sleep(3000); - } -} diff --git a/src/webpack/help/config-puppeter.ts b/src/webpack/help/config-puppeter.ts index f46530d..2c33d90 100644 --- a/src/webpack/help/config-puppeter.ts +++ b/src/webpack/help/config-puppeter.ts @@ -1,8 +1,9 @@ export const puppeteerConfig = { whatsappUrl: 'https://web.whatsapp.com', useragentOverride: - 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36', + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3641.0 Safari/537.36', chromiumArgs: [ + '--disable-service-workers', '--no-zygote', '--log-level=3', '--disable-site-isolation-trials', @@ -27,9 +28,6 @@ export const puppeteerConfig = { '--disable-histogram-customizer', '--disable-gl-extensions', '--disable-composited-antialiasing', - // '--auto-open-devtools-for-tabs', - '--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36', - //// new '--disable-background-networking', '--enable-features=NetworkService,NetworkServiceInProcess', '--disable-background-timer-throttling', @@ -53,5 +51,7 @@ export const puppeteerConfig = { '--use-mock-keychain', '--enable-blink-features=IdleDetection', '--export-tagged-pdf', + `--hostname=test`, + 'about:blank', ], };