gologin 1.0.39 → 1.0.40

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.
@@ -58,9 +58,9 @@ class BrowserUserDataManager {
58
58
  const fontsToDownload = fontsList.filter(font => !files.includes(font));
59
59
 
60
60
  let promises = fontsToDownload.map(font => request.get(FONTS_URL + font, {
61
- maxAttempts: 3,
61
+ maxAttempts: 5,
62
62
  retryDelay: 2000,
63
- timeout: 10 * 1000,
63
+ timeout: 30 * 1000,
64
64
  })
65
65
  .pipe(createWriteStream(path.join(browserFontsPath, font)))
66
66
  );
package/gologin.js CHANGED
@@ -225,7 +225,7 @@ class GoLogin {
225
225
 
226
226
  async emptyProfileFolder() {
227
227
  debug('get emptyProfileFolder');
228
- const profile = await readFile(path.resolve(__dirname, 'gologin_zeroprofile.zip'));
228
+ const profile = await readFile(path.resolve(__dirname, 'zero_profile.zip'));
229
229
  debug('emptyProfileFolder LENGTH ::', profile.length);
230
230
  return profile;
231
231
  }
@@ -286,10 +286,6 @@ class GoLogin {
286
286
  );
287
287
  }
288
288
 
289
- async checkLocalProfile() {
290
-
291
- }
292
-
293
289
  async createStartup(local=false) {
294
290
  const profilePath = path.join(this.tmpdir, `gologin_profile_${this.profile_id}`);
295
291
  let profile;
@@ -341,8 +337,15 @@ class GoLogin {
341
337
 
342
338
  debug('Cleaning up..', profilePath);
343
339
 
344
- await this.extractProfile(profilePath, this.profile_zip_path);
345
- debug('extraction done');
340
+ try {
341
+ await this.extractProfile(profilePath, this.profile_zip_path);
342
+ debug('extraction done');
343
+ } catch(e) {
344
+ console.trace(e);
345
+ profile_folder = await this.emptyProfileFolder();
346
+ await writeFile(this.profile_zip_path, profile_folder);
347
+ await this.extractProfile(profilePath, this.profile_zip_path);
348
+ }
346
349
 
347
350
  const singletonLockPath = path.join(profilePath, 'SingletonLock');
348
351
  const singletonLockExists = await access(singletonLockPath).then(() => true).catch(() => false);
@@ -361,7 +364,7 @@ class GoLogin {
361
364
  }
362
365
 
363
366
  const preferences_raw = await readFile(pref_file_name);
364
- let preferences = JSON.parse(preferences_raw.toString());
367
+ let preferences = JSON.parse(preferences_raw.toString());
365
368
  let proxy = _.get(profile, 'proxy');
366
369
  let name = _.get(profile, 'name');
367
370
 
@@ -457,10 +460,19 @@ class GoLogin {
457
460
  throw new Error('No fonts list provided');
458
461
  }
459
462
 
460
- await BrowserUserDataManager.composeFonts(families, profilePath, this.differentOs);
463
+ try{
464
+ await BrowserUserDataManager.composeFonts(families, profilePath, this.differentOs);
465
+ } catch (e) {
466
+ console.trace(e);
467
+ }
461
468
  }
462
469
 
463
470
  const [languages] = this.language.split(';');
471
+
472
+ if(preferences.gologin==null){
473
+ preferences.gologin = {};
474
+ }
475
+
464
476
  preferences.gologin.langHeader = gologin.language;
465
477
  preferences.gologin.languages = languages;
466
478
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gologin",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "A high-level API to control Orbita browser over GoLogin API",
5
5
  "main": "./gologin.js",
6
6
  "repository": {
Binary file
Binary file