@jayfong/x-server 2.17.1 → 2.17.3

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.
@@ -5,12 +5,14 @@ exports.__esModule = true;
5
5
  exports.Handler = void 0;
6
6
  var _lzString = _interopRequireDefault(require("lz-string"));
7
7
  var _vtils = require("vtils");
8
- var _dispose = require("../services/dispose");
9
- var _http_error = require("../core/http_error");
10
8
  var _validator = require("vtils/validator");
9
+ var _http_error = require("../core/http_error");
10
+ var _dispose = require("../services/dispose");
11
11
  // @ts-ignore
12
12
  // prettier-ignore
13
-
13
+ _validator.yup.setLocale((0, _validator.getZhCN)({
14
+ getLabel: params => params.label || params.path
15
+ }));
14
16
  class Handler {
15
17
  constructor(options) {
16
18
  this.options = options;
@@ -42,7 +42,8 @@ class CaptchaService {
42
42
  text: code,
43
43
  data: svg
44
44
  } = _svgCaptcha.default.create({
45
- size: payload.size
45
+ size: payload.size,
46
+ charPreset: this.charsetMap[payload.charset].join('')
46
47
  });
47
48
  const token = await _x.x.cache.save({
48
49
  code,
@@ -1,5 +1,5 @@
1
1
  import type { XHandler } from './types';
2
- export type { HandlerPath, HandlerPayloadMap, HandlerResultMap, HandlerMethodMap } from '.x/routes';
2
+ export type { HandlerMethodMap, HandlerPath, HandlerPayloadMap, HandlerResultMap } from '.x/routes';
3
3
  export declare class Handler<TReqData extends any = void, TResData extends any = void, TReqMethod extends XHandler.Method = XHandler.Method> {
4
4
  readonly options: XHandler.Options<TReqData, TResData, TReqMethod>;
5
5
  private requestDataSchema;
@@ -1,11 +1,14 @@
1
1
  import LZString from 'lz-string';
2
2
  import { DataPacker } from 'vtils';
3
- import { DisposeService } from "../services/dispose";
3
+ import { getZhCN, yup } from 'vtils/validator';
4
4
  import { HttpError } from "../core/http_error";
5
- import { yup } from 'vtils/validator';
5
+ import { DisposeService } from "../services/dispose";
6
6
 
7
7
  // @ts-ignore
8
8
  // prettier-ignore
9
+ yup.setLocale(getZhCN({
10
+ getLabel: params => params.label || params.path
11
+ }));
9
12
  export class Handler {
10
13
  constructor(options) {
11
14
  this.options = options;
@@ -37,7 +37,8 @@ export class CaptchaService {
37
37
  text: code,
38
38
  data: svg
39
39
  } = svgCaptcha.create({
40
- size: payload.size
40
+ size: payload.size,
41
+ charPreset: this.charsetMap[payload.charset].join('')
41
42
  });
42
43
  const token = await x.cache.save({
43
44
  code,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.17.1",
3
+ "version": "2.17.3",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",
@@ -67,7 +67,7 @@
67
67
  "tsx": "^3.12.7",
68
68
  "utf-8-validate": "^5.0.9",
69
69
  "vscode-generate-index-standalone": "^1.7.1",
70
- "vtils": "^4.85.3",
70
+ "vtils": "^4.87.0",
71
71
  "yaml": "^2.3.1",
72
72
  "yargs": "^17.4.1"
73
73
  },