@azuro-org/images-generator 1.3.3 → 1.3.5

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/dist/index.es.js CHANGED
@@ -65,6 +65,7 @@ function __generator(thisArg, body) {
65
65
  devtools: false,
66
66
  args: [
67
67
  '--no-sandbox',
68
+ '--disable-setuid-sandbox',
68
69
  '--disable-gpu',
69
70
  '--disable-accelerated-video-decode',
70
71
  // '--allow-file-access-from-files',
@@ -79,6 +80,7 @@ function __generator(thisArg, body) {
79
80
  return [4 /*yield*/, browser.newPage()];
80
81
  case 3:
81
82
  page = _d.sent();
83
+ page.setDefaultNavigationTimeout(0);
82
84
  return [4 /*yield*/, page.setViewport({
83
85
  width: width,
84
86
  height: height,
@@ -86,9 +88,7 @@ function __generator(thisArg, body) {
86
88
  })];
87
89
  case 4:
88
90
  _d.sent();
89
- return [4 /*yield*/, page.goto("data:text/html;charset=UTF-8,".concat(encodeURIComponent(html)), {
90
- waitUntil: 'networkidle0',
91
- })];
91
+ return [4 /*yield*/, page.setContent(html, { waitUntil: 'domcontentloaded' })];
92
92
  case 5:
93
93
  _d.sent();
94
94
  return [4 /*yield*/, page.$('body')
@@ -201,7 +201,7 @@
201
201
  .arrow {
202
202
  width: 24px;
203
203
  height: 24px;
204
- margin-top: 2px;
204
+ margin-top: 3px;
205
205
  margin-bottom: -3px;
206
206
  }
207
207
 
@@ -1,12 +1,10 @@
1
1
  import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image,d as downloadImage}from'../../index-82868da9.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'assert';import'tty';import'zlib';import'events';var cardTypes = {
2
2
  'profit': {
3
3
  rightImg: 'images/profit.png',
4
- arrow: 'images/arrow-up.png',
5
4
  bgColor: '#72FF4B',
6
5
  },
7
6
  'loss': {
8
7
  rightImg: 'images/loss.png',
9
- arrow: 'images/arrow-down.png',
10
8
  bgColor: '#FF604B',
11
9
  }
12
10
  };
@@ -15,20 +13,20 @@ var template = {
15
13
  height: 445,
16
14
  type: 'jpeg',
17
15
  html: function (props) { return __awaiter(void 0, void 0, void 0, function () {
18
- var type, trend, pnl, position, referralUrl, isProfit, _a, rightImg, arrow, bgColor, leverage, isLong, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
16
+ var type, trend, pnl, position, referralUrl, isProfit, _a, rightImg, bgColor, leverage, isLong, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
19
17
  return __generator(this, function (_b) {
20
18
  switch (_b.label) {
21
19
  case 0:
22
20
  type = props.type, trend = props.trend, pnl = props.pnl, position = props.position, referralUrl = props.referralUrl;
23
21
  isProfit = pnl > 0;
24
- _a = isProfit ? cardTypes.profit : cardTypes.loss, rightImg = _a.rightImg, arrow = _a.arrow, bgColor = _a.bgColor;
22
+ _a = isProfit ? cardTypes.profit : cardTypes.loss, rightImg = _a.rightImg, bgColor = _a.bgColor;
25
23
  leverage = position.leverage, isLong = position.isLong;
26
24
  html = getFile(path.join(__dirname, 'index.html'));
27
25
  logo = getBase64Image(path.resolve(__dirname, 'images/logo.png'));
28
26
  bgImage = getBase64Image(path.resolve(__dirname, 'images/bg.png'));
29
27
  rightImage = getBase64Image(path.resolve(__dirname, rightImg));
30
28
  personImage = getBase64Image(path.resolve(__dirname, "images/".concat(type, ".png")));
31
- arrowImage = getBase64Image(path.resolve(__dirname, arrow));
29
+ arrowImage = getBase64Image(path.resolve(__dirname, isLong ? 'images/arrow-up.png' : 'images/arrow-down.png'));
32
30
  return [4 /*yield*/, downloadImage(trend.image)];
33
31
  case 1:
34
32
  trendImage = _b.sent();
package/lib/index.js CHANGED
@@ -65,6 +65,7 @@ function __generator(thisArg, body) {
65
65
  devtools: false,
66
66
  args: [
67
67
  '--no-sandbox',
68
+ '--disable-setuid-sandbox',
68
69
  '--disable-gpu',
69
70
  '--disable-accelerated-video-decode',
70
71
  // '--allow-file-access-from-files',
@@ -79,6 +80,7 @@ function __generator(thisArg, body) {
79
80
  return [4 /*yield*/, browser.newPage()];
80
81
  case 3:
81
82
  page = _d.sent();
83
+ page.setDefaultNavigationTimeout(0);
82
84
  return [4 /*yield*/, page.setViewport({
83
85
  width: width,
84
86
  height: height,
@@ -86,9 +88,7 @@ function __generator(thisArg, body) {
86
88
  })];
87
89
  case 4:
88
90
  _d.sent();
89
- return [4 /*yield*/, page.goto("data:text/html;charset=UTF-8,".concat(encodeURIComponent(html)), {
90
- waitUntil: 'networkidle0',
91
- })];
91
+ return [4 /*yield*/, page.setContent(html, { waitUntil: 'domcontentloaded' })];
92
92
  case 5:
93
93
  _d.sent();
94
94
  return [4 /*yield*/, page.$('body')
@@ -201,7 +201,7 @@
201
201
  .arrow {
202
202
  width: 24px;
203
203
  height: 24px;
204
- margin-top: 2px;
204
+ margin-top: 3px;
205
205
  margin-bottom: -3px;
206
206
  }
207
207
 
@@ -1,12 +1,10 @@
1
1
  'use strict';var index=require('../../index-de0b52f4.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var cardTypes = {
2
2
  'profit': {
3
3
  rightImg: 'images/profit.png',
4
- arrow: 'images/arrow-up.png',
5
4
  bgColor: '#72FF4B',
6
5
  },
7
6
  'loss': {
8
7
  rightImg: 'images/loss.png',
9
- arrow: 'images/arrow-down.png',
10
8
  bgColor: '#FF604B',
11
9
  }
12
10
  };
@@ -15,20 +13,20 @@ var template = {
15
13
  height: 445,
16
14
  type: 'jpeg',
17
15
  html: function (props) { return index._(void 0, void 0, void 0, function () {
18
- var type, trend, pnl, position, referralUrl, isProfit, _a, rightImg, arrow, bgColor, leverage, isLong, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
16
+ var type, trend, pnl, position, referralUrl, isProfit, _a, rightImg, bgColor, leverage, isLong, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
19
17
  return index.a(this, function (_b) {
20
18
  switch (_b.label) {
21
19
  case 0:
22
20
  type = props.type, trend = props.trend, pnl = props.pnl, position = props.position, referralUrl = props.referralUrl;
23
21
  isProfit = pnl > 0;
24
- _a = isProfit ? cardTypes.profit : cardTypes.loss, rightImg = _a.rightImg, arrow = _a.arrow, bgColor = _a.bgColor;
22
+ _a = isProfit ? cardTypes.profit : cardTypes.loss, rightImg = _a.rightImg, bgColor = _a.bgColor;
25
23
  leverage = position.leverage, isLong = position.isLong;
26
24
  html = index.g(path__default["default"].join(__dirname, 'index.html'));
27
25
  logo = index.b(path__default["default"].resolve(__dirname, 'images/logo.png'));
28
26
  bgImage = index.b(path__default["default"].resolve(__dirname, 'images/bg.png'));
29
27
  rightImage = index.b(path__default["default"].resolve(__dirname, rightImg));
30
28
  personImage = index.b(path__default["default"].resolve(__dirname, "images/".concat(type, ".png")));
31
- arrowImage = index.b(path__default["default"].resolve(__dirname, arrow));
29
+ arrowImage = index.b(path__default["default"].resolve(__dirname, isLong ? 'images/arrow-up.png' : 'images/arrow-down.png'));
32
30
  return [4 /*yield*/, index.d(trend.image)];
33
31
  case 1:
34
32
  trendImage = _b.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azuro-org/images-generator",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "license": "ISC",
5
5
  "engines": {
6
6
  "node": ">=16.15.1",