gologin 1.0.37 → 1.0.38

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.
Files changed (2) hide show
  1. package/gologin.js +18 -10
  2. package/package.json +1 -1
package/gologin.js CHANGED
@@ -123,12 +123,17 @@ class GoLogin {
123
123
  'Authorization': `Bearer ${this.access_token}`
124
124
  }
125
125
  })
126
- debug(profileResponse.body);
126
+ debug("profileResponse", profileResponse.statusCode, profileResponse.body);
127
+
127
128
 
128
129
  if (profileResponse.statusCode === 404) {
129
130
  throw new Error(JSON.parse(profileResponse.body).message);
130
131
  }
131
132
 
133
+ if (profileResponse.statusCode === 403) {
134
+ throw new Error(JSON.parse(profileResponse.body).message);
135
+ }
136
+
132
137
  if (profileResponse.statusCode !== 200) {
133
138
  throw new Error(`Gologin /browser/${id} response error ${profileResponse.statusCode} INVALID TOKEN OR PROFILE NOT FOUND`);
134
139
  }
@@ -1142,25 +1147,28 @@ class GoLogin {
1142
1147
 
1143
1148
  async startRemote(delay_ms = 10000) {
1144
1149
  debug(`startRemote ${this.profile_id}`);
1150
+
1151
+ /*
1152
+ if (profileResponse.statusCode !== 202) {
1153
+ return {'status': 'failure', 'code': profileResponse.statusCode};
1154
+ }
1155
+ */
1156
+
1157
+ // if (profileResponse.body === 'ok') {
1158
+ const profile = await this.getProfile();
1159
+
1145
1160
  const profileResponse = await requests.post(`https://api.gologin.com/browser/${this.profile_id}/web`, {
1146
1161
  headers: {
1147
1162
  'Authorization': `Bearer ${this.access_token}`
1148
1163
  }
1149
1164
  });
1165
+
1166
+ debug('profileResponse', profileResponse.statusCode, profileResponse.body);
1150
1167
 
1151
1168
  if (profileResponse.statusCode === 401){
1152
1169
  throw new Error("invalid token");
1153
1170
  }
1154
1171
 
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
1172
  const { navigator = {}, fonts, os: profileOs } = profile;
1165
1173
  this.fontsMasking = fonts?.enableMasking;
1166
1174
  this.profileOs = profileOs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gologin",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "A high-level API to control Orbita browser over GoLogin API",
5
5
  "main": "./gologin.js",
6
6
  "repository": {