@roxybrowser/openapi 1.0.1
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/README.md +374 -0
- package/lib/browser/browser-creator.d.ts +58 -0
- package/lib/browser/browser-creator.d.ts.map +1 -0
- package/lib/browser/browser-creator.js +286 -0
- package/lib/browser/browser-creator.js.map +1 -0
- package/lib/browser/template-manager.d.ts +48 -0
- package/lib/browser/template-manager.d.ts.map +1 -0
- package/lib/browser/template-manager.js +324 -0
- package/lib/browser/template-manager.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +821 -0
- package/lib/index.js.map +1 -0
- package/lib/proxy/proxy-manager.d.ts +67 -0
- package/lib/proxy/proxy-manager.d.ts.map +1 -0
- package/lib/proxy/proxy-manager.js +278 -0
- package/lib/proxy/proxy-manager.js.map +1 -0
- package/lib/proxy/proxy-validator.d.ts +66 -0
- package/lib/proxy/proxy-validator.d.ts.map +1 -0
- package/lib/proxy/proxy-validator.js +273 -0
- package/lib/proxy/proxy-validator.js.map +1 -0
- package/lib/roxy-client.d.ts +83 -0
- package/lib/roxy-client.d.ts.map +1 -0
- package/lib/roxy-client.js +306 -0
- package/lib/roxy-client.js.map +1 -0
- package/lib/types.d.ts +371 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +36 -0
- package/lib/types.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Creator Service
|
|
3
|
+
*
|
|
4
|
+
* Handles browser creation with different complexity levels and configuration building
|
|
5
|
+
*/
|
|
6
|
+
export class BrowserCreator {
|
|
7
|
+
/**
|
|
8
|
+
* Convert simple parameters to full browser configuration
|
|
9
|
+
*/
|
|
10
|
+
static buildSimpleConfig(params) {
|
|
11
|
+
const config = {
|
|
12
|
+
workspaceId: params.workspaceId,
|
|
13
|
+
};
|
|
14
|
+
// Add optional basic fields
|
|
15
|
+
if (params.windowName)
|
|
16
|
+
config.windowName = params.windowName;
|
|
17
|
+
if (params.projectId)
|
|
18
|
+
config.projectId = params.projectId;
|
|
19
|
+
if (params.windowRemark)
|
|
20
|
+
config.windowRemark = params.windowRemark;
|
|
21
|
+
// Convert simple proxy parameters to ProxyInfo
|
|
22
|
+
if (params.proxyHost || params.proxyPort) {
|
|
23
|
+
config.proxyInfo = {
|
|
24
|
+
proxyMethod: 'custom',
|
|
25
|
+
proxyCategory: params.proxyType || 'HTTP',
|
|
26
|
+
protocol: params.proxyType || 'HTTP',
|
|
27
|
+
host: params.proxyHost,
|
|
28
|
+
port: params.proxyPort,
|
|
29
|
+
proxyUserName: params.proxyUserName,
|
|
30
|
+
proxyPassword: params.proxyPassword,
|
|
31
|
+
ipType: 'IPV4',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return config;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Convert standard parameters to full browser configuration
|
|
38
|
+
*/
|
|
39
|
+
static buildStandardConfig(params) {
|
|
40
|
+
const config = {
|
|
41
|
+
workspaceId: params.workspaceId,
|
|
42
|
+
};
|
|
43
|
+
// Add all standard fields
|
|
44
|
+
if (params.windowName)
|
|
45
|
+
config.windowName = params.windowName;
|
|
46
|
+
if (params.projectId)
|
|
47
|
+
config.projectId = params.projectId;
|
|
48
|
+
if (params.windowRemark)
|
|
49
|
+
config.windowRemark = params.windowRemark;
|
|
50
|
+
if (params.os)
|
|
51
|
+
config.os = params.os;
|
|
52
|
+
if (params.osVersion)
|
|
53
|
+
config.osVersion = params.osVersion;
|
|
54
|
+
if (params.coreVersion)
|
|
55
|
+
config.coreVersion = params.coreVersion;
|
|
56
|
+
if (params.defaultOpenUrl)
|
|
57
|
+
config.defaultOpenUrl = params.defaultOpenUrl;
|
|
58
|
+
// Add proxy configuration
|
|
59
|
+
if (params.proxyInfo) {
|
|
60
|
+
config.proxyInfo = params.proxyInfo;
|
|
61
|
+
}
|
|
62
|
+
// Build fingerprint configuration for common settings
|
|
63
|
+
if (params.openWidth || params.openHeight || params.language || params.timeZone) {
|
|
64
|
+
config.fingerInfo = {};
|
|
65
|
+
if (params.openWidth)
|
|
66
|
+
config.fingerInfo.openWidth = params.openWidth;
|
|
67
|
+
if (params.openHeight)
|
|
68
|
+
config.fingerInfo.openHeight = params.openHeight;
|
|
69
|
+
if (params.language) {
|
|
70
|
+
config.fingerInfo.isLanguageBaseIp = false;
|
|
71
|
+
config.fingerInfo.language = params.language;
|
|
72
|
+
}
|
|
73
|
+
if (params.timeZone) {
|
|
74
|
+
config.fingerInfo.isTimeZone = false;
|
|
75
|
+
config.fingerInfo.timeZone = params.timeZone;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return config;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Advanced configuration - pass through as-is
|
|
82
|
+
*/
|
|
83
|
+
static buildAdvancedConfig(params) {
|
|
84
|
+
return params;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Generate unique browser name
|
|
88
|
+
*/
|
|
89
|
+
static generateBrowserName(prefix, index) {
|
|
90
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
|
|
91
|
+
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
92
|
+
if (prefix && index !== undefined) {
|
|
93
|
+
return `${prefix}-${index + 1}-${timestamp}`;
|
|
94
|
+
}
|
|
95
|
+
else if (prefix) {
|
|
96
|
+
return `${prefix}-${timestamp}-${randomSuffix}`;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return `Browser-${timestamp}-${randomSuffix}`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Assign proxies from a list to multiple browser configurations
|
|
104
|
+
*/
|
|
105
|
+
static assignProxiesToConfigs(configs, proxyList) {
|
|
106
|
+
if (!proxyList.length) {
|
|
107
|
+
return configs;
|
|
108
|
+
}
|
|
109
|
+
return configs.map((config, index) => ({
|
|
110
|
+
...config,
|
|
111
|
+
proxyInfo: proxyList[index % proxyList.length], // Round-robin proxy assignment
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Validate browser configuration
|
|
116
|
+
*/
|
|
117
|
+
static validateConfig(config) {
|
|
118
|
+
const errors = [];
|
|
119
|
+
// Required fields
|
|
120
|
+
if (!config.workspaceId) {
|
|
121
|
+
errors.push('workspaceId is required');
|
|
122
|
+
}
|
|
123
|
+
// Proxy validation
|
|
124
|
+
if (config.proxyInfo) {
|
|
125
|
+
const proxy = config.proxyInfo;
|
|
126
|
+
if (proxy.proxyCategory !== 'noproxy') {
|
|
127
|
+
if (!proxy.host)
|
|
128
|
+
errors.push('Proxy host is required when proxy is enabled');
|
|
129
|
+
if (!proxy.port)
|
|
130
|
+
errors.push('Proxy port is required when proxy is enabled');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// OS version compatibility
|
|
134
|
+
if (config.os && config.osVersion) {
|
|
135
|
+
const validVersions = this.getValidOSVersions(config.os);
|
|
136
|
+
if (validVersions && !validVersions.includes(config.osVersion)) {
|
|
137
|
+
errors.push(`Invalid OS version '${config.osVersion}' for OS '${config.os}'`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
valid: errors.length === 0,
|
|
142
|
+
errors,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Get valid OS versions for a given operating system
|
|
147
|
+
*/
|
|
148
|
+
static getValidOSVersions(os) {
|
|
149
|
+
const osVersionMap = {
|
|
150
|
+
Windows: ['11', '10', '8', '7'],
|
|
151
|
+
macOS: [
|
|
152
|
+
'15.3.2', '15.3.1', '15.3', '15.2', '15.1', '15.0.1', '15.0',
|
|
153
|
+
'14.7.4', '14.7.3', '14.7.2', '14.7.1', '14.7', '14.6.1', '14.6',
|
|
154
|
+
'14.5', '14.4.1', '14.4', '14.3.1', '14.3', '14.2.1', '14.2', '14.1',
|
|
155
|
+
'13.7.4', '13.7.3', '13.7.2', '13.7.1', '13.7'
|
|
156
|
+
],
|
|
157
|
+
Android: ['14', '13', '12', '11', '10', '9'],
|
|
158
|
+
IOS: [
|
|
159
|
+
'18.2', '18.1', '18.0', '17.0', '16.6', '16.5', '16.4', '16.3', '16.2',
|
|
160
|
+
'16.1', '16.0', '15.7', '15.6', '15.5', '15.4', '15.3', '15.2', '15.1',
|
|
161
|
+
'15.0', '14.7', '14.6', '14.5', '14.4', '14.3', '14.2', '14.1', '14.0'
|
|
162
|
+
],
|
|
163
|
+
Linux: [], // Linux versions are more flexible, skip validation
|
|
164
|
+
};
|
|
165
|
+
return osVersionMap[os] || null;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Apply smart defaults to configuration
|
|
169
|
+
*/
|
|
170
|
+
static applyDefaults(config) {
|
|
171
|
+
const defaultConfig = {
|
|
172
|
+
os: 'Windows',
|
|
173
|
+
osVersion: '11',
|
|
174
|
+
coreVersion: '125',
|
|
175
|
+
searchEngine: 'Google',
|
|
176
|
+
// Default fingerprint settings
|
|
177
|
+
fingerInfo: {
|
|
178
|
+
isLanguageBaseIp: true,
|
|
179
|
+
isDisplayLanguageBaseIp: true,
|
|
180
|
+
isTimeZone: true,
|
|
181
|
+
position: 1,
|
|
182
|
+
isPositionBaseIp: true,
|
|
183
|
+
forbidAudio: true,
|
|
184
|
+
forbidImage: true,
|
|
185
|
+
forbidMedia: true,
|
|
186
|
+
openWidth: '1000',
|
|
187
|
+
openHeight: '1000',
|
|
188
|
+
openBookmarks: false,
|
|
189
|
+
positionSwitch: true,
|
|
190
|
+
isDisplayName: false,
|
|
191
|
+
syncBookmark: false,
|
|
192
|
+
syncHistory: false,
|
|
193
|
+
syncTab: true,
|
|
194
|
+
syncCookie: true,
|
|
195
|
+
syncExtensions: false,
|
|
196
|
+
syncPassword: true,
|
|
197
|
+
syncIndexedDb: false,
|
|
198
|
+
syncLocalStorage: false,
|
|
199
|
+
clearCacheFile: false,
|
|
200
|
+
clearCookie: false,
|
|
201
|
+
clearLocalStorage: false,
|
|
202
|
+
randomFingerprint: false,
|
|
203
|
+
forbidSavePassword: true,
|
|
204
|
+
stopOpenNet: false,
|
|
205
|
+
stopOpenIP: false,
|
|
206
|
+
stopOpenPosition: false,
|
|
207
|
+
openWorkbench: 1,
|
|
208
|
+
resolutionType: false,
|
|
209
|
+
fontType: false,
|
|
210
|
+
webRTC: 2,
|
|
211
|
+
webGL: true,
|
|
212
|
+
webGLInfo: true,
|
|
213
|
+
webGpu: 'webgl',
|
|
214
|
+
canvas: true,
|
|
215
|
+
audioContext: true,
|
|
216
|
+
speechVoices: true,
|
|
217
|
+
doNotTrack: true,
|
|
218
|
+
clientRects: true,
|
|
219
|
+
deviceInfo: true,
|
|
220
|
+
deviceNameSwitch: true,
|
|
221
|
+
macInfo: true,
|
|
222
|
+
disableSsl: false,
|
|
223
|
+
portScanProtect: true,
|
|
224
|
+
useGpu: true,
|
|
225
|
+
sandboxPermission: false,
|
|
226
|
+
},
|
|
227
|
+
// Default proxy settings
|
|
228
|
+
proxyInfo: {
|
|
229
|
+
proxyMethod: 'custom',
|
|
230
|
+
proxyCategory: 'noproxy',
|
|
231
|
+
ipType: 'IPV4',
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
// Deep merge configuration with defaults
|
|
235
|
+
const result = { ...defaultConfig, ...config };
|
|
236
|
+
// Merge fingerInfo and proxyInfo specifically
|
|
237
|
+
if (defaultConfig.fingerInfo && config.fingerInfo) {
|
|
238
|
+
result.fingerInfo = { ...defaultConfig.fingerInfo, ...config.fingerInfo };
|
|
239
|
+
}
|
|
240
|
+
if (defaultConfig.proxyInfo && config.proxyInfo) {
|
|
241
|
+
result.proxyInfo = { ...defaultConfig.proxyInfo, ...config.proxyInfo };
|
|
242
|
+
}
|
|
243
|
+
return result;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Create multiple browser configuration objects from template parameters
|
|
247
|
+
*/
|
|
248
|
+
static buildConfigsFromTemplate(params, templateConfig) {
|
|
249
|
+
const count = params.count || 1;
|
|
250
|
+
const configs = [];
|
|
251
|
+
for (let i = 0; i < count; i++) {
|
|
252
|
+
const baseConfig = {
|
|
253
|
+
workspaceId: params.workspaceId,
|
|
254
|
+
projectId: params.projectId,
|
|
255
|
+
windowName: this.generateBrowserName(params.namePrefix, i),
|
|
256
|
+
...templateConfig,
|
|
257
|
+
...params.customConfig,
|
|
258
|
+
};
|
|
259
|
+
// Apply defaults and validate
|
|
260
|
+
const config = this.applyDefaults(baseConfig);
|
|
261
|
+
configs.push(config);
|
|
262
|
+
}
|
|
263
|
+
// Assign proxies if provided
|
|
264
|
+
if (params.proxyList && params.proxyList.length > 0) {
|
|
265
|
+
return this.assignProxiesToConfigs(configs, params.proxyList);
|
|
266
|
+
}
|
|
267
|
+
return configs;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Batch validate multiple configurations
|
|
271
|
+
*/
|
|
272
|
+
static validateConfigs(configs) {
|
|
273
|
+
const allErrors = [];
|
|
274
|
+
configs.forEach((config, index) => {
|
|
275
|
+
const validation = this.validateConfig(config);
|
|
276
|
+
if (!validation.valid) {
|
|
277
|
+
allErrors.push({ index, errors: validation.errors });
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
return {
|
|
281
|
+
valid: allErrors.length === 0,
|
|
282
|
+
errors: allErrors,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=browser-creator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-creator.js","sourceRoot":"","sources":["../../src/browser/browser-creator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,MAAM,OAAO,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,MAAiC;QACxD,MAAM,MAAM,GAAwB;YAClC,WAAW,EAAE,MAAM,CAAC,W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,eAAe,CAAC,OAA8B;QAInD,MAAM,SAAS,GAA+C,EAAE,CAAC;QAEjE,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAChC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC/C,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;gBACtB,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;YACvD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,KAAK,EAAE,SAAS,CAAC,MAAM,KAAK,CAAC;YAC7B,MAAM,EAAE,SAAS;SAClB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Template Manager
|
|
3
|
+
*
|
|
4
|
+
* Provides predefined browser templates for common use cases
|
|
5
|
+
*/
|
|
6
|
+
import { BrowserTemplate, BrowserTemplateType, BrowserCreateConfig, ProxyInfo } from '../types.js';
|
|
7
|
+
export declare class TemplateManager {
|
|
8
|
+
private static templates;
|
|
9
|
+
/**
|
|
10
|
+
* Get available template names and descriptions
|
|
11
|
+
*/
|
|
12
|
+
static getAvailableTemplates(): Array<{
|
|
13
|
+
name: BrowserTemplateType;
|
|
14
|
+
description: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Get template configuration by name
|
|
18
|
+
*/
|
|
19
|
+
static getTemplate(templateName: BrowserTemplateType): BrowserTemplate | null;
|
|
20
|
+
/**
|
|
21
|
+
* Get template configuration merged with custom overrides
|
|
22
|
+
*/
|
|
23
|
+
static getTemplateConfig(templateName: BrowserTemplateType, customConfig?: Partial<BrowserCreateConfig>): Partial<BrowserCreateConfig>;
|
|
24
|
+
/**
|
|
25
|
+
* Create a custom template
|
|
26
|
+
*/
|
|
27
|
+
static createCustomTemplate(name: string, description: string, config: Partial<BrowserCreateConfig>): BrowserTemplate;
|
|
28
|
+
/**
|
|
29
|
+
* Get template optimized for specific proxy configuration
|
|
30
|
+
*/
|
|
31
|
+
static getTemplateForProxy(templateName: BrowserTemplateType, proxyInfo: ProxyInfo): Partial<BrowserCreateConfig>;
|
|
32
|
+
/**
|
|
33
|
+
* Get template optimized for specific country/region
|
|
34
|
+
*/
|
|
35
|
+
static getTemplateForRegion(templateName: BrowserTemplateType, countryCode: string, language?: string): Partial<BrowserCreateConfig>;
|
|
36
|
+
/**
|
|
37
|
+
* Get regional settings by country code
|
|
38
|
+
*/
|
|
39
|
+
private static getRegionalSettings;
|
|
40
|
+
/**
|
|
41
|
+
* Validate template configuration
|
|
42
|
+
*/
|
|
43
|
+
static validateTemplate(template: BrowserTemplate): {
|
|
44
|
+
valid: boolean;
|
|
45
|
+
errors: string[];
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=template-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-manager.d.ts","sourceRoot":"","sources":["../../src/browser/template-manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,SAAS,EAEV,MAAM,aAAa,CAAC;AAErB,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,SAAS,CAqLtB;IAEF;;OAEG;IACH,MAAM,CAAC,qBAAqB,IAAI,KAAK,CAAC;QAAE,IAAI,EAAE,mBAAmB,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAOzF;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,mBAAmB,GAAG,eAAe,GAAG,IAAI;IAI7E;;OAEG;IACH,MAAM,CAAC,iBAAiB,CACtB,YAAY,EAAE,mBAAmB,EACjC,YAAY,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAC1C,OAAO,CAAC,mBAAmB,CAAC;IAsC/B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CACzB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACnC,eAAe;IAQlB;;OAEG;IACH,MAAM,CAAC,mBAAmB,CACxB,YAAY,EAAE,mBAAmB,EACjC,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,mBAAmB,CAAC;IAuB/B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CACzB,YAAY,EAAE,mBAAmB,EACjC,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC;IAoB/B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAqBlC;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;CAsBzF"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Template Manager
|
|
3
|
+
*
|
|
4
|
+
* Provides predefined browser templates for common use cases
|
|
5
|
+
*/
|
|
6
|
+
export class TemplateManager {
|
|
7
|
+
static templates = {
|
|
8
|
+
gmail: {
|
|
9
|
+
name: 'gmail',
|
|
10
|
+
description: 'Optimized for Gmail and Google services automation',
|
|
11
|
+
defaultConfig: {
|
|
12
|
+
windowName: 'Gmail Browser',
|
|
13
|
+
os: 'Windows',
|
|
14
|
+
osVersion: '11',
|
|
15
|
+
coreVersion: '125',
|
|
16
|
+
searchEngine: 'Google',
|
|
17
|
+
defaultOpenUrl: ['https://gmail.com'],
|
|
18
|
+
fingerInfo: {
|
|
19
|
+
language: 'en-US',
|
|
20
|
+
isLanguageBaseIp: false,
|
|
21
|
+
displayLanguage: 'en-US',
|
|
22
|
+
isDisplayLanguageBaseIp: false,
|
|
23
|
+
openWidth: '1400',
|
|
24
|
+
openHeight: '900',
|
|
25
|
+
syncCookie: true,
|
|
26
|
+
syncPassword: true,
|
|
27
|
+
syncTab: true,
|
|
28
|
+
clearCacheFile: false,
|
|
29
|
+
clearCookie: false,
|
|
30
|
+
randomFingerprint: true,
|
|
31
|
+
forbidSavePassword: false, // Allow password saving for Gmail
|
|
32
|
+
webRTC: 1, // Real WebRTC for Google services
|
|
33
|
+
canvas: true,
|
|
34
|
+
audioContext: true,
|
|
35
|
+
doNotTrack: false, // Don't use DNT for better compatibility
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
facebook: {
|
|
40
|
+
name: 'facebook',
|
|
41
|
+
description: 'Optimized for Facebook and Meta platform automation',
|
|
42
|
+
defaultConfig: {
|
|
43
|
+
windowName: 'Facebook Browser',
|
|
44
|
+
os: 'Windows',
|
|
45
|
+
osVersion: '11',
|
|
46
|
+
coreVersion: '125',
|
|
47
|
+
searchEngine: 'Google',
|
|
48
|
+
defaultOpenUrl: ['https://facebook.com'],
|
|
49
|
+
fingerInfo: {
|
|
50
|
+
language: 'en-US',
|
|
51
|
+
isLanguageBaseIp: false,
|
|
52
|
+
displayLanguage: 'en-US',
|
|
53
|
+
isDisplayLanguageBaseIp: false,
|
|
54
|
+
openWidth: '1366',
|
|
55
|
+
openHeight: '768',
|
|
56
|
+
syncCookie: true,
|
|
57
|
+
syncPassword: true,
|
|
58
|
+
syncTab: true,
|
|
59
|
+
clearCacheFile: false,
|
|
60
|
+
clearCookie: false,
|
|
61
|
+
randomFingerprint: true,
|
|
62
|
+
forbidSavePassword: false,
|
|
63
|
+
webRTC: 1, // Real WebRTC for video calls
|
|
64
|
+
canvas: true,
|
|
65
|
+
audioContext: true,
|
|
66
|
+
deviceInfo: true, // Allow media devices
|
|
67
|
+
forbidAudio: false, // Allow audio for Facebook features
|
|
68
|
+
forbidMedia: false, // Allow video for Facebook features
|
|
69
|
+
doNotTrack: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
ecommerce: {
|
|
74
|
+
name: 'ecommerce',
|
|
75
|
+
description: 'Optimized for e-commerce platforms and shopping automation',
|
|
76
|
+
defaultConfig: {
|
|
77
|
+
windowName: 'Shopping Browser',
|
|
78
|
+
os: 'Windows',
|
|
79
|
+
osVersion: '11',
|
|
80
|
+
coreVersion: '125',
|
|
81
|
+
searchEngine: 'Google',
|
|
82
|
+
defaultOpenUrl: ['https://amazon.com'],
|
|
83
|
+
fingerInfo: {
|
|
84
|
+
language: 'en-US',
|
|
85
|
+
isLanguageBaseIp: false,
|
|
86
|
+
displayLanguage: 'en-US',
|
|
87
|
+
isDisplayLanguageBaseIp: false,
|
|
88
|
+
openWidth: '1920',
|
|
89
|
+
openHeight: '1080',
|
|
90
|
+
syncCookie: true,
|
|
91
|
+
syncPassword: true,
|
|
92
|
+
syncTab: false, // Don't sync tabs for privacy
|
|
93
|
+
clearCacheFile: true, // Clear cache for fresh sessions
|
|
94
|
+
clearCookie: false,
|
|
95
|
+
randomFingerprint: true,
|
|
96
|
+
forbidSavePassword: true, // Security for shopping
|
|
97
|
+
webRTC: 2, // Disable WebRTC for privacy
|
|
98
|
+
canvas: true,
|
|
99
|
+
audioContext: true,
|
|
100
|
+
deviceInfo: false, // Limit device fingerprinting
|
|
101
|
+
doNotTrack: true, // Enable DNT for privacy
|
|
102
|
+
portScanProtect: true, // Extra security
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
social_media: {
|
|
107
|
+
name: 'social_media',
|
|
108
|
+
description: 'General social media platforms automation',
|
|
109
|
+
defaultConfig: {
|
|
110
|
+
windowName: 'Social Media Browser',
|
|
111
|
+
os: 'Windows',
|
|
112
|
+
osVersion: '11',
|
|
113
|
+
coreVersion: '125',
|
|
114
|
+
searchEngine: 'Google',
|
|
115
|
+
defaultOpenUrl: ['https://twitter.com'],
|
|
116
|
+
fingerInfo: {
|
|
117
|
+
language: 'en-US',
|
|
118
|
+
isLanguageBaseIp: true, // Follow IP for better geo-targeting
|
|
119
|
+
displayLanguage: 'en-US',
|
|
120
|
+
isDisplayLanguageBaseIp: true,
|
|
121
|
+
isTimeZone: true, // Follow IP timezone
|
|
122
|
+
openWidth: '1200',
|
|
123
|
+
openHeight: '800',
|
|
124
|
+
syncCookie: true,
|
|
125
|
+
syncPassword: false, // Don't save passwords
|
|
126
|
+
syncTab: true,
|
|
127
|
+
clearCacheFile: false,
|
|
128
|
+
clearCookie: false,
|
|
129
|
+
randomFingerprint: true,
|
|
130
|
+
forbidSavePassword: true,
|
|
131
|
+
webRTC: 0, // Replace WebRTC
|
|
132
|
+
canvas: true,
|
|
133
|
+
audioContext: true,
|
|
134
|
+
deviceInfo: true,
|
|
135
|
+
forbidAudio: false,
|
|
136
|
+
forbidMedia: false,
|
|
137
|
+
doNotTrack: false,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
general: {
|
|
142
|
+
name: 'general',
|
|
143
|
+
description: 'General-purpose browser configuration',
|
|
144
|
+
defaultConfig: {
|
|
145
|
+
windowName: 'General Browser',
|
|
146
|
+
os: 'Windows',
|
|
147
|
+
osVersion: '11',
|
|
148
|
+
coreVersion: '125',
|
|
149
|
+
searchEngine: 'Google',
|
|
150
|
+
fingerInfo: {
|
|
151
|
+
language: 'en-US',
|
|
152
|
+
isLanguageBaseIp: true,
|
|
153
|
+
displayLanguage: 'en-US',
|
|
154
|
+
isDisplayLanguageBaseIp: true,
|
|
155
|
+
isTimeZone: true,
|
|
156
|
+
openWidth: '1024',
|
|
157
|
+
openHeight: '768',
|
|
158
|
+
syncCookie: true,
|
|
159
|
+
syncPassword: true,
|
|
160
|
+
syncTab: true,
|
|
161
|
+
clearCacheFile: false,
|
|
162
|
+
clearCookie: false,
|
|
163
|
+
randomFingerprint: false, // Keep consistent fingerprint
|
|
164
|
+
forbidSavePassword: true,
|
|
165
|
+
webRTC: 2, // Disable for privacy
|
|
166
|
+
canvas: true,
|
|
167
|
+
audioContext: true,
|
|
168
|
+
deviceInfo: true,
|
|
169
|
+
doNotTrack: true,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
custom: {
|
|
174
|
+
name: 'custom',
|
|
175
|
+
description: 'Empty template for custom configuration',
|
|
176
|
+
defaultConfig: {
|
|
177
|
+
windowName: 'Custom Browser',
|
|
178
|
+
os: 'Windows',
|
|
179
|
+
osVersion: '11',
|
|
180
|
+
coreVersion: '125',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Get available template names and descriptions
|
|
186
|
+
*/
|
|
187
|
+
static getAvailableTemplates() {
|
|
188
|
+
return Object.values(this.templates).map(template => ({
|
|
189
|
+
name: template.name,
|
|
190
|
+
description: template.description,
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get template configuration by name
|
|
195
|
+
*/
|
|
196
|
+
static getTemplate(templateName) {
|
|
197
|
+
return this.templates[templateName] || null;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Get template configuration merged with custom overrides
|
|
201
|
+
*/
|
|
202
|
+
static getTemplateConfig(templateName, customConfig) {
|
|
203
|
+
const template = this.getTemplate(templateName);
|
|
204
|
+
if (!template) {
|
|
205
|
+
throw new Error(`Template '${templateName}' not found`);
|
|
206
|
+
}
|
|
207
|
+
if (!customConfig) {
|
|
208
|
+
return template.defaultConfig;
|
|
209
|
+
}
|
|
210
|
+
// Deep merge template config with custom config
|
|
211
|
+
const mergedConfig = { ...template.defaultConfig, ...customConfig };
|
|
212
|
+
// Special handling for nested objects
|
|
213
|
+
if (template.defaultConfig.fingerInfo && customConfig.fingerInfo) {
|
|
214
|
+
mergedConfig.fingerInfo = {
|
|
215
|
+
...template.defaultConfig.fingerInfo,
|
|
216
|
+
...customConfig.fingerInfo,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
if (template.defaultConfig.proxyInfo && customConfig.proxyInfo) {
|
|
220
|
+
mergedConfig.proxyInfo = {
|
|
221
|
+
...template.defaultConfig.proxyInfo,
|
|
222
|
+
...customConfig.proxyInfo,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
if (template.defaultConfig.windowPlatformList && customConfig.windowPlatformList) {
|
|
226
|
+
mergedConfig.windowPlatformList = [
|
|
227
|
+
...(template.defaultConfig.windowPlatformList || []),
|
|
228
|
+
...(customConfig.windowPlatformList || []),
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
return mergedConfig;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Create a custom template
|
|
235
|
+
*/
|
|
236
|
+
static createCustomTemplate(name, description, config) {
|
|
237
|
+
return {
|
|
238
|
+
name: 'custom',
|
|
239
|
+
description,
|
|
240
|
+
defaultConfig: config,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get template optimized for specific proxy configuration
|
|
245
|
+
*/
|
|
246
|
+
static getTemplateForProxy(templateName, proxyInfo) {
|
|
247
|
+
const baseConfig = this.getTemplateConfig(templateName);
|
|
248
|
+
// Apply proxy-specific optimizations
|
|
249
|
+
const optimizedConfig = { ...baseConfig };
|
|
250
|
+
// If using proxy, adjust some settings for better anonymity
|
|
251
|
+
if (proxyInfo.proxyCategory !== 'noproxy') {
|
|
252
|
+
optimizedConfig.fingerInfo = {
|
|
253
|
+
...optimizedConfig.fingerInfo,
|
|
254
|
+
isLanguageBaseIp: true, // Follow proxy IP for language
|
|
255
|
+
isDisplayLanguageBaseIp: true,
|
|
256
|
+
isTimeZone: true, // Follow proxy timezone
|
|
257
|
+
isPositionBaseIp: true, // Follow proxy geolocation
|
|
258
|
+
webRTC: 2, // Disable WebRTC to prevent IP leaks
|
|
259
|
+
doNotTrack: true, // Enable DNT for privacy
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
optimizedConfig.proxyInfo = proxyInfo;
|
|
263
|
+
return optimizedConfig;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get template optimized for specific country/region
|
|
267
|
+
*/
|
|
268
|
+
static getTemplateForRegion(templateName, countryCode, language) {
|
|
269
|
+
const baseConfig = this.getTemplateConfig(templateName);
|
|
270
|
+
const optimizedConfig = { ...baseConfig };
|
|
271
|
+
// Regional optimizations
|
|
272
|
+
const regionalSettings = this.getRegionalSettings(countryCode);
|
|
273
|
+
optimizedConfig.fingerInfo = {
|
|
274
|
+
...optimizedConfig.fingerInfo,
|
|
275
|
+
isLanguageBaseIp: false,
|
|
276
|
+
language: language || regionalSettings.language,
|
|
277
|
+
isDisplayLanguageBaseIp: false,
|
|
278
|
+
displayLanguage: language || regionalSettings.language,
|
|
279
|
+
isTimeZone: false,
|
|
280
|
+
timeZone: regionalSettings.timeZone,
|
|
281
|
+
};
|
|
282
|
+
return optimizedConfig;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get regional settings by country code
|
|
286
|
+
*/
|
|
287
|
+
static getRegionalSettings(countryCode) {
|
|
288
|
+
const regionalMap = {
|
|
289
|
+
US: { language: 'en-US', timeZone: 'GMT-5:00 America/New_York' },
|
|
290
|
+
CN: { language: 'zh-CN', timeZone: 'GMT+8:00 Asia/Shanghai' },
|
|
291
|
+
JP: { language: 'ja-JP', timeZone: 'GMT+9:00 Asia/Tokyo' },
|
|
292
|
+
KR: { language: 'ko-KR', timeZone: 'GMT+9:00 Asia/Seoul' },
|
|
293
|
+
DE: { language: 'de-DE', timeZone: 'GMT+1:00 Europe/Berlin' },
|
|
294
|
+
FR: { language: 'fr-FR', timeZone: 'GMT+1:00 Europe/Paris' },
|
|
295
|
+
GB: { language: 'en-GB', timeZone: 'GMT+0:00 Europe/London' },
|
|
296
|
+
RU: { language: 'ru-RU', timeZone: 'GMT+3:00 Europe/Moscow' },
|
|
297
|
+
BR: { language: 'pt-BR', timeZone: 'GMT-3:00 America/Sao_Paulo' },
|
|
298
|
+
IN: { language: 'hi-IN', timeZone: 'GMT+5:30 Asia/Kolkata' },
|
|
299
|
+
// Add more regions as needed
|
|
300
|
+
};
|
|
301
|
+
return regionalMap[countryCode.toUpperCase()] || regionalMap.US;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Validate template configuration
|
|
305
|
+
*/
|
|
306
|
+
static validateTemplate(template) {
|
|
307
|
+
const errors = [];
|
|
308
|
+
if (!template.name) {
|
|
309
|
+
errors.push('Template name is required');
|
|
310
|
+
}
|
|
311
|
+
if (!template.description) {
|
|
312
|
+
errors.push('Template description is required');
|
|
313
|
+
}
|
|
314
|
+
if (!template.defaultConfig) {
|
|
315
|
+
errors.push('Template default configuration is required');
|
|
316
|
+
}
|
|
317
|
+
// Additional validation can be added here
|
|
318
|
+
return {
|
|
319
|
+
valid: errors.length === 0,
|
|
320
|
+
errors,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=template-manager.js.map
|