arn-browser 0.1.23 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arn-browser",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "A lightweight, browser autmation helper.",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -64,7 +64,7 @@ export interface ProxyServerOptions {
64
64
  */
65
65
  ip2LocationKey?: string;
66
66
 
67
- /** Retry delay in milliseconds between IP lookup attempts (default: 1500) */
67
+ /** Retry delay in milliseconds between IP lookup attempts (default: 1000) */
68
68
  retryDelayMs?: number;
69
69
 
70
70
  /** Enable verbose logging (default: false) */
@@ -143,6 +143,6 @@ export function fetchPublicIP(proxyUrl: string | null): Promise<GeoDetails | nul
143
143
  * Fetches proxy details (IP, country, city, timezone) with retries.
144
144
  * @param proxyUrl The proxy URL string. Pass `null` for local fallback.
145
145
  * @param apiKey Optional IP2Location API key.
146
- * @param retryDelayMs Delay between retries in ms (default: 1500).
146
+ * @param retryDelayMs Delay between retries in ms (default: 1000).
147
147
  */
148
148
  export function fetchProxyDetails(proxyUrl: string | null, apiKey?: string | null, retryDelayMs?: number): Promise<GeoDetails | null>;
@@ -110,7 +110,7 @@ export async function fetchPublicIP(proxyUrl) {
110
110
  * 1. If proxyUrl is provided -> Fetch Real Data (IP + Timezone).
111
111
  * 2. If proxyUrl is NULL/Undefined -> Return "Local" Mock immediately.
112
112
  */
113
- export async function fetchProxyDetails(proxyUrl, apiKey = null, retryDelayMs = 1500) {
113
+ export async function fetchProxyDetails(proxyUrl, apiKey = null, retryDelayMs = 1000) {
114
114
  // --- AUTOMATIC LOCAL FALLBACK ---
115
115
  if (!proxyUrl) {
116
116
  return {
@@ -121,9 +121,9 @@ export async function fetchProxyDetails(proxyUrl, apiKey = null, retryDelayMs =
121
121
  };
122
122
  }
123
123
 
124
- // --- EXTERNAL LOOKUP with retry (10 attempts) ---
124
+ // --- EXTERNAL LOOKUP with retry (5 attempts) ---
125
125
  const providers = ["IP-API", "IP2Location"];
126
- const MAX_RETRIES = 10;
126
+ const MAX_RETRIES = 5;
127
127
 
128
128
  for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
129
129
  for (const provider of providers) {
@@ -195,7 +195,7 @@ export async function startProxyServer({
195
195
  PROXY_2_HOSTS = [],
196
196
  NO_PROXY_HOSTS = [],
197
197
  ip2LocationKey = null,
198
- retryDelayMs = 1500,
198
+ retryDelayMs = 1000,
199
199
  debug = false,
200
200
  proxy_stats = true,
201
201
  host_stats = true,
@@ -384,7 +384,7 @@ async function braveLauncher({ profilePath, proxy, extraArgs, spoof_fingerprint,
384
384
  if (_launchLogs) console.log(`░░░░░ Starting Brave [${isPersistent ? "Persistent" : "Temp"}]: ${activePath}`);
385
385
 
386
386
  // ======================================================
387
- // Disable Brave Sidebar via Preferences
387
+ // Disable Brave Sidebar & P3A via Preferences + Local State
388
388
  // ======================================================
389
389
  const prefsFilePath = path.join(activePath, "Default", "Preferences");
390
390
  const prefsDir = path.dirname(prefsFilePath);
@@ -412,6 +412,27 @@ async function braveLauncher({ profilePath, proxy, extraArgs, spoof_fingerprint,
412
412
  console.warn("░░░░░ Could not modify Brave preferences:", e.message);
413
413
  }
414
414
 
415
+ // ======================================================
416
+ // Disable P3A analytics in Local State (root of profile dir)
417
+ // Brave stores P3A prefs in Local State, NOT Default/Preferences
418
+ // This suppresses "Brave uses completely private product analytics..." banner
419
+ // ======================================================
420
+ try {
421
+ const localStatePath = path.join(activePath, "Local State");
422
+ let localState = {};
423
+ if (fs.existsSync(localStatePath)) {
424
+ localState = JSON.parse(fs.readFileSync(localStatePath, "utf-8"));
425
+ }
426
+ if (!localState.brave) localState.brave = {};
427
+ if (!localState.brave.p3a) localState.brave.p3a = {};
428
+ localState.brave.p3a.enabled = false;
429
+ localState.brave.p3a.notice_acknowledged = true;
430
+
431
+ fs.writeFileSync(localStatePath, JSON.stringify(localState, null, 2), "utf-8");
432
+ } catch (e) {
433
+ console.warn("░░░░░ Could not modify Brave Local State:", e.message);
434
+ }
435
+
415
436
  const binaryPath = getBinaryPath("brave");
416
437
  const braveArgs = [
417
438
  "--disable-features=Translate,BraveRewards,BraveWallet,BraveNews,Sidebar,SidePanel,BraveNTPBrandedWallpaper,NTPBackgroundImages",