@blazes/captcha 1.0.21 → 1.0.23

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/Readme.md +85 -0
  2. package/package.json +18 -6
package/Readme.md ADDED
@@ -0,0 +1,85 @@
1
+ # 背景
2
+
3
+ 点击发送验证码按钮时候,用户需要将图片滑动至指定位置,才会真正发送。
4
+ 防止玩家或者脚本等频繁调用验证码接口。
5
+
6
+ # 安装
7
+
8
+ npm
9
+
10
+ ```shell
11
+ npm install @blazes/captcha
12
+ ```
13
+
14
+ yarn
15
+
16
+ ```shell
17
+ yarn add @blazes/captcha
18
+ ```
19
+
20
+ CDN
21
+
22
+ ```html
23
+ <head>
24
+ ...
25
+ <link
26
+ rel="stylesheet"
27
+ href="https://captcha.resource.pandadagames.com/statics/style.css"
28
+ />
29
+ </head>
30
+ <body></body>
31
+ <script src="https://captcha.resource.pandadagames.com/statics/index.js"></script>
32
+ ```
33
+
34
+ # API
35
+
36
+ ## 实例化参数
37
+
38
+
39
+
40
+ | 属性 | 说明 | 必填 | 类型 |
41
+ | --- | ---- | --- | --- |
42
+ | appId | 接入的应用 id | 是 | string |
43
+ | version | 版本信息,不同版本产生背景图不一样,目前只有 v1 | 是 | string |
44
+ | baseUrl | 后端地址,需要配置 cors | 是 | string |
45
+ | success | 验证成功后的回调函数 | 是 | (token: string) => string |
46
+ | lang | 语言 | 是 | 枚举,hans | hant | ja | en | ko |
47
+
48
+ ## 方法
49
+
50
+ | 名称 | 说明 | 入参 | 回参 |
51
+ | --- | --- | --- | --- |
52
+ | show | 显示验证码。验证成功会返回 token 的 promise | 无 | Promise<string> |
53
+ | resetConfig | 重置配置 | 和实例化传入参数一致,但都是选填。 | 无 |
54
+
55
+ # 使用
56
+
57
+ ## CDN 引入
58
+
59
+ ```Typescript
60
+ const myCaptcha = new yh_captcha.Captcha({
61
+ appId: "giftcode",
62
+ version: "v1",
63
+ baseUrl: "http://52.74.243.209:18081"
64
+ success: function (token) {},
65
+ lang: "ja",
66
+ });
67
+ myCaptcha.show().then(() => {});
68
+ ```
69
+
70
+ ## npm引入
71
+
72
+ ```Typescript
73
+ import { Captcha, Language } from "@blazes/captcha";
74
+ import "@blazes/captcha/dist/style.css";
75
+
76
+ const myCaptcha = new Captcha({
77
+ appId: "giftcode",
78
+ version: "v1",
79
+ baseUrl: "http://52.74.243.209:18081",
80
+ success: function (token) {},
81
+ lang: Language.JA,
82
+ });
83
+ myCaptcha.show().then(() => {});
84
+ ```
85
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazes/captcha",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "滑动验证块",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,7 +12,8 @@
12
12
  },
13
13
  "scripts": {
14
14
  "serve": "webpack-dev-server --config build/webpack.config.dev.js",
15
- "build": "webpack --config build/webpack.config.prod.js && tsc --emitDeclarationOnly"
15
+ "build": "webpack --config build/webpack.config.prod.js && tsc --emitDeclarationOnly",
16
+ "cm": "git-cz"
16
17
  },
17
18
  "author": "",
18
19
  "license": "ISC",
@@ -25,13 +26,11 @@
25
26
  "@babel/preset-typescript": "^7.16.7",
26
27
  "autoprefixer": "^9.8.0",
27
28
  "babel-loader": "^8.2.5",
28
- "postcss-loader": "^3.0.0",
29
- "ts-loader": "^6.2.2",
30
- "typescript": "^4.6.4",
31
- "url-loader": "^4.1.1",
32
29
  "clean-webpack-plugin": "^3.0.0",
30
+ "commitizen": "^4.2.4",
33
31
  "copy-webpack-plugin": "^6.0.4",
34
32
  "css-loader": "^3.5.3",
33
+ "cz-conventional-changelog": "^3.3.0",
35
34
  "file-loader": "^4.2.0",
36
35
  "html-webpack-plugin": "^3.2.0",
37
36
  "less": "^3.0.4",
@@ -39,9 +38,22 @@
39
38
  "less-plugin-npm-import": "^2.1.0",
40
39
  "mini-css-extract-plugin": "^0.9.0",
41
40
  "optimize-css-assets-webpack-plugin": "^6.0.0",
41
+ "postcss-loader": "^3.0.0",
42
+ "ts-loader": "^6.2.2",
43
+ "typescript": "^4.6.4",
44
+ "url-loader": "^4.1.1",
42
45
  "webpack": "^4.0.0",
43
46
  "webpack-cli": "^3.3.10",
44
47
  "webpack-dev-server": "^3.11.0",
45
48
  "webpack-merge": "^4.2.2"
49
+ },
50
+ "config": {
51
+ "commitizen": {
52
+ "path": "./node_modules/cz-conventional-changelog"
53
+ }
54
+ },
55
+ "volta": {
56
+ "node": "16.20.2",
57
+ "yarn": "1.22.19"
46
58
  }
47
59
  }