From 6d77c872f2e38fd643d45479387bac68f9f2c2b9 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Wed, 6 Aug 2025 06:33:21 +0400 Subject: [PATCH] refactor: only perform geoip lookup if the required flag is passed --- nodecar/src/camoufox-launcher.ts | 7 +++---- nodecar/src/index.ts | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/nodecar/src/camoufox-launcher.ts b/nodecar/src/camoufox-launcher.ts index 7e8ac14..8a62f7e 100644 --- a/nodecar/src/camoufox-launcher.ts +++ b/nodecar/src/camoufox-launcher.ts @@ -465,9 +465,7 @@ export async function generateCamoufoxConfig( options: GenerateConfigOptions, ): Promise { try { - // Build launch options const launchOpts: LaunchOptions = { - // Always set these defaults headless: false, i_know_what_im_doing: true, config: { @@ -476,8 +474,9 @@ export async function generateCamoufoxConfig( }, }; - // Always set geoip and blocking options - launchOpts.geoip = options.geoip !== undefined ? options.geoip : true; + if (options.geoip !== undefined) { + launchOpts.geoip = options.geoip; + } if (options.blockImages) { launchOpts.block_images = true; diff --git a/nodecar/src/index.ts b/nodecar/src/index.ts index fd61353..f9fffb4 100644 --- a/nodecar/src/index.ts +++ b/nodecar/src/index.ts @@ -200,10 +200,8 @@ program // Security options if (options.disableCoop) camoufoxOptions.disable_coop = true; - // Geolocation - always enable geoip for proper spoofing if (options.geoip) { - camoufoxOptions.geoip = - options.geoip === "auto" ? true : (options.geoip as string); + camoufoxOptions.geoip = true; } if (options.latitude && options.longitude) {