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.
- package/.github/workflows/chrome-launcher-sync.yml +2 -2
- package/README.md +131 -81
- package/dist/brave-installer.d.ts +57 -0
- package/dist/brave-installer.js +352 -0
- package/dist/brave-installer.mjs +323 -0
- package/dist/brave-launcher.d.ts +21 -0
- package/dist/brave-launcher.js +207 -15
- package/dist/brave-launcher.mjs +207 -15
- package/dist/extension-manager.d.ts +58 -0
- package/dist/extension-manager.js +333 -0
- package/dist/extension-manager.mjs +304 -0
- package/dist/flags.js +15 -1
- package/dist/flags.mjs +15 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +15 -2
- package/dist/index.mjs +7 -1
- package/dist/stealth-utils.d.ts +128 -0
- package/dist/stealth-utils.js +210 -0
- package/dist/stealth-utils.mjs +206 -0
- package/package.json +1 -1
- package/console.log(ESM build works!))' +0 -0
- package/workflow-test-report.md +0 -44
|
@@ -3,8 +3,8 @@ name: Chrome Launcher Sync & Publish
|
|
|
3
3
|
on:
|
|
4
4
|
# Automatic triggers
|
|
5
5
|
schedule:
|
|
6
|
-
#
|
|
7
|
-
- cron: '0 6 * *
|
|
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
|
-
-
|
|
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
|
-
//
|
|
28
|
+
// Basic launch
|
|
26
29
|
const brave = await launch({
|
|
27
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
### `
|
|
105
|
+
### `BraveInstaller`
|
|
59
106
|
|
|
60
|
-
|
|
107
|
+
Programmatic Brave installation:
|
|
61
108
|
|
|
62
109
|
```javascript
|
|
63
|
-
const {
|
|
110
|
+
const { BraveInstaller } = require('brave-real-launcher');
|
|
64
111
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
###
|
|
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
|
-
|
|
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
|
-
|
|
97
|
-
- `HEADLESS`: Force headless mode when set
|
|
98
|
-
- `DISPLAY`: X11 display (Linux)
|
|
150
|
+
## Testing
|
|
99
151
|
|
|
100
|
-
|
|
152
|
+
```bash
|
|
153
|
+
# Install dependencies
|
|
154
|
+
npm install
|
|
101
155
|
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
112
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
177
|
+
## Development
|
|
133
178
|
|
|
134
179
|
```bash
|
|
135
|
-
|
|
136
|
-
|
|
180
|
+
# Clone repository
|
|
181
|
+
git clone https://github.com/user/brave-real-launcher.git
|
|
182
|
+
cd brave-real-launcher
|
|
137
183
|
|
|
138
|
-
|
|
184
|
+
# Install dependencies
|
|
185
|
+
npm install
|
|
139
186
|
|
|
140
|
-
|
|
141
|
-
npm
|
|
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
|
|
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
|
|
151
|
-
- Runs comprehensive tests
|
|
152
|
-
- Publishes
|
|
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;
|