gologin 2.1.23 → 2.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/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/extensions/user-extensions-manager.js +2 -1
- package/src/gologin-api.js +3 -3
- package/src/gologin.js +38 -5
- package/src/utils/http.js +5 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,8 @@ import { createWriteStream, promises as _promises } from 'fs';
|
|
|
2
2
|
import { join, sep } from 'path';
|
|
3
3
|
import request from 'requestretry';
|
|
4
4
|
|
|
5
|
-
import { CHROME_EXTENSIONS_PATH, composeExtractionPromises, USER_EXTENSIONS_PATH } from '../utils/common.js';
|
|
5
|
+
import { CHROME_EXTENSIONS_PATH, composeExtractionPromises, FALLBACK_API_URL, USER_EXTENSIONS_PATH } from '../utils/common.js';
|
|
6
|
+
import { makeRequest } from '../utils/http.js';
|
|
6
7
|
|
|
7
8
|
const { readdir, readFile, stat, mkdir, copyFile } = _promises;
|
|
8
9
|
|
package/src/gologin-api.js
CHANGED
|
@@ -240,11 +240,11 @@ export const GologinApi = ({ token }) => {
|
|
|
240
240
|
},
|
|
241
241
|
|
|
242
242
|
async exit() {
|
|
243
|
-
Promise.allSettled(browsers.map((browser) => browser.close()));
|
|
244
|
-
Promise.allSettled(
|
|
243
|
+
await Promise.allSettled(browsers.map((browser) => browser.close()));
|
|
244
|
+
await Promise.allSettled(
|
|
245
245
|
legacyGls.map((gl) => gl.stopLocal({ posting: true })),
|
|
246
246
|
);
|
|
247
|
-
Promise.allSettled(
|
|
247
|
+
await Promise.allSettled(
|
|
248
248
|
legacyGls.map((gl) => gl.stopRemote({ posting: true })),
|
|
249
249
|
);
|
|
250
250
|
},
|
package/src/gologin.js
CHANGED
|
@@ -78,11 +78,15 @@ export class GoLogin {
|
|
|
78
78
|
this.restoreLastSession = options.restoreLastSession || true;
|
|
79
79
|
this.processSpawned = null;
|
|
80
80
|
this.processKillTimeout = 1 * 1000;
|
|
81
|
+
this.browserMajorVersion = 0;
|
|
82
|
+
this.newProxyOrbbitaMajorVersion = 135;
|
|
81
83
|
|
|
82
84
|
if (process.env.DISABLE_TELEMETRY !== 'true') {
|
|
83
85
|
Sentry.init({
|
|
84
86
|
dsn: 'https://a13d5939a60ae4f6583e228597f1f2a0@sentry-new.amzn.pro/24',
|
|
85
87
|
tracesSampleRate: 1.0,
|
|
88
|
+
defaultIntegrations: false,
|
|
89
|
+
release: process.env.npm_package_version || '2.1.24',
|
|
86
90
|
});
|
|
87
91
|
}
|
|
88
92
|
|
|
@@ -220,6 +224,8 @@ export class GoLogin {
|
|
|
220
224
|
const [screenWidth, screenHeight] = resolution.split('x').map(Number);
|
|
221
225
|
const langHeader = (profileData.navigator && profileData.navigator.language) || '';
|
|
222
226
|
const splittedLangs = langHeader ? langHeader.split(',')[0] : 'en-US';
|
|
227
|
+
const [browserMajorVersion] = profileData.navigator.userAgent.split('Chrome/')[1].split('.');
|
|
228
|
+
this.browserMajorVersion = browserMajorVersion;
|
|
223
229
|
|
|
224
230
|
const startupUrl = (profileData.startUrl || '').trim().split(',')[0];
|
|
225
231
|
const startupUrls = (profileData.startUrl || '').split(',')
|
|
@@ -311,6 +317,26 @@ export class GoLogin {
|
|
|
311
317
|
},
|
|
312
318
|
};
|
|
313
319
|
|
|
320
|
+
if (browserMajorVersion >= this.newProxyOrbbitaMajorVersion && profileData.proxy?.mode !== 'none') {
|
|
321
|
+
let proxyServer = `${profileData.proxy.mode}://`;
|
|
322
|
+
if (profileData.proxy.username) {
|
|
323
|
+
const encodedUsername = encodeURIComponent(profileData.proxy.username || '');
|
|
324
|
+
const encodedPassword = encodeURIComponent(profileData.proxy.password || '');
|
|
325
|
+
|
|
326
|
+
proxyServer += encodedPassword
|
|
327
|
+
? `${encodedUsername}:${encodedPassword}@`
|
|
328
|
+
: `${encodedUsername}@`;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
proxyServer += `${profileData.proxy.host}:${profileData.proxy.port}`;
|
|
332
|
+
preferences.proxy = {
|
|
333
|
+
...preferences.proxy,
|
|
334
|
+
mode: 'fixed_servers',
|
|
335
|
+
schema: profileData.proxy.mode,
|
|
336
|
+
server: proxyServer,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
314
340
|
return preferences;
|
|
315
341
|
}
|
|
316
342
|
|
|
@@ -599,9 +625,15 @@ export class GoLogin {
|
|
|
599
625
|
const checkAutoLangResult = checkAutoLang(gologin, this._tz);
|
|
600
626
|
this.browserLang = isMAC ? 'en-US' : checkAutoLangResult;
|
|
601
627
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
628
|
+
const prefsToWrite = Object.assign(preferences, { gologin });
|
|
629
|
+
if (this.browserMajorVersion >= this.newProxyOrbbitaMajorVersion && this.proxy?.mode !== 'none') {
|
|
630
|
+
prefsToWrite.proxy = {
|
|
631
|
+
mode: 'fixed_servers',
|
|
632
|
+
server: gologin.proxy.server,
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
await writeFile(join(profilePath, 'Default', 'Preferences'), JSON.stringify(prefsToWrite));
|
|
605
637
|
|
|
606
638
|
const bookmarksParsedData = await getCurrentProfileBookmarks(this.bookmarksFilePath);
|
|
607
639
|
const bookmarksFromDb = profile.bookmarks?.bookmark_bar;
|
|
@@ -614,8 +646,9 @@ export class GoLogin {
|
|
|
614
646
|
}
|
|
615
647
|
|
|
616
648
|
async commitProfile() {
|
|
617
|
-
|
|
618
|
-
|
|
649
|
+
// wait for orbita to finish working with files
|
|
650
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
651
|
+
const dataBuff = await this.getProfileDataToUpdate().catch(console.log);
|
|
619
652
|
debug('begin updating', dataBuff.length);
|
|
620
653
|
if (!dataBuff.length) {
|
|
621
654
|
debug('WARN: profile zip data empty - SKIPPING PROFILE COMMIT');
|
package/src/utils/http.js
CHANGED
|
@@ -4,14 +4,14 @@ import requests from 'requestretry';
|
|
|
4
4
|
const TIMEZONE_URL = 'https://geo.myip.link';
|
|
5
5
|
|
|
6
6
|
const attemptRequest = async (requestUrl, options) => {
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
const error = new Error(body);
|
|
10
|
-
error.statusCode =
|
|
7
|
+
const req = await requests(requestUrl, options);
|
|
8
|
+
if (req.statusCode >= 400) {
|
|
9
|
+
const error = new Error(req.body);
|
|
10
|
+
error.statusCode = req.statusCode;
|
|
11
11
|
throw error;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
return body;
|
|
14
|
+
return req.body;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export const makeRequest = async (url, options, internalOptions) => {
|