gologin 2.1.26 → 2.1.28
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 +14 -0
- package/package.json +1 -1
- package/src/gologin.js +13 -7
- package/src/utils/http.js +17 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
Combined changelog for GoLogin node.js SDK
|
|
4
4
|
|
|
5
|
+
## [2.1.27] 2025-07-10
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Fixes
|
|
9
|
+
|
|
10
|
+
* Added removing Sync Data folder to prevent crashes
|
|
11
|
+
|
|
12
|
+
## [2.1.27] 2025-07-10
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### New
|
|
16
|
+
|
|
17
|
+
* Added possibility to change proxy check timeout
|
|
18
|
+
|
|
5
19
|
## [2.1.26] 2025-07-02
|
|
6
20
|
|
|
7
21
|
|
package/package.json
CHANGED
package/src/gologin.js
CHANGED
|
@@ -80,6 +80,8 @@ export class GoLogin {
|
|
|
80
80
|
this.processKillTimeout = 1 * 1000;
|
|
81
81
|
this.browserMajorVersion = 0;
|
|
82
82
|
this.newProxyOrbbitaMajorVersion = 135;
|
|
83
|
+
this.proxyCheckTimeout = options.proxyCheckTimeout || 13 * 1000;
|
|
84
|
+
this.proxyCheckAttempts = options.proxyCheckAttempts || 3;
|
|
83
85
|
|
|
84
86
|
if (process.env.DISABLE_TELEMETRY !== 'true') {
|
|
85
87
|
Sentry.init({
|
|
@@ -153,10 +155,6 @@ export class GoLogin {
|
|
|
153
155
|
return JSON.parse(profileResponse);
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
async emptyProfile() {
|
|
157
|
-
return readFile(_resolve(__dirname, 'gologin_zeroprofile.b64')).then(res => res.toString());
|
|
158
|
-
}
|
|
159
|
-
|
|
160
158
|
async getProfileS3() {
|
|
161
159
|
const token = this.access_token;
|
|
162
160
|
debug('getProfileS3 token=', token, 'profile=', this.profile_id);
|
|
@@ -487,6 +485,7 @@ export class GoLogin {
|
|
|
487
485
|
await this.downloadProfileAndExtract(profile, local);
|
|
488
486
|
}
|
|
489
487
|
|
|
488
|
+
await _promises.rm(join(profilePath, 'Default', 'Sync Data'), { recursive: true }).catch(() => null);
|
|
490
489
|
const pref_file_name = join(profilePath, 'Default', 'Preferences');
|
|
491
490
|
debug('reading', pref_file_name);
|
|
492
491
|
|
|
@@ -738,9 +737,15 @@ export class GoLogin {
|
|
|
738
737
|
|
|
739
738
|
const proxyUrl = `${proxy.mode}://${proxy.username}:${proxy.password}@${proxy.host}:${proxy.port}`;
|
|
740
739
|
debug(`getTimeZone start ${TIMEZONE_URL}`, proxyUrl);
|
|
741
|
-
|
|
740
|
+
|
|
741
|
+
data = await makeRequest(TIMEZONE_URL, {
|
|
742
|
+
proxy: proxyUrl,
|
|
743
|
+
timeout: this.proxyCheckTimeout,
|
|
744
|
+
maxAttempts: this.proxyCheckAttempts,
|
|
745
|
+
method: 'GET',
|
|
746
|
+
});
|
|
742
747
|
} else {
|
|
743
|
-
data = await makeRequest(TIMEZONE_URL, { timeout:
|
|
748
|
+
data = await makeRequest(TIMEZONE_URL, { timeout: this.proxyCheckTimeout, maxAttempts: this.proxyCheckAttempts, method: 'GET' });
|
|
744
749
|
}
|
|
745
750
|
|
|
746
751
|
debug('getTimeZone finish', data);
|
|
@@ -810,7 +815,7 @@ export class GoLogin {
|
|
|
810
815
|
|
|
811
816
|
await makeRequest(
|
|
812
817
|
`${API_URL}/proxy/set_proxy_statuses`,
|
|
813
|
-
{ timeout:
|
|
818
|
+
{ timeout: this.proxyCheckTimeout, maxAttempts: this.proxyCheckAttempts, method: 'POST', json: statusBody },
|
|
814
819
|
{ token: this.access_token, fallbackUrl: `${FALLBACK_API_URL}/proxy/set_proxy_statuses` },
|
|
815
820
|
).catch();
|
|
816
821
|
}
|
|
@@ -1086,6 +1091,7 @@ export class GoLogin {
|
|
|
1086
1091
|
`${SEPARATOR}Default${SEPARATOR}GPUCache`,
|
|
1087
1092
|
`${SEPARATOR}Default${SEPARATOR}DawnCache`,
|
|
1088
1093
|
`${SEPARATOR}Default${SEPARATOR}fonts_config`,
|
|
1094
|
+
`${SEPARATOR}Default${SEPARATOR}Sync Data`,
|
|
1089
1095
|
`${SEPARATOR}GrShaderCache`,
|
|
1090
1096
|
`${SEPARATOR}ShaderCache`,
|
|
1091
1097
|
`${SEPARATOR}biahpgbdmdkfgndcmfiipgcebobojjkp`,
|
package/src/utils/http.js
CHANGED
|
@@ -3,8 +3,23 @@ import requests from 'requestretry';
|
|
|
3
3
|
|
|
4
4
|
const TIMEZONE_URL = 'https://geo.myip.link';
|
|
5
5
|
|
|
6
|
+
const createTimeoutPromise = (timeoutMs) => new Promise((_, reject) => {
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
reject(new Error(`Request timeout after ${timeoutMs}ms`));
|
|
9
|
+
}, timeoutMs);
|
|
10
|
+
});
|
|
11
|
+
|
|
6
12
|
const attemptRequest = async (requestUrl, options) => {
|
|
7
|
-
const
|
|
13
|
+
const requestPromise = requests(requestUrl, options);
|
|
14
|
+
|
|
15
|
+
let req;
|
|
16
|
+
if (options.proxy) {
|
|
17
|
+
const timeoutPromise = createTimeoutPromise(options.timeout || 30000);
|
|
18
|
+
req = await Promise.race([requestPromise, timeoutPromise]);
|
|
19
|
+
} else {
|
|
20
|
+
req = await requestPromise;
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
if (req.statusCode >= 400) {
|
|
9
24
|
const error = new Error(req.body);
|
|
10
25
|
error.statusCode = req.statusCode;
|
|
@@ -39,7 +54,7 @@ export const makeRequest = async (url, options, internalOptions) => {
|
|
|
39
54
|
};
|
|
40
55
|
|
|
41
56
|
export const checkSocksProxy = async (agent) => new Promise((resolve, reject) => {
|
|
42
|
-
_get(TIMEZONE_URL, { agent, timeout:
|
|
57
|
+
_get(TIMEZONE_URL, { agent, timeout: 8000 }, (res) => {
|
|
43
58
|
let resultResponse = '';
|
|
44
59
|
res.on('data', (data) => {
|
|
45
60
|
resultResponse += data;
|