gologin 2.2.7 → 2.2.8
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.
|
File without changes
|
package/package.json
CHANGED
|
@@ -361,8 +361,11 @@ export class BrowserChecker {
|
|
|
361
361
|
|
|
362
362
|
getLatestBrowserVersion() {
|
|
363
363
|
const userOs = getOS();
|
|
364
|
+
const options = {
|
|
365
|
+
json: true,
|
|
366
|
+
};
|
|
364
367
|
|
|
365
|
-
return makeRequest(`${API_URL}/gologin-global-settings/latest-browser-info?os=${userOs}
|
|
368
|
+
return makeRequest(`${API_URL}/gologin-global-settings/latest-browser-info?os=${userOs}`, options);
|
|
366
369
|
}
|
|
367
370
|
|
|
368
371
|
get getOrbitaPath() {
|
package/src/gologin.js
CHANGED
|
@@ -80,11 +80,10 @@ export class GoLogin {
|
|
|
80
80
|
this.restoreLastSession = options.restoreLastSession || true;
|
|
81
81
|
this.processSpawned = null;
|
|
82
82
|
this.processKillTimeout = 1 * 1000;
|
|
83
|
-
this.browserMajorVersion = 0;
|
|
84
|
-
this.
|
|
83
|
+
this.browserMajorVersion = options.browserMajorVersion || 0;
|
|
84
|
+
this.newProxyOrbitaMajorVersion = 135;
|
|
85
85
|
this.proxyCheckTimeout = options.proxyCheckTimeout || 13 * 1000;
|
|
86
86
|
this.proxyCheckAttempts = options.proxyCheckAttempts || 3;
|
|
87
|
-
this.browserLatestMajorVersion = 137;
|
|
88
87
|
|
|
89
88
|
if (process.env.DISABLE_TELEMETRY !== 'true') {
|
|
90
89
|
Sentry.init({
|
|
@@ -329,7 +328,7 @@ export class GoLogin {
|
|
|
329
328
|
},
|
|
330
329
|
};
|
|
331
330
|
|
|
332
|
-
if (this.browserMajorVersion >= this.
|
|
331
|
+
if (this.browserMajorVersion >= this.newProxyOrbitaMajorVersion && profileData.proxy?.mode !== 'none') {
|
|
333
332
|
let proxyServer = `${profileData.proxy.mode}://`;
|
|
334
333
|
if (profileData.proxy.username) {
|
|
335
334
|
const encodedUsername = encodeURIComponent(profileData.proxy.username || '');
|
|
@@ -476,6 +475,29 @@ export class GoLogin {
|
|
|
476
475
|
this.browserMajorVersion = latestVersionNumber;
|
|
477
476
|
await this.checkBrowser(latestVersionNumber);
|
|
478
477
|
}
|
|
478
|
+
} else if (!this.browserMajorVersion) {
|
|
479
|
+
const { userAgent } = profile.navigator;
|
|
480
|
+
const [browserMajorVersion] = userAgent.split('Chrome/')[1].split('.');
|
|
481
|
+
this.browserMajorVersion = Number(browserMajorVersion);
|
|
482
|
+
|
|
483
|
+
let executableDir = join(this.executablePath, '..');
|
|
484
|
+
if (OS_PLATFORM === 'darwin') {
|
|
485
|
+
executableDir = join(this.executablePath, '..', '..', '..');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
const versionFilePath = join(executableDir, 'version');
|
|
489
|
+
try {
|
|
490
|
+
await access(versionFilePath);
|
|
491
|
+
const versionContent = await readFile(versionFilePath, 'utf8');
|
|
492
|
+
const versionFromFile = versionContent.trim();
|
|
493
|
+
const isValidVersion = /^\d+\.\d+\.\d+/.test(versionFromFile);
|
|
494
|
+
if (isValidVersion) {
|
|
495
|
+
const [browserMajorVersion] = isValidVersion.split('.');
|
|
496
|
+
this.browserMajorVersion = Number(browserMajorVersion);
|
|
497
|
+
}
|
|
498
|
+
} catch (error) {
|
|
499
|
+
console.warn('Error reading version file:', error);
|
|
500
|
+
}
|
|
479
501
|
}
|
|
480
502
|
|
|
481
503
|
const { navigator = {}, fonts, os: profileOs } = profile;
|
|
@@ -655,7 +677,7 @@ export class GoLogin {
|
|
|
655
677
|
|
|
656
678
|
this.browserLang = isMAC ? 'en-US' : checkAutoLangResult;
|
|
657
679
|
const prefsToWrite = Object.assign(preferences, { gologin });
|
|
658
|
-
if (this.browserMajorVersion >= this.
|
|
680
|
+
if (this.browserMajorVersion >= this.newProxyOrbitaMajorVersion && this.proxy?.mode !== 'none') {
|
|
659
681
|
prefsToWrite.proxy = {
|
|
660
682
|
mode: 'fixed_servers',
|
|
661
683
|
server: gologin.proxy.server,
|
|
@@ -666,6 +688,7 @@ export class GoLogin {
|
|
|
666
688
|
const orbitaConfig = {
|
|
667
689
|
intl: intlConfig,
|
|
668
690
|
gologin: {
|
|
691
|
+
api_domain: API_URL,
|
|
669
692
|
profile_token: orbitaParamsToken,
|
|
670
693
|
...clientGologinOpts,
|
|
671
694
|
},
|
|
@@ -977,7 +1000,7 @@ export class GoLogin {
|
|
|
977
1000
|
params.push(`--host-resolver-rules=${hr_rules}`);
|
|
978
1001
|
}
|
|
979
1002
|
|
|
980
|
-
if (proxy && Number(this.browserMajorVersion) < this.
|
|
1003
|
+
if (proxy && Number(this.browserMajorVersion) < this.newProxyOrbitaMajorVersion) {
|
|
981
1004
|
params.push(`--proxy-server=${proxy}`);
|
|
982
1005
|
}
|
|
983
1006
|
|
package/src/utils/http.js
CHANGED
|
@@ -33,7 +33,7 @@ const attemptRequest = async (requestUrl, options) => {
|
|
|
33
33
|
return req.body;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export const makeRequest = async (url, options, internalOptions) => {
|
|
36
|
+
export const makeRequest = async (url, options = {}, internalOptions) => {
|
|
37
37
|
options.headers = {
|
|
38
38
|
...options.headers,
|
|
39
39
|
'User-Agent': `gologin-nodejs-sdk/${version}`,
|