gologin 1.0.36 → 1.0.39
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/README.md +5 -4
- package/browser-checker.js +7 -1
- package/gologin.js +20 -13
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -65,15 +65,16 @@ const GoLogin = require('gologin');
|
|
|
65
65
|
|
|
66
66
|
- `options` <[Object]> Options for profile
|
|
67
67
|
- `autoUpdateBrowser` <[boolean]> do not ask whether download new browser version (default false)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
- `token` <[string]> your API <a href="https://gologin.com/#/personalArea/TokenApi" target="_blank">token</a>
|
|
69
|
+
- `profile_id` <[string]> profile ID
|
|
70
|
+
- `executablePath` <[string]> path to executable Orbita file. Orbita will be downloaded automatically if not specified.
|
|
71
71
|
- `remote_debugging_port` <[int]> port for remote debugging
|
|
72
|
-
|
|
72
|
+
- `vncPort` <[integer]> port of VNC server if you using it
|
|
73
73
|
- `tmpdir` <[string]> path to temporary directore for saving profiles
|
|
74
74
|
- `extra_params` arrayof <[string]> extra params for browser orbita (ex. extentions etc.)
|
|
75
75
|
- `uploadCookiesToServer` <[boolean]> upload cookies to server after profile stopping (default false)
|
|
76
76
|
- `writeCookesFromServer` <[boolean]> download cookies from server and write to profile cookies file (default true)
|
|
77
|
+
- `skipOrbitaHashChecking` <[boolean]> skip hash checking for Orbita after downloading process (default false)
|
|
77
78
|
|
|
78
79
|
```js
|
|
79
80
|
const GoLogin = require('gologin');
|
package/browser-checker.js
CHANGED
|
@@ -39,8 +39,10 @@ class BrowserChecker {
|
|
|
39
39
|
#homedir;
|
|
40
40
|
#browserPath;
|
|
41
41
|
#executableFilePath;
|
|
42
|
+
#skipOrbitaHashChecking = false;
|
|
42
43
|
|
|
43
|
-
constructor() {
|
|
44
|
+
constructor(skipOrbitaHashChecking) {
|
|
45
|
+
this.#skipOrbitaHashChecking = skipOrbitaHashChecking;
|
|
44
46
|
this.#homedir = os.homedir();
|
|
45
47
|
this.#browserPath = path.join(this.#homedir, '.gologin', 'browser');
|
|
46
48
|
|
|
@@ -221,6 +223,10 @@ class BrowserChecker {
|
|
|
221
223
|
}
|
|
222
224
|
|
|
223
225
|
async checkBrowserSum() {
|
|
226
|
+
if (this.#skipOrbitaHashChecking) {
|
|
227
|
+
return Promise.resolve();
|
|
228
|
+
}
|
|
229
|
+
|
|
224
230
|
console.log('Orbita hash checking');
|
|
225
231
|
if (PLATFORM === 'win32') {
|
|
226
232
|
return Promise.resolve();
|
package/gologin.js
CHANGED
|
@@ -8,7 +8,6 @@ const rimraf = util.promisify(require('rimraf'));
|
|
|
8
8
|
const { access, unlink, writeFile, readFile } = require('fs').promises;
|
|
9
9
|
const exec = util.promisify(require('child_process').exec);
|
|
10
10
|
const { spawn, execFile } = require('child_process');
|
|
11
|
-
const FormData = require('form-data');
|
|
12
11
|
const ProxyAgent = require('simple-proxy-agent');
|
|
13
12
|
const decompress = require('decompress');
|
|
14
13
|
const decompressUnzip = require('decompress-unzip');
|
|
@@ -30,7 +29,7 @@ const OS_PLATFORM = process.platform;
|
|
|
30
29
|
const delay = (time) => new Promise((resolve) => setTimeout(resolve, time));
|
|
31
30
|
|
|
32
31
|
class GoLogin {
|
|
33
|
-
constructor(options) {
|
|
32
|
+
constructor(options = {}) {
|
|
34
33
|
this.is_remote = options.remote || false;
|
|
35
34
|
this.access_token = options.token;
|
|
36
35
|
this.profile_id = options.profile_id;
|
|
@@ -45,7 +44,7 @@ class GoLogin {
|
|
|
45
44
|
this.profileOs = 'lin';
|
|
46
45
|
this.tmpdir = os.tmpdir();
|
|
47
46
|
this.autoUpdateBrowser = !!options.autoUpdateBrowser;
|
|
48
|
-
this.browserChecker = new BrowserChecker();
|
|
47
|
+
this.browserChecker = new BrowserChecker(options.skipOrbitaHashChecking);
|
|
49
48
|
this.uploadCookiesToServer = options.uploadCookiesToServer || false;
|
|
50
49
|
this.writeCookesFromServer = options.writeCookesFromServer || true;
|
|
51
50
|
this.remote_debugging_port = options.remote_debugging_port || 0;
|
|
@@ -123,12 +122,17 @@ class GoLogin {
|
|
|
123
122
|
'Authorization': `Bearer ${this.access_token}`
|
|
124
123
|
}
|
|
125
124
|
})
|
|
126
|
-
debug(profileResponse.body);
|
|
125
|
+
debug("profileResponse", profileResponse.statusCode, profileResponse.body);
|
|
126
|
+
|
|
127
127
|
|
|
128
128
|
if (profileResponse.statusCode === 404) {
|
|
129
129
|
throw new Error(JSON.parse(profileResponse.body).message);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
if (profileResponse.statusCode === 403) {
|
|
133
|
+
throw new Error(JSON.parse(profileResponse.body).message);
|
|
134
|
+
}
|
|
135
|
+
|
|
132
136
|
if (profileResponse.statusCode !== 200) {
|
|
133
137
|
throw new Error(`Gologin /browser/${id} response error ${profileResponse.statusCode} INVALID TOKEN OR PROFILE NOT FOUND`);
|
|
134
138
|
}
|
|
@@ -1142,25 +1146,28 @@ class GoLogin {
|
|
|
1142
1146
|
|
|
1143
1147
|
async startRemote(delay_ms = 10000) {
|
|
1144
1148
|
debug(`startRemote ${this.profile_id}`);
|
|
1149
|
+
|
|
1150
|
+
/*
|
|
1151
|
+
if (profileResponse.statusCode !== 202) {
|
|
1152
|
+
return {'status': 'failure', 'code': profileResponse.statusCode};
|
|
1153
|
+
}
|
|
1154
|
+
*/
|
|
1155
|
+
|
|
1156
|
+
// if (profileResponse.body === 'ok') {
|
|
1157
|
+
const profile = await this.getProfile();
|
|
1158
|
+
|
|
1145
1159
|
const profileResponse = await requests.post(`https://api.gologin.com/browser/${this.profile_id}/web`, {
|
|
1146
1160
|
headers: {
|
|
1147
1161
|
'Authorization': `Bearer ${this.access_token}`
|
|
1148
1162
|
}
|
|
1149
1163
|
});
|
|
1164
|
+
|
|
1165
|
+
debug('profileResponse', profileResponse.statusCode, profileResponse.body);
|
|
1150
1166
|
|
|
1151
1167
|
if (profileResponse.statusCode === 401){
|
|
1152
1168
|
throw new Error("invalid token");
|
|
1153
1169
|
}
|
|
1154
1170
|
|
|
1155
|
-
debug('profileResponse', profileResponse.statusCode, profileResponse.body);
|
|
1156
|
-
/*
|
|
1157
|
-
if (profileResponse.statusCode !== 202) {
|
|
1158
|
-
return {'status': 'failure', 'code': profileResponse.statusCode};
|
|
1159
|
-
}
|
|
1160
|
-
*/
|
|
1161
|
-
|
|
1162
|
-
// if (profileResponse.body === 'ok') {
|
|
1163
|
-
const profile = await this.getProfile();
|
|
1164
1171
|
const { navigator = {}, fonts, os: profileOs } = profile;
|
|
1165
1172
|
this.fontsMasking = fonts?.enableMasking;
|
|
1166
1173
|
this.profileOs = profileOs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gologin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "A high-level API to control Orbita browser over GoLogin API",
|
|
5
5
|
"main": "./gologin.js",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"request": "^2.88.2",
|
|
25
25
|
"requestretry": "^4.1.0",
|
|
26
26
|
"rimraf": "^3.0.2",
|
|
27
|
-
"selenium-webdriver": "^4.0.0-alpha.7",
|
|
28
27
|
"simple-proxy-agent": "^1.1.0",
|
|
29
28
|
"sqlite": "^4.0.23",
|
|
30
29
|
"sqlite3": "^5.0.2",
|