From d2ceeaadc45b649f3f13a577703259765b5515e2 Mon Sep 17 00:00:00 2001 From: Renato Alcara Date: Mon, 2 Mar 2026 15:03:41 -0300 Subject: [PATCH] feat: change default browser to Android (SMB_ANDROID) (#252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add connection and pair code presentation logs Single-line logs showing how the lib presents to WhatsApp: - 📱/🖥️ Connection: phone number, platform, device, type - 🔗 Pair code: companion platform, android override status --- src/Defaults/index.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Defaults/index.ts b/src/Defaults/index.ts index 3611d3d1..7f7a140d 100644 --- a/src/Defaults/index.ts +++ b/src/Defaults/index.ts @@ -58,18 +58,25 @@ const SIX_HOURS_MS = 6 * 60 * 60 * 1000 /** * Resolves the default browser tuple from the BAILEYS_BROWSER env var. - * 'android' → Browsers.android('14') - * 'android:15' → Browsers.android('15') - * unset / other → Browsers.macOS('Chrome') + * Default: Android companion (SMB_ANDROID) — matches upstream PR #2201. + * Pair code auto-detects Android and falls back to Chrome in socket.ts. + * + * unset / 'android' → Browsers.android('14') + * 'android:15' → Browsers.android('15') + * 'chrome' / 'macos' → Browsers.macOS('Chrome') */ const resolveDefaultBrowser = (): [string, string, string] => { const env = process.env.BAILEYS_BROWSER?.trim().toLowerCase() - if (env?.startsWith('android')) { + if (env === 'chrome' || env === 'macos') { + return Browsers.macOS('Chrome') + } + + if (env?.startsWith('android:')) { const apiLevel = env.split(':')[1] || '14' return Browsers.android(apiLevel) } - return Browsers.macOS('Chrome') + return Browsers.android('14') } export const DEFAULT_CONNECTION_CONFIG: SocketConfig = {