abler-api 1.0.56 → 1.0.63

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/dist/cjs/pp-util.js +7 -24
  2. package/package.json +7 -25
@@ -222,7 +222,7 @@ async function checkRedis() {
222
222
  redis.error = e;
223
223
  });
224
224
  if (redis.error) {
225
- console.log(t_f$3("未能成功連接 redis: %s,請檢查相關設置", redis.error));
225
+ console.log(t_f$3("未能成功連接 red\n" + "npm\n" + "Search packages\n" + "Search\nis: %s,請檢查相關設置", redis.error));
226
226
  return t_f$3("未能成功連接 redis: %s,請檢查相關設置", redis.error);
227
227
  }
228
228
  // console.log(`checkRedis done:`);
@@ -232,13 +232,8 @@ async function initDb() {
232
232
  try {
233
233
  await dbUtil$1.config(conf$3, err$1);
234
234
  } catch (e) {
235
- if (e.reason === 'bad decrypt') {
236
- e = new Error(t_f$3("解密数据库密码(%s)失败", conf$3.dbconn.dbpwd));
237
- }
238
- // if (e.reason === 'bad decrypt') {
239
- // e = new Error(`解密Redis密码(${conf.redis.password})失败`);
240
- // }
241
- return t_f$3("初始化数据库连接失败(%s)", e.message);
235
+ let message = e.reason === 'bad decrypt' ? t_f$3("解密数据库密码(%s)失败", conf$3.dbConf.dbpwd) : e.message;
236
+ return t_f$3("初始化数据库连接失败(%s)", message);
242
237
  }
243
238
  }
244
239
  async function initKvStorage(dbSql) {
@@ -675,7 +670,7 @@ class apiUtil$2 {
675
670
  * @param req
676
671
  * @param res
677
672
  * @param noErr
678
- * @returns {Promise<*>}
673
+ * @returns {string | undefined}
679
674
  */
680
675
  static extractToken(req, res, noErr) {
681
676
  configNeeded();
@@ -1381,7 +1376,7 @@ class apiUtil$2 {
1381
1376
  static decryptContent(content, cek) {
1382
1377
  this.validCek(cek);
1383
1378
  try {
1384
- const result = ppCrypto.decryptData(content, cek.key, 'utf8');
1379
+ const result = ppCrypto.decryptData(content, cek.key, 'base64', 'utf8');
1385
1380
  if (result.startsWith('{') || result.startsWith('[')) {
1386
1381
  return JSON.parse(result);
1387
1382
  }
@@ -1901,20 +1896,8 @@ class apiUtil$2 {
1901
1896
  * 创建验证码对象
1902
1897
  * npm i svg-captcha
1903
1898
  */
1904
- static createSvgCaptcha(options) {
1905
- const captcha = svgCaptcha.create({
1906
- inverse: options.hasOwnProperty('inverse') ? options.inverse : false,
1907
- fontSize: options.fontSize || 48,
1908
- noise: options.noise || 2,
1909
- width: options.width || 150,
1910
- height: options.height || 75,
1911
- size: options.size || 4,
1912
- charPreset: options.charPreset || '0123456789',
1913
- ignoreChars: options.ignoreChars || '0oli',
1914
- color: options.hasOwnProperty('color') ? options.color : true,
1915
- background: options.background || '#cc9966'
1916
- });
1917
- return captcha;
1899
+ static async createSvgCaptcha(...args) {
1900
+ return await ppUtil$3.createCaptcha(...args);
1918
1901
  }
1919
1902
 
1920
1903
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abler-api",
3
- "version": "1.0.56",
3
+ "version": "1.0.63",
4
4
  "description": "API服务相关工具",
5
5
  "main": "./dist/cjs/pp-util.js",
6
6
  "-module": "./dist/es/pp-util.js",
@@ -15,33 +15,15 @@
15
15
  "author": "peng_peng",
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "abler-db": "^1.0.62",
19
- "abler-i18n": "^1.0.9",
20
- "abler-messenger": "^1.1.19",
21
- "abler-net": "^1.0.23",
22
- "abler-util": "^1.0.23",
18
+ "abler-db": "^1.0.71",
19
+ "abler-i18n": "^1.0.15",
20
+ "abler-messenger": "^1.1.26",
21
+ "abler-net": "^1.0.30",
22
+ "abler-util": "^1.0.30",
23
23
  "basic-auth": "^2.0.1",
24
24
  "node-cron": "^3.0.1",
25
25
  "proxy-agent": "6.5.0",
26
26
  "q": "^1.5.1"
27
27
  },
28
- "devDependencies": {
29
- "@babel/core": "^7.18.5",
30
- "@babel/eslint-parser": "^7.18.2",
31
- "@babel/plugin-transform-runtime": "^7.18.0",
32
- "@babel/preset-env": "^7.18.2",
33
- "@babel/runtime": "^7.18.0",
34
- "@rollup/plugin-babel": "^5.3.1",
35
- "@rollup/plugin-commonjs": "^22.0.0",
36
- "@rollup/plugin-eslint": "^8.0.2",
37
- "@rollup/plugin-node-resolve": "^13.3.0",
38
- "@typescript-eslint/eslint-plugin": "^5.25.0",
39
- "@typescript-eslint/parser": "^5.25.0",
40
- "eslint": "^8.16.0",
41
- "eslint-plugin-react": "^7.30.0",
42
- "rollup-plugin-filesize": "^10.0.0",
43
- "rollup-plugin-json": "^4.0.0",
44
- "rollup-plugin-terser": "^7.0.2"
45
- },
46
- "gitHead": "8027625bd8e5fd989382976d42a2404d4f4b68ce"
28
+ "gitHead": "b353de2389423d7493db7c11777e19b52f11e341"
47
29
  }