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,10 +121,8 @@ function initWhatsApp() {
console.log('[WA] Initializing WhatsApp client using LocalAuth...');
clientReady = false;
waClient = new Client({
authStrategy: new LocalAuth({ clientId: 'whatsapp-bridge' }),
puppeteer: {
executablePath: process.env.CHROME_BIN || '/usr/bin/chromium',
const fs = require('fs');
const puppeteerConfig = {
headless: 'new',
args: [
'--no-sandbox',
@@ -136,7 +134,34 @@ function initWhatsApp() {
'--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({
authStrategy: new LocalAuth({ clientId: 'whatsapp-bridge' }),
puppeteer: puppeteerConfig,
});
// QR Code received -> send to all WS clients