gologin 3.0.4 → 3.0.6
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 +7 -0
- package/package.json +1 -1
- package/src/gologin.js +57 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Combined changelog for GoLogin node.js SDK
|
|
4
4
|
|
|
5
|
+
## [3.0.6] 2026-10-06
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
* Pass user-defined timezone and language to browser start when they are not filled from IP
|
|
10
|
+
* Removed the macOS override that forced the browser language to en-US
|
|
11
|
+
|
|
5
12
|
## [3.0.4] 2026-09-04
|
|
6
13
|
|
|
7
14
|
### Fixes
|
package/package.json
CHANGED
package/src/gologin.js
CHANGED
|
@@ -80,6 +80,7 @@ export class GoLogin {
|
|
|
80
80
|
this.timezone = options.timezone;
|
|
81
81
|
this.extensionPathsToInstall = [];
|
|
82
82
|
this.customArgs = options.args || [];
|
|
83
|
+
this.profileLaunchArguments = [];
|
|
83
84
|
this.restoreLastSession = options.restoreLastSession || true;
|
|
84
85
|
this.processSpawned = null;
|
|
85
86
|
this.processKillTimeout = 1 * 1000;
|
|
@@ -489,6 +490,8 @@ export class GoLogin {
|
|
|
489
490
|
throw new Error('Error fetching profile data');
|
|
490
491
|
}
|
|
491
492
|
|
|
493
|
+
this.profileLaunchArguments = (profile.launchArguments || '').split(' ').filter(Boolean);
|
|
494
|
+
|
|
492
495
|
const { navigator = {}, fonts, os: profileOs } = profile;
|
|
493
496
|
this.fontsMasking = fonts?.enableMasking;
|
|
494
497
|
this.profileOs = profileOs;
|
|
@@ -536,6 +539,7 @@ export class GoLogin {
|
|
|
536
539
|
}
|
|
537
540
|
|
|
538
541
|
this.proxy = proxy;
|
|
542
|
+
this.applyProfileLocale(profile);
|
|
539
543
|
|
|
540
544
|
await Promise.all([
|
|
541
545
|
withTiming({ name: 'resolveProfileBrowserVersion', promise: this.resolveProfileBrowserVersion(profile) }),
|
|
@@ -600,6 +604,13 @@ export class GoLogin {
|
|
|
600
604
|
preferences.gologin = {};
|
|
601
605
|
}
|
|
602
606
|
|
|
607
|
+
if (this.userTimezone && !this.timezone) {
|
|
608
|
+
this._tz = {
|
|
609
|
+
...(this._tz || {}),
|
|
610
|
+
timezone: this.userTimezone,
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
|
|
603
614
|
const gologin = this.getGologinPreferences(profile);
|
|
604
615
|
|
|
605
616
|
debug(`Writing profile for screenWidth ${profilePath}`, JSON.stringify(gologin));
|
|
@@ -607,11 +618,14 @@ export class GoLogin {
|
|
|
607
618
|
gologin.screenHeight = this.resolution.height;
|
|
608
619
|
debug('writeCookiesFromServer', this.writeCookiesFromServer);
|
|
609
620
|
|
|
610
|
-
const isMAC = OS_PLATFORM === 'darwin';
|
|
611
621
|
const checkAutoLangResult = checkAutoLang(gologin, this._tz, profile.autoLang);
|
|
612
622
|
const intlConfig = getIntlProfileConfig(profile, this._tz, profile.autoLang);
|
|
613
623
|
|
|
614
|
-
this.
|
|
624
|
+
if (this.userBrowserLang) {
|
|
625
|
+
this.browserLang = this.userBrowserLang;
|
|
626
|
+
} else {
|
|
627
|
+
this.browserLang = checkAutoLangResult;
|
|
628
|
+
}
|
|
615
629
|
const prefsToWrite = Object.assign(preferences, { gologin });
|
|
616
630
|
if (this.customChromeFrame === false) {
|
|
617
631
|
prefsToWrite.browser = {
|
|
@@ -860,6 +874,38 @@ export class GoLogin {
|
|
|
860
874
|
return port;
|
|
861
875
|
}
|
|
862
876
|
|
|
877
|
+
applyProfileLocale(profile) {
|
|
878
|
+
const timezoneConfig = profile.timezone || {};
|
|
879
|
+
const language = profile.navigator?.language || '';
|
|
880
|
+
const hasUserTimezone = timezoneConfig.fillBasedOnIp === false && Boolean(timezoneConfig.timezone);
|
|
881
|
+
const hasUserLanguage = profile.autoLang === false && Boolean(language);
|
|
882
|
+
const geolocation = profile.geolocation || {};
|
|
883
|
+
const geolocationFromIp = geolocation.fillBasedOnIp !== false;
|
|
884
|
+
|
|
885
|
+
if (hasUserTimezone) {
|
|
886
|
+
this.userTimezone = timezoneConfig.timezone;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
if (hasUserLanguage) {
|
|
890
|
+
const primaryLanguage = language.split(',')[0] || '';
|
|
891
|
+
const browserLang = primaryLanguage.split(';')[0].trim();
|
|
892
|
+
if (browserLang) {
|
|
893
|
+
this.userBrowserLang = browserLang;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
const canSkipTimezoneCheck = hasUserTimezone && hasUserLanguage && !geolocationFromIp;
|
|
898
|
+
if (!canSkipTimezoneCheck || this.timezone) {
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
this.timezone = {
|
|
903
|
+
timezone: timezoneConfig.timezone,
|
|
904
|
+
ll: [geolocation.latitude, geolocation.longitude],
|
|
905
|
+
accuracy: geolocation.accuracy,
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
|
|
863
909
|
async getTimeZone(proxy) {
|
|
864
910
|
debug('getting timeZone proxy=', proxy);
|
|
865
911
|
|
|
@@ -1009,6 +1055,10 @@ export class GoLogin {
|
|
|
1009
1055
|
params = params.concat(this.extra_params);
|
|
1010
1056
|
}
|
|
1011
1057
|
|
|
1058
|
+
if (this.profileLaunchArguments.length) {
|
|
1059
|
+
params = params.concat(this.profileLaunchArguments);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1012
1062
|
if (this.remote_debugging_port) {
|
|
1013
1063
|
params.push(`--remote-debugging-port=${this.remote_debugging_port}`);
|
|
1014
1064
|
}
|
|
@@ -1117,7 +1167,7 @@ export class GoLogin {
|
|
|
1117
1167
|
params.push(`--host-resolver-rules=${hr_rules}`);
|
|
1118
1168
|
}
|
|
1119
1169
|
|
|
1120
|
-
if (proxy
|
|
1170
|
+
if (proxy) {
|
|
1121
1171
|
params.push(`--proxy-server=${proxy}`);
|
|
1122
1172
|
}
|
|
1123
1173
|
|
|
@@ -1125,6 +1175,10 @@ export class GoLogin {
|
|
|
1125
1175
|
params = params.concat(this.extra_params);
|
|
1126
1176
|
}
|
|
1127
1177
|
|
|
1178
|
+
if (this.profileLaunchArguments.length) {
|
|
1179
|
+
params = params.concat(this.profileLaunchArguments);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1128
1182
|
if (!this.isFirstSession && this.restoreLastSession) {
|
|
1129
1183
|
params.push('--restore-last-session');
|
|
1130
1184
|
}
|