brave-real-launcher 1.2.31 → 1.2.33

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.
@@ -3,8 +3,8 @@ name: Chrome Launcher Sync & Publish
3
3
  on:
4
4
  # Automatic triggers
5
5
  schedule:
6
- # Weekly trigger - Every Monday at 6 AM UTC (11:30 AM IST)
7
- - cron: '0 6 * * 1'
6
+ # Daily trigger - Every day at 6 AM UTC (11:30 AM IST)
7
+ - cron: '0 6 * * *'
8
8
 
9
9
  # Manual trigger
10
10
  workflow_dispatch:
package/README.md CHANGED
@@ -2,14 +2,17 @@
2
2
 
3
3
  Launch Brave Browser with ease from Node.js. Based on [chrome-launcher](https://github.com/GoogleChrome/chrome-launcher) but specifically adapted for Brave Browser with additional features.
4
4
 
5
- ## Features
5
+ ## Features
6
6
 
7
7
  - 🦁 **Brave Browser Detection**: Automatically detects Brave Browser installations across all platforms
8
8
  - 🖥️ **Multi-Platform Support**: Linux (x64/ARM64), macOS (Intel/Apple Silicon), Windows (x64/ARM64)
9
9
  - 🐧 **Xvfb Support**: Built-in Xvfb support for headless operation on Linux
10
10
  - 🎯 **Launch Modes**: Headless mode, GUI mode, or automatic detection
11
11
  - 🔄 **Auto-Sync**: Automatically syncs with chrome-launcher updates while preserving Brave-specific features
12
- - 🛠️ **Full API Compatibility**: Drop-in replacement for chrome-launcher but for Brave
12
+ - 📦 **uBlock Origin**: Automatic download and loading of uBlock Origin ad blocker
13
+ - 🛡️ **Stealth Mode**: Anti-bot-detection capabilities for automation
14
+ - ⬇️ **Auto-Install**: Automatically install Brave if not present (Windows/Linux/macOS)
15
+ - 🔇 **P3A Disabled**: Private analytics notifications disabled by default
13
16
 
14
17
  ## Installation
15
18
 
@@ -22,18 +25,49 @@ npm install brave-real-launcher
22
25
  ```javascript
23
26
  const { launch } = require('brave-real-launcher');
24
27
 
25
- // Launch Brave in headless mode
28
+ // Basic launch
26
29
  const brave = await launch({
27
- braveFlags: ['--headless', '--disable-gpu'],
30
+ startingUrl: 'https://example.com',
28
31
  logLevel: 'info'
29
32
  });
30
33
 
31
34
  console.log('Brave is running on port', brave.port);
32
-
33
- // Kill Brave
34
35
  brave.kill();
35
36
  ```
36
37
 
38
+ ### With uBlock Origin Ad Blocker
39
+
40
+ ```javascript
41
+ const brave = await launch({
42
+ startingUrl: 'https://example.com',
43
+ autoLoadUBlock: true, // Auto-downloads and loads uBlock Origin
44
+ logLevel: 'info'
45
+ });
46
+
47
+ console.log('Extensions loaded:', brave.extensions);
48
+ ```
49
+
50
+ ### With Stealth Mode (Anti-Bot Detection)
51
+
52
+ ```javascript
53
+ const brave = await launch({
54
+ startingUrl: 'https://example.com',
55
+ enableStealth: true, // Enables stealth mode
56
+ autoLoadUBlock: true,
57
+ logLevel: 'info'
58
+ });
59
+ ```
60
+
61
+ ### Auto-Install Brave (if not present)
62
+
63
+ ```javascript
64
+ const brave = await launch({
65
+ startingUrl: 'https://example.com',
66
+ autoInstall: true, // Auto-installs Brave if not found
67
+ logLevel: 'info'
68
+ });
69
+ ```
70
+
37
71
  ## API
38
72
 
39
73
  ### `launch(options)`
@@ -41,115 +75,131 @@ brave.kill();
41
75
  Launches Brave Browser with the specified options.
42
76
 
43
77
  **Options:**
44
- - `bravePath?: string` - Path to Brave executable (auto-detected if not provided)
45
- - `braveFlags?: string[]` - Array of Brave flags to pass
46
- - `launchMode?: 'auto' | 'headless' | 'gui'` - Launch mode (default: 'auto')
47
- - `enableXvfb?: boolean` - Enable Xvfb on Linux (default: false)
48
- - `xvfbOptions?: XvfbOptions` - Xvfb configuration options
49
- - `port?: number` - Debug port (default: random)
50
- - `userDataDir?: string | boolean` - User data directory
51
- - `startingUrl?: string` - URL to navigate to on start
52
- - And more options compatible with chrome-launcher
78
+
79
+ | Option | Type | Default | Description |
80
+ |--------|------|---------|-------------|
81
+ | `bravePath` | `string` | auto-detected | Path to Brave executable |
82
+ | `braveFlags` | `string[]` | `[]` | Array of Brave flags to pass |
83
+ | `startingUrl` | `string` | `about:blank` | URL to navigate to on start |
84
+ | `port` | `number` | random | Debug port |
85
+ | `userDataDir` | `string\|boolean` | temp dir | User data directory |
86
+ | `launchMode` | `'auto'\|'headless'\|'gui'` | `'auto'` | Launch mode |
87
+ | `enableXvfb` | `boolean` | `false` | Enable Xvfb on Linux |
88
+ | `autoLoadUBlock` | `boolean` | `false` | Auto-load uBlock Origin |
89
+ | `enableStealth` | `boolean` | `false` | Enable stealth mode |
90
+ | `autoInstall` | `boolean` | `false` | Auto-install Brave if not found |
91
+ | `userAgent` | `string` | default | Custom user agent |
92
+ | `logLevel` | `'verbose'\|'info'\|'error'\|'silent'` | `'silent'` | Log level |
93
+
94
+ **Returns:** `LaunchedBrave` object with:
95
+ - `pid`: Process ID
96
+ - `port`: Debug port
97
+ - `process`: Child process
98
+ - `extensions`: Loaded extensions info
99
+ - `kill()`: Function to kill browser
53
100
 
54
101
  ### `getBravePath()`
55
102
 
56
103
  Returns the path to the Brave Browser executable.
57
104
 
58
- ### `XvfbManager`
105
+ ### `BraveInstaller`
59
106
 
60
- Manages Xvfb virtual display for headless environments.
107
+ Programmatic Brave installation:
61
108
 
62
109
  ```javascript
63
- const { XvfbManager } = require('brave-real-launcher');
110
+ const { BraveInstaller } = require('brave-real-launcher');
64
111
 
65
- const xvfb = new XvfbManager({
66
- display: ':99',
67
- width: 1920,
68
- height: 1080
69
- });
112
+ const installer = new BraveInstaller();
113
+ const result = await installer.install();
114
+
115
+ if (result.success) {
116
+ console.log('Installed at:', result.bravePath);
117
+ }
118
+ ```
119
+
120
+ ### `ExtensionManager`
70
121
 
71
- await xvfb.start();
72
- // ... use Brave
73
- await xvfb.stop();
122
+ Manage extensions:
123
+
124
+ ```javascript
125
+ const { ExtensionManager } = require('brave-real-launcher');
126
+
127
+ const manager = new ExtensionManager();
128
+ const ublock = await manager.getUBlockOrigin();
129
+ console.log('uBlock version:', ublock.version);
74
130
  ```
75
131
 
76
132
  ## Platform Support
77
133
 
78
- ### Linux
79
- - x64 and ARM64 architectures
80
- - Detects installations in standard paths: `/opt/brave.com/brave/`, `/usr/bin/brave-browser`, etc.
81
- - Supports Flatpak and Snap installations
82
- - Built-in Xvfb support for headless environments
134
+ ### Auto-Install Behavior
83
135
 
84
- ### macOS
85
- - Intel and Apple Silicon (M1/M2) support
86
- - Detects Brave Browser, Brave Browser Beta, Nightly, and Dev versions
87
- - Standard installation paths in `/Applications/`
136
+ | Platform | Method | Skip if Installed |
137
+ |----------|--------|-------------------|
138
+ | **Windows** | Downloads installer, runs silently | Yes |
139
+ | **Linux** | apt/dnf/yum/pacman | ✅ Yes |
140
+ | **macOS** | Downloads DMG, mounts & copies | ✅ Yes |
88
141
 
89
- ### Windows
90
- - x64 and ARM64 support
91
- - Registry-based detection
92
- - Standard installation paths in Program Files and Local AppData
142
+ ### Path Detection
93
143
 
94
- ## Environment Variables
144
+ | Platform | Detection Paths |
145
+ |----------|-----------------|
146
+ | **Windows** | `%LOCALAPPDATA%\BraveSoftware\...`, `%PROGRAMFILES%\...` |
147
+ | **Linux** | `/usr/bin/brave-browser`, `/opt/brave.com/brave/...`, Flatpak, Snap |
148
+ | **macOS** | `/Applications/Brave Browser.app/...` |
95
149
 
96
- - `BRAVE_PATH`: Path to Brave executable
97
- - `HEADLESS`: Force headless mode when set
98
- - `DISPLAY`: X11 display (Linux)
150
+ ## Testing
99
151
 
100
- ## Examples
152
+ ```bash
153
+ # Install dependencies
154
+ npm install
101
155
 
102
- ### Headless Mode with Xvfb
103
- ```javascript
104
- const brave = await launch({
105
- launchMode: 'headless',
106
- enableXvfb: true,
107
- xvfbOptions: { width: 1920, height: 1080 }
108
- });
109
- ```
156
+ # Build project
157
+ npm run build
110
158
 
111
- ### Custom Flags
112
- ```javascript
113
- const brave = await launch({
114
- braveFlags: [
115
- '--no-sandbox',
116
- '--disable-dev-shm-usage',
117
- '--disable-gpu'
118
- ]
119
- });
120
- ```
159
+ # Run tests
160
+ npm test
121
161
 
122
- ### Auto-Detection
123
- ```javascript
124
- const brave = await launch({
125
- launchMode: 'auto', // Automatically detects headless vs GUI environment
126
- logLevel: 'verbose'
127
- });
162
+ # Test Brave detection
163
+ npm run test:detection
164
+
165
+ # Test with uBlock Origin
166
+ node -e "const {launch} = require('./dist'); launch({autoLoadUBlock:true, startingUrl:'https://example.com', logLevel:'info'}).then(b => setTimeout(() => b.kill(), 5000))"
128
167
  ```
129
168
 
130
- ## Development
169
+ ## Environment Variables
170
+
171
+ | Variable | Description |
172
+ |----------|-------------|
173
+ | `BRAVE_PATH` | Path to Brave executable |
174
+ | `HEADLESS` | Force headless mode when set |
175
+ | `DISPLAY` | X11 display (Linux) |
131
176
 
132
- ### Building
177
+ ## Development
133
178
 
134
179
  ```bash
135
- npm run build
136
- ```
180
+ # Clone repository
181
+ git clone https://github.com/user/brave-real-launcher.git
182
+ cd brave-real-launcher
137
183
 
138
- ### Testing
184
+ # Install dependencies
185
+ npm install
139
186
 
140
- ```bash
141
- npm test
187
+ # Build
188
+ npm run build
189
+
190
+ # Run CI tests
191
+ npm run test:ci
142
192
  ```
143
193
 
144
194
  ## Auto-Sync with chrome-launcher
145
195
 
146
- This project automatically syncs with chrome-launcher updates while preserving Brave-specific functionality. The GitHub Action workflow:
196
+ This project automatically syncs with chrome-launcher updates while preserving Brave-specific functionality:
147
197
 
148
- - Checks for chrome-launcher updates daily
149
- - Automatically integrates compatible changes
150
- - Preserves Brave-specific browser detection and features
151
- - Runs comprehensive tests across all supported platforms
152
- - Publishes updated versions to npm
198
+ - Checks for chrome-launcher updates **daily**
199
+ - Automatically integrates compatible changes
200
+ - Preserves Brave-specific browser detection
201
+ - Runs comprehensive tests
202
+ - Publishes to npm automatically
153
203
 
154
204
  ## License
155
205
 
@@ -0,0 +1,57 @@
1
+ export interface InstallerOptions {
2
+ silent?: boolean;
3
+ downloadDir?: string;
4
+ channel?: 'release' | 'beta' | 'nightly';
5
+ }
6
+ export interface InstallResult {
7
+ success: boolean;
8
+ bravePath?: string;
9
+ error?: string;
10
+ }
11
+ export declare class BraveInstaller {
12
+ private silent;
13
+ private downloadDir;
14
+ private channel;
15
+ constructor(options?: InstallerOptions);
16
+ /**
17
+ * Install Brave browser on the current platform
18
+ */
19
+ install(): Promise<InstallResult>;
20
+ /**
21
+ * Install Brave on Windows
22
+ */
23
+ private installWindows;
24
+ /**
25
+ * Install Brave on Linux
26
+ */
27
+ private installLinux;
28
+ /**
29
+ * Install Brave on macOS
30
+ */
31
+ private installMacOS;
32
+ /**
33
+ * Download file from URL
34
+ */
35
+ private downloadFile;
36
+ /**
37
+ * Detect Linux package manager
38
+ */
39
+ private detectLinuxPackageManager;
40
+ /**
41
+ * Find Brave on Windows
42
+ */
43
+ private findBraveWindows;
44
+ /**
45
+ * Find Brave on Linux
46
+ */
47
+ private findBraveLinux;
48
+ /**
49
+ * Delay helper
50
+ */
51
+ private delay;
52
+ /**
53
+ * Check if Brave is installed
54
+ */
55
+ static isInstalled(): boolean;
56
+ }
57
+ export default BraveInstaller;