Sync update: 2026-05-18 15:46:42

This commit is contained in:
Hamza-Ayed
2026-05-18 15:46:42 +03:00
parent 82650b8c1f
commit 4c68fcc2b9

View File

@@ -121,22 +121,47 @@ function initWhatsApp() {
console.log('[WA] Initializing WhatsApp client using LocalAuth...'); console.log('[WA] Initializing WhatsApp client using LocalAuth...');
clientReady = false; clientReady = false;
const fs = require('fs');
const puppeteerConfig = {
headless: 'new',
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-accelerated-2d-canvas',
'--no-first-run',
'--no-zygote',
'--single-process',
'--disable-gpu',
],
};
const possiblePaths = [
process.env.CHROME_BIN,
'/usr/bin/chromium',
'/usr/bin/chromium-browser',
'/usr/bin/google-chrome',
'/usr/bin/google-chrome-stable'
];
let detectedPath = null;
for (const p of possiblePaths) {
if (p && fs.existsSync(p)) {
detectedPath = p;
break;
}
}
if (detectedPath) {
console.log(`[WA] Detected system chromium at: ${detectedPath}`);
puppeteerConfig.executablePath = detectedPath;
} else {
console.log('[WA] No system chromium found. Falling back to bundled Puppeteer chromium...');
}
waClient = new Client({ waClient = new Client({
authStrategy: new LocalAuth({ clientId: 'whatsapp-bridge' }), authStrategy: new LocalAuth({ clientId: 'whatsapp-bridge' }),
puppeteer: { puppeteer: puppeteerConfig,
executablePath: process.env.CHROME_BIN || '/usr/bin/chromium',
headless: 'new',
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-accelerated-2d-canvas',
'--no-first-run',
'--no-zygote',
'--single-process',
'--disable-gpu',
],
},
}); });
// QR Code received -> send to all WS clients // QR Code received -> send to all WS clients