gologin 2.1.1 → 2.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gologin",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "A high-level API to control Orbita browser over GoLogin API",
5
5
  "types": "./index.d.ts",
6
6
  "main": "./src/gologin.js",
@@ -3,10 +3,9 @@ import { promises as _promises } from 'fs';
3
3
  const { readFile } = _promises;
4
4
 
5
5
  export const getCurrentProfileBookmarks = async (pathToBookmarks) => {
6
- const currentBookmarksFileData = await readFile(pathToBookmarks, { encoding: 'utf-8' });
7
-
8
6
  let bookmarks = {};
9
7
  try {
8
+ const currentBookmarksFileData = await readFile(pathToBookmarks, { encoding: 'utf-8' });
10
9
  bookmarks = JSON.parse(currentBookmarksFileData);
11
10
  } catch (error) {
12
11
  console.log(error);
@@ -1,9 +1,9 @@
1
1
  import { createHash } from 'crypto';
2
2
  import { createWriteStream, promises as _promises, rmdirSync } from 'fs';
3
3
  import { homedir, tmpdir } from 'os';
4
- import { join, resolve, sep, dirname } from 'path';
5
- import { fileURLToPath } from 'url';
4
+ import { dirname, join, resolve, sep } from 'path';
6
5
  import requestretry from 'requestretry';
6
+ import { fileURLToPath } from 'url';
7
7
 
8
8
  import { fontsCollection } from '../../fonts.js';
9
9
 
@@ -40,7 +40,7 @@ export const downloadCookies = ({ profileId, ACCESS_TOKEN, API_BASE_URL }) =>
40
40
  });
41
41
 
42
42
  export const uploadCookies = ({ cookies = [], profileId, ACCESS_TOKEN, API_BASE_URL }) =>
43
- requestretry.post(`${API_BASE_URL}/browser/${profileId}/cookies/?encrypted=true`, {
43
+ requestretry.post(`${API_BASE_URL}/browser/${profileId}/cookies?encrypted=true`, {
44
44
  headers: {
45
45
  Authorization: `Bearer ${ACCESS_TOKEN}`,
46
46
  'User-Agent': 'gologin-api',
package/src/gologin.js CHANGED
@@ -526,7 +526,7 @@ export class GoLogin {
526
526
 
527
527
  await this.getTimeZone(proxy).catch((e) => {
528
528
  console.error('Proxy Error. Check it and try again.');
529
- throw e;
529
+ throw new Error(`Proxy Error. ${e.message}`);
530
530
  });
531
531
 
532
532
  const [latitude, longitude] = this._tz.ll;
@@ -1458,7 +1458,7 @@ export class GoLogin {
1458
1458
 
1459
1459
  const profile = await this.getProfile();
1460
1460
  const profileResponse = await requests.post(`${API_URL}/browser/${this.profile_id}/web`, {
1461
- headers: { 'Authorization': `Bearer ${this.access_token}`, 'User-Agent': 'gologin-api', },
1461
+ headers: { 'Authorization': `Bearer ${this.access_token}`, 'User-Agent': 'gologin-api' },
1462
1462
  json: { isNewCloudBrowser: this.isNewCloudBrowser, isHeadless: this.isCloudHeadless },
1463
1463
  }).catch(() => null);
1464
1464