@funnycaptcha/cli 0.3.0 → 0.6.1
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/cli.js +28 -14
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -109,7 +109,11 @@ function getDemoHTML() {
|
|
|
109
109
|
{ type: 'anti-bot', zh: '\u53CD\u4EBA\u7C7B\u8BBD\u523A', en: 'Anti-Bot Satire', descZh: '\u673A\u5668\u4EBA\u6CE8\u5165 JS \u5C31\u80FD\u901A\u8FC7', descEn: 'Bots can inject JS to pass' },
|
|
110
110
|
{ type: 'click-text', zh: '\u6587\u5B57\u70B9\u9009', en: 'Click Text', descZh: '\u6309\u987A\u5E8F\u70B9\u51FB\u6307\u5B9A\u6C49\u5B57', descEn: 'Click characters in order' },
|
|
111
111
|
{ type: 'color-pick', zh: '\u989C\u8272\u9009\u62E9', en: 'Color Pick', descZh: '\u70B9\u51FB\u6307\u5B9A\u989C\u8272\u7684\u65B9\u5757', descEn: 'Pick the right color' },
|
|
112
|
-
{ type: 'puzzle', zh: '\u62FC\u56FE\u7F3A\u53E3', en: 'Puzzle Gap', descZh: '\u62D6\u52A8\u62FC\u56FE\u5230\u7F3A\u53E3\u4F4D\u7F6E', descEn: 'Drag puzzle to the gap' }
|
|
112
|
+
{ type: 'puzzle', zh: '\u62FC\u56FE\u7F3A\u53E3', en: 'Puzzle Gap', descZh: '\u62D6\u52A8\u62FC\u56FE\u5230\u7F3A\u53E3\u4F4D\u7F6E', descEn: 'Drag puzzle to the gap' },
|
|
113
|
+
{ type: 'advanced-math', zh: '\u9AD8\u7B49\u6570\u5B66', en: 'Calculus', descZh: '\u6C42\u5BFC\u3001\u79EF\u5206\u3001\u6781\u9650', descEn: 'Derivatives, integrals, limits' },
|
|
114
|
+
{ type: 'olympiad', zh: '\u5C0F\u5B66\u5965\u6570', en: 'Math Olympiad', descZh: '\u9E21\u5154\u540C\u7B3C\u3001\u690D\u6811\u3001\u884C\u7A0B', descEn: 'Classic word problems' },
|
|
115
|
+
{ type: 'equation-balance', zh: '\u65B9\u7A0B\u5F0F\u914D\u5E73', en: 'Balance Equation', descZh: '\u914D\u5E73\u5316\u5B66\u65B9\u7A0B\u5F0F\u7CFB\u6570', descEn: 'Balance chemical equations' },
|
|
116
|
+
{ type: 'random-hunt', zh: '\u968F\u673A\u6570\u730E\u624B', en: 'Random Hunter', descZh: '\u6570\u5B57\u6EE1\u8DB3\u6761\u4EF6\u65F6\u6355\u83B7', descEn: 'Catch the number when it matches' }
|
|
113
117
|
];
|
|
114
118
|
var locale = 'zh';
|
|
115
119
|
var theme = 'dark';
|
|
@@ -164,7 +168,6 @@ function openBrowser(url) {
|
|
|
164
168
|
}
|
|
165
169
|
});
|
|
166
170
|
}
|
|
167
|
-
var port = 3e3;
|
|
168
171
|
var server = createServer((req, res) => {
|
|
169
172
|
if (req.url === "/" || req.url === "/index.html") {
|
|
170
173
|
const html = getDemoHTML();
|
|
@@ -175,18 +178,29 @@ var server = createServer((req, res) => {
|
|
|
175
178
|
res.end("Not found");
|
|
176
179
|
}
|
|
177
180
|
});
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
181
|
+
function startOnAvailablePort(startPort) {
|
|
182
|
+
server.once("error", (err) => {
|
|
183
|
+
if (err.code === "EADDRINUSE" && startPort < 3100) {
|
|
184
|
+
startOnAvailablePort(startPort + 1);
|
|
185
|
+
} else {
|
|
186
|
+
console.error(`\u65E0\u6CD5\u542F\u52A8\u670D\u52A1\u5668: ${err.message}`);
|
|
187
|
+
process.exit(1);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
server.listen(startPort, () => {
|
|
191
|
+
const url = `http://localhost:${startPort}`;
|
|
192
|
+
console.log("");
|
|
193
|
+
console.log(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
|
|
194
|
+
console.log(" \u2551 FunnyChapter CLI Demo \u2551");
|
|
195
|
+
console.log(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
|
|
196
|
+
console.log("");
|
|
197
|
+
console.log(` \u279C Demo: ${url}`);
|
|
198
|
+
console.log(` \u279C \u6309 Ctrl+C \u9000\u51FA`);
|
|
199
|
+
console.log("");
|
|
200
|
+
openBrowser(url);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
startOnAvailablePort(3e3);
|
|
190
204
|
process.on("SIGINT", () => {
|
|
191
205
|
console.log("\n \u518D\u89C1\uFF01");
|
|
192
206
|
server.close();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnycaptcha/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "FunnyChapter CLI — 在终端输入 funnycaptcha 即可打开 demo",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@funnycaptcha/embed": "0.
|
|
14
|
+
"@funnycaptcha/embed": "0.6.0"
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public",
|