gologin 1.0.43 → 1.0.46
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/browser-checker.js +1 -1
- package/examples/example-startremote.js +25 -0
- package/examples/example-stopremote.js +20 -0
- package/gologin.js +28 -8
- package/package.json +1 -1
package/browser-checker.js
CHANGED
|
@@ -53,7 +53,7 @@ class BrowserChecker {
|
|
|
53
53
|
executableFilePath = path.join(this.#browserPath, 'orbita-browser', 'chrome.exe');
|
|
54
54
|
}
|
|
55
55
|
this.#executableFilePath = executableFilePath;
|
|
56
|
-
console.log('executableFilePath:', executableFilePath);
|
|
56
|
+
// console.log('executableFilePath:', executableFilePath);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
async checkBrowser(autoUpdateBrowser = false) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Usage example: in the terminal enter
|
|
2
|
+
// node example-startremote.js yU0token yU0Pr0f1leiD
|
|
3
|
+
|
|
4
|
+
// your token api (located in the settings, api)
|
|
5
|
+
// https://github.com/gologinapp/gologin#usage
|
|
6
|
+
const GOLOGIN_API_TOKEN = process.argv[2];
|
|
7
|
+
// your profile id
|
|
8
|
+
const GOLOGIN_PROFILE_ID = process.argv[3];
|
|
9
|
+
|
|
10
|
+
const GoLogin = require('../gologin');
|
|
11
|
+
|
|
12
|
+
(async () =>{
|
|
13
|
+
const GL = new GoLogin({
|
|
14
|
+
token: GOLOGIN_API_TOKEN,
|
|
15
|
+
profile_id: GOLOGIN_PROFILE_ID,
|
|
16
|
+
});
|
|
17
|
+
// connection of the remote work method
|
|
18
|
+
const {status, wsUrl} = await GL.startRemote();
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
GOLOGIN_PROFILE_CLOUD_URL = wsUrl.split('/')[2]
|
|
22
|
+
console.log('Done! Launch web browser and navigate to URL:', GOLOGIN_PROFILE_CLOUD_URL);
|
|
23
|
+
})();
|
|
24
|
+
|
|
25
|
+
// after running the script, the url will appear on the terminal
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Usage example: in the terminal enter
|
|
2
|
+
// node example-stopremote.js yU0token yU0Pr0f1leiD
|
|
3
|
+
|
|
4
|
+
// your token api (located in the settings, api)
|
|
5
|
+
// https://github.com/gologinapp/gologin#usage
|
|
6
|
+
const GOLOGIN_API_TOKEN = process.argv[2];
|
|
7
|
+
// your profile id
|
|
8
|
+
const GOLOGIN_PROFILE_ID = process.argv[3];
|
|
9
|
+
|
|
10
|
+
const GoLogin = require('../gologin');
|
|
11
|
+
|
|
12
|
+
(async () =>{
|
|
13
|
+
const GL = new GoLogin({
|
|
14
|
+
token: GOLOGIN_API_TOKEN,
|
|
15
|
+
profile_id: GOLOGIN_PROFILE_ID,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// stop profile
|
|
19
|
+
await GL.stopRemote();
|
|
20
|
+
})();
|
package/gologin.js
CHANGED
|
@@ -47,7 +47,7 @@ class GoLogin {
|
|
|
47
47
|
this.autoUpdateBrowser = !!options.autoUpdateBrowser;
|
|
48
48
|
this.browserChecker = new BrowserChecker(options.skipOrbitaHashChecking);
|
|
49
49
|
this.uploadCookiesToServer = options.uploadCookiesToServer || false;
|
|
50
|
-
this.writeCookesFromServer = options.writeCookesFromServer
|
|
50
|
+
this.writeCookesFromServer = options.writeCookesFromServer;
|
|
51
51
|
this.remote_debugging_port = options.remote_debugging_port || 0;
|
|
52
52
|
this.timezone = options.timezone;
|
|
53
53
|
|
|
@@ -247,7 +247,21 @@ class GoLogin {
|
|
|
247
247
|
if (_.get(preferences, 'navigator.language')) {
|
|
248
248
|
preferences.language = _.get(preferences, 'navigator.language');
|
|
249
249
|
}
|
|
250
|
+
if (_.get(preferences, 'navigator.maxTouchPoints')) {
|
|
251
|
+
preferences.navigator.max_touch_points = _.get(preferences, 'navigator.maxTouchPoints');
|
|
252
|
+
}
|
|
250
253
|
|
|
254
|
+
if (_.get(preferences, 'isM1')) {
|
|
255
|
+
preferences.is_m1 = _.get(preferences, 'isM1');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
preferences.mediaDevices = {
|
|
259
|
+
enable: preferences.mediaDevices.enableMasking,
|
|
260
|
+
videoInputs: preferences.mediaDevices.videoInputs,
|
|
261
|
+
audioInputs: preferences.mediaDevices.audioInputs,
|
|
262
|
+
audioOutputs: preferences.mediaDevices.audioOutputs,
|
|
263
|
+
}
|
|
264
|
+
|
|
251
265
|
return preferences;
|
|
252
266
|
}
|
|
253
267
|
|
|
@@ -373,7 +387,7 @@ class GoLogin {
|
|
|
373
387
|
let name = _.get(profile, 'name');
|
|
374
388
|
const chromeExtensions = _.get(profile, 'chromeExtensions');
|
|
375
389
|
|
|
376
|
-
if (chromeExtensions.length) {
|
|
390
|
+
if (chromeExtensions && chromeExtensions.length) {
|
|
377
391
|
const ExtensionsManagerInst = new ExtensionsManager();
|
|
378
392
|
ExtensionsManagerInst.apiUrl = API_URL;
|
|
379
393
|
await ExtensionsManagerInst.init()
|
|
@@ -458,10 +472,16 @@ class GoLogin {
|
|
|
458
472
|
};
|
|
459
473
|
|
|
460
474
|
debug('profile.webRtc=', profile.webRtc);
|
|
475
|
+
debug('profile.timezone=', profile.timezone);
|
|
476
|
+
debug('profile.mediaDevices=', profile.mediaDevices);
|
|
461
477
|
|
|
462
478
|
const audioContext = profile.audioContext || {};
|
|
463
479
|
const { mode: audioCtxMode = 'off', noise: audioCtxNoise } = audioContext;
|
|
464
|
-
profile.timezone
|
|
480
|
+
if(profile.timezone.fillBasedOnIp==false){
|
|
481
|
+
profile.timezone = { id: profile.timezone.timezone };
|
|
482
|
+
} else {
|
|
483
|
+
profile.timezone = { id: this._tz.timezone };
|
|
484
|
+
}
|
|
465
485
|
profile.webgl_noise_value = profile.webGL.noise;
|
|
466
486
|
profile.get_client_rects_noise = profile.webGL.getClientRectsNoise;
|
|
467
487
|
profile.canvasMode = profile.canvas.mode;
|
|
@@ -484,10 +504,10 @@ class GoLogin {
|
|
|
484
504
|
|
|
485
505
|
const gologin = this.convertPreferences(profile);
|
|
486
506
|
|
|
487
|
-
debug(`Writing profile for screenWidth ${profilePath}`, JSON.stringify(
|
|
507
|
+
debug(`Writing profile for screenWidth ${profilePath}`, JSON.stringify(gologin));
|
|
488
508
|
gologin.screenWidth = this.resolution.width;
|
|
489
509
|
gologin.screenHeight = this.resolution.height;
|
|
490
|
-
|
|
510
|
+
debug("writeCookesFromServer", this.writeCookesFromServer)
|
|
491
511
|
if (this.writeCookesFromServer) {
|
|
492
512
|
await this.writeCookiesToFile();
|
|
493
513
|
}
|
|
@@ -513,7 +533,7 @@ class GoLogin {
|
|
|
513
533
|
|
|
514
534
|
preferences.gologin.langHeader = gologin.language;
|
|
515
535
|
preferences.gologin.languages = languages;
|
|
516
|
-
|
|
536
|
+
// debug("convertedPreferences=", preferences.gologin)
|
|
517
537
|
await writeFile(path.join(profilePath, 'Default', 'Preferences'), JSON.stringify(_.merge(preferences, {
|
|
518
538
|
gologin
|
|
519
539
|
})));
|
|
@@ -709,7 +729,7 @@ class GoLogin {
|
|
|
709
729
|
this.port = remote_debugging_port;
|
|
710
730
|
|
|
711
731
|
const ORBITA_BROWSER = this.executablePath || this.browserChecker.getOrbitaPath;
|
|
712
|
-
|
|
732
|
+
console.log("ORBITA_BROWSER=", ORBITA_BROWSER)
|
|
713
733
|
const env = {};
|
|
714
734
|
Object.keys(process.env).forEach((key) => {
|
|
715
735
|
env[key] = process.env[key];
|
|
@@ -954,7 +974,7 @@ class GoLogin {
|
|
|
954
974
|
if (deviceMemory < 1) {
|
|
955
975
|
deviceMemory = 1;
|
|
956
976
|
}
|
|
957
|
-
navigator.deviceMemory = deviceMemory;
|
|
977
|
+
navigator.deviceMemory = deviceMemory*1024;
|
|
958
978
|
webGLMetadata.mode = webGLMetadata.mode === 'noise' ? 'mask' : 'off';
|
|
959
979
|
|
|
960
980
|
const json = {
|