gologin 2.2.8 → 3.0.0
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 +18 -0
- package/api.d.ts +105 -0
- package/examples/puppeter/cloud-browser.js +25 -14
- package/index.d.ts +46 -105
- package/package.json +16 -4
- package/src/browser/browser-checker.js +3 -2
- package/src/browser/browser-user-data-manager.js +4 -89
- package/src/cookies/cookies-manager.js +30 -15
- package/src/extensions/extensions-extractor.js +7 -5
- package/src/extensions/extensions-manager.js +10 -22
- package/src/extensions/user-extensions-manager.js +3 -6
- package/src/gologin-api.js +16 -4
- package/src/gologin.js +273 -220
- package/src/index.js +2 -0
- package/src/profile/profile-archiver.js +10 -1
- package/src/profile/profile-directories-to-remove.js +5 -0
- package/src/utils/http.js +326 -30
- package/src/utils/lazy-deps.js +206 -0
- package/src/utils/sentry.js +9 -2
- package/Orbita-Browser.app/Contents/MacOS/Orbita +0 -0
- package/fonts.js +0 -4293
- package/fonts_config +0 -104
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createWriteStream, promises as _promises } from 'fs';
|
|
2
2
|
import { join, sep } from 'path';
|
|
3
|
-
import request from 'requestretry';
|
|
4
3
|
|
|
5
4
|
import { CHROME_EXTENSIONS_PATH, composeExtractionPromises, USER_EXTENSIONS_PATH } from '../utils/common.js';
|
|
6
5
|
import UserExtensionsManager from './user-extensions-manager.js';
|
|
7
|
-
import { makeRequest } from '../utils/http.js';
|
|
6
|
+
import { fetchBufferWithRetry, fetchHeadWithRetry, makeRequest } from '../utils/http.js';
|
|
8
7
|
import { FALLBACK_API_URL } from '../utils/common.js';
|
|
9
8
|
|
|
10
9
|
const { mkdir, readdir, rmdir, unlink } = _promises;
|
|
@@ -134,19 +133,11 @@ export class ExtensionsManager extends UserExtensionsManager {
|
|
|
134
133
|
const reqPath = uploadedProfileMetadata.req.path;
|
|
135
134
|
const extVer = getExtVersion(reqPath);
|
|
136
135
|
|
|
137
|
-
const buffer = await
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
maxAttempts: 3,
|
|
142
|
-
retryDelay: 1000,
|
|
143
|
-
timeout: 8 * 1000,
|
|
144
|
-
fullResponse: false,
|
|
145
|
-
})
|
|
146
|
-
.on('data', (data) => chunks.push(data))
|
|
147
|
-
.on('end', () => res(Buffer.concat(chunks)));
|
|
136
|
+
const buffer = await fetchBufferWithRetry(extUrl, {
|
|
137
|
+
maxAttempts: 3,
|
|
138
|
+
retryDelay: 1000,
|
|
139
|
+
timeout: 8 * 1000,
|
|
148
140
|
});
|
|
149
|
-
console.log('buffer', buffer);
|
|
150
141
|
let zipExt;
|
|
151
142
|
try {
|
|
152
143
|
zipExt = crxToZip(buffer);
|
|
@@ -357,14 +348,11 @@ const calcLength = (a, b, c, d) => {
|
|
|
357
348
|
return length;
|
|
358
349
|
};
|
|
359
350
|
|
|
360
|
-
const getExtMetadata = (extUrl) => (
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
fullResponse: true,
|
|
366
|
-
})
|
|
367
|
-
);
|
|
351
|
+
const getExtMetadata = (extUrl) => fetchHeadWithRetry(extUrl, {
|
|
352
|
+
maxAttempts: 3,
|
|
353
|
+
retryDelay: 2000,
|
|
354
|
+
timeout: 2 * 1000,
|
|
355
|
+
});
|
|
368
356
|
|
|
369
357
|
const getExtVersion = (metadata) => {
|
|
370
358
|
const [extFullName = ''] = metadata.split('/').reverse();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createWriteStream, promises as _promises } from 'fs';
|
|
2
2
|
import { join, sep } from 'path';
|
|
3
|
-
import request from 'requestretry';
|
|
4
3
|
|
|
5
4
|
import { CHROME_EXTENSIONS_PATH, composeExtractionPromises, FALLBACK_API_URL, USER_EXTENSIONS_PATH } from '../utils/common.js';
|
|
6
|
-
import { makeRequest } from '../utils/http.js';
|
|
5
|
+
import { fetchToWriteStream, makeRequest } from '../utils/http.js';
|
|
7
6
|
|
|
8
7
|
const { readdir, readFile, stat, mkdir, copyFile } = _promises;
|
|
9
8
|
|
|
@@ -105,12 +104,10 @@ export class UserExtensionsManager {
|
|
|
105
104
|
const zipPath = `${join(USER_EXTENSIONS_PATH, extId)}.zip`;
|
|
106
105
|
const archiveZip = createWriteStream(zipPath);
|
|
107
106
|
|
|
108
|
-
await
|
|
107
|
+
await fetchToWriteStream(awsPath, archiveZip, {
|
|
109
108
|
retryDelay: 2 * 1000,
|
|
110
109
|
maxAttempts: 3,
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
await new Promise(r => archiveZip.on('close', () => r()));
|
|
110
|
+
});
|
|
114
111
|
|
|
115
112
|
return zipPath;
|
|
116
113
|
});
|
package/src/gologin-api.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer-core';
|
|
2
|
-
|
|
3
1
|
import GoLogin from './gologin.js';
|
|
4
2
|
import { API_URL, FALLBACK_API_URL, getOsAdvanced } from './utils/common.js';
|
|
5
3
|
import { makeRequest } from './utils/http.js';
|
|
@@ -7,6 +5,20 @@ import { makeRequest } from './utils/http.js';
|
|
|
7
5
|
const trafficLimitMessage =
|
|
8
6
|
'You dont have free traffic to use the proxy. Please go to app https://app.gologin.com/ and buy some traffic if you want to use the proxy';
|
|
9
7
|
|
|
8
|
+
let puppeteerModulePromise = null;
|
|
9
|
+
|
|
10
|
+
const loadPuppeteer = () => {
|
|
11
|
+
puppeteerModulePromise ||= import('puppeteer-core').then((module) => module.default ?? module);
|
|
12
|
+
|
|
13
|
+
return puppeteerModulePromise;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const connectToBrowser = async (options) => {
|
|
17
|
+
const puppeteer = await loadPuppeteer();
|
|
18
|
+
|
|
19
|
+
return puppeteer.connect(options);
|
|
20
|
+
};
|
|
21
|
+
|
|
10
22
|
export const getDefaultParams = () => ({
|
|
11
23
|
token: process.env.GOLOGIN_API_TOKEN,
|
|
12
24
|
profile_id: process.env.GOLOGIN_PROFILE_ID,
|
|
@@ -48,7 +60,7 @@ export const GologinApi = ({ token }) => {
|
|
|
48
60
|
|
|
49
61
|
const startedProfile = await legacyGologin.start();
|
|
50
62
|
|
|
51
|
-
const browser = await
|
|
63
|
+
const browser = await connectToBrowser({
|
|
52
64
|
browserWSEndpoint: startedProfile.wsUrl,
|
|
53
65
|
ignoreHTTPSErrors: true,
|
|
54
66
|
defaultViewport: null,
|
|
@@ -75,7 +87,7 @@ export const GologinApi = ({ token }) => {
|
|
|
75
87
|
legacyGls.push(legacyGologin);
|
|
76
88
|
|
|
77
89
|
const browserWSEndpoint = `https://cloudbrowser.gologin.com/connect?token=${token}&profile=${params.profileId}`;
|
|
78
|
-
const browser = await
|
|
90
|
+
const browser = await connectToBrowser({
|
|
79
91
|
browserWSEndpoint,
|
|
80
92
|
ignoreHTTPSErrors: true,
|
|
81
93
|
});
|