@maiyunnet/kebab 2.0.14 → 2.0.16
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/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/buffer.js +3 -9
- package/lib/captcha.js +2 -2
- package/lib/consistent.js +1 -1
- package/lib/core.d.ts +42 -18
- package/lib/core.js +147 -152
- package/lib/crypto.js +2 -2
- package/lib/db.d.ts +3 -3
- package/lib/db.js +32 -73
- package/lib/dns.d.ts +1 -1
- package/lib/dns.js +5 -5
- package/lib/fs.js +17 -9
- package/lib/jwt.d.ts +3 -3
- package/lib/jwt.js +5 -5
- package/lib/kv.d.ts +2 -2
- package/lib/kv.js +2 -2
- package/lib/lan.js +1 -1
- package/lib/net/formdata.js +2 -2
- package/lib/net/request.d.ts +1 -1
- package/lib/net/request.js +1 -1
- package/lib/net/response.d.ts +1 -1
- package/lib/net.d.ts +2 -2
- package/lib/net.js +4 -4
- package/lib/s3.d.ts +1 -1
- package/lib/s3.js +5 -5
- package/lib/scan.d.ts +3 -3
- package/lib/scan.js +6 -6
- package/lib/session.d.ts +3 -3
- package/lib/session.js +7 -7
- package/lib/sql.d.ts +3 -3
- package/lib/sql.js +7 -37
- package/lib/ssh/sftp.js +2 -2
- package/lib/ssh/shell.js +1 -1
- package/lib/text.d.ts +6 -1
- package/lib/text.js +9 -1
- package/lib/time.d.ts +1 -1
- package/lib/time.js +1 -1
- package/lib/turnstile.d.ts +1 -1
- package/lib/turnstile.js +2 -2
- package/lib/ws.d.ts +10 -2
- package/lib/ws.js +62 -3
- package/lib/zip.d.ts +1 -1
- package/lib/zip.js +5 -11
- package/lib/zlib.js +7 -21
- package/package.json +5 -4
- package/sys/child.js +43 -84
- package/sys/cmd.js +7 -6
- package/sys/ctr.d.ts +2 -2
- package/sys/ctr.js +2 -2
- package/sys/master.js +131 -9
- package/sys/mod.d.ts +4 -4
- package/sys/mod.js +24 -176
- package/sys/route.d.ts +1 -1
- package/sys/route.js +22 -20
- package/www/example/ctr/main.d.ts +1 -1
- package/www/example/ctr/main.js +1 -1
- package/www/example/ctr/middle.d.ts +2 -2
- package/www/example/ctr/middle.js +1 -1
- package/www/example/ctr/test.d.ts +3 -2
- package/www/example/ctr/test.js +83 -30
- package/www/example/mod/test.d.ts +2 -2
- package/www/example/mod/test.js +2 -2
- package/www/example/mod/testdata.d.ts +1 -1
- package/www/example/mod/testdata.js +1 -1
- package/www/example/ws/mproxy.d.ts +1 -1
- package/www/example/ws/mproxy.js +2 -2
- package/www/example/ws/rproxy.d.ts +1 -1
- package/www/example/ws/rproxy.js +2 -2
- package/www/example/ws/rsocket.d.ts +4 -0
- package/www/example/ws/rsocket.js +47 -0
- package/www/example/ws/test.d.ts +6 -1
- package/www/example/ws/test.js +10 -3
package/www/example/ctr/test.js
CHANGED
|
@@ -37,27 +37,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
// --- 库和定义 ---
|
|
40
|
-
const lCore = __importStar(require("
|
|
41
|
-
const lNet = __importStar(require("
|
|
42
|
-
const lDb = __importStar(require("
|
|
43
|
-
const lFs = __importStar(require("
|
|
44
|
-
const lText = __importStar(require("
|
|
45
|
-
const lCrypto = __importStar(require("
|
|
46
|
-
const lKv = __importStar(require("
|
|
47
|
-
const lCaptcha = __importStar(require("
|
|
48
|
-
const lTime = __importStar(require("
|
|
49
|
-
const lScan = __importStar(require("
|
|
50
|
-
const lSql = __importStar(require("
|
|
51
|
-
const lConsistent = __importStar(require("
|
|
52
|
-
const lSsh = __importStar(require("
|
|
53
|
-
const lJwt = __importStar(require("
|
|
54
|
-
const lWs = __importStar(require("
|
|
55
|
-
const lS3 = __importStar(require("
|
|
56
|
-
const lZip = __importStar(require("
|
|
57
|
-
const lBuffer = __importStar(require("
|
|
58
|
-
const lLan = __importStar(require("
|
|
59
|
-
const sCtr = __importStar(require("
|
|
60
|
-
const kebab = __importStar(require("
|
|
40
|
+
const lCore = __importStar(require("~/lib/core"));
|
|
41
|
+
const lNet = __importStar(require("~/lib/net"));
|
|
42
|
+
const lDb = __importStar(require("~/lib/db"));
|
|
43
|
+
const lFs = __importStar(require("~/lib/fs"));
|
|
44
|
+
const lText = __importStar(require("~/lib/text"));
|
|
45
|
+
const lCrypto = __importStar(require("~/lib/crypto"));
|
|
46
|
+
const lKv = __importStar(require("~/lib/kv"));
|
|
47
|
+
const lCaptcha = __importStar(require("~/lib/captcha"));
|
|
48
|
+
const lTime = __importStar(require("~/lib/time"));
|
|
49
|
+
const lScan = __importStar(require("~/lib/scan"));
|
|
50
|
+
const lSql = __importStar(require("~/lib/sql"));
|
|
51
|
+
const lConsistent = __importStar(require("~/lib/consistent"));
|
|
52
|
+
const lSsh = __importStar(require("~/lib/ssh"));
|
|
53
|
+
const lJwt = __importStar(require("~/lib/jwt"));
|
|
54
|
+
const lWs = __importStar(require("~/lib/ws"));
|
|
55
|
+
const lS3 = __importStar(require("~/lib/s3"));
|
|
56
|
+
const lZip = __importStar(require("~/lib/zip"));
|
|
57
|
+
const lBuffer = __importStar(require("~/lib/buffer"));
|
|
58
|
+
const lLan = __importStar(require("~/lib/lan"));
|
|
59
|
+
const sCtr = __importStar(require("~/sys/ctr"));
|
|
60
|
+
const kebab = __importStar(require("~/index"));
|
|
61
61
|
// --- mod ---
|
|
62
62
|
const test_1 = __importDefault(require("../mod/test"));
|
|
63
63
|
const testdata_1 = __importDefault(require("../mod/testdata"));
|
|
@@ -165,6 +165,7 @@ class default_1 extends sCtr.Ctr {
|
|
|
165
165
|
`<br><a href="${this._config.const.urlBase}test/core-checktype">View "test/core-checktype"</a>`,
|
|
166
166
|
`<br><a href="${this._config.const.urlBase}test/core-muid">View "test/core-muid"</a>`,
|
|
167
167
|
`<br><a href="${this._config.const.urlBase}test/core-getlog">View "test/core-getlog"</a>`,
|
|
168
|
+
`<br><a href="${this._config.const.urlBase}test/core-ls">View "test/core-ls"</a>`,
|
|
168
169
|
`<br><a href="${this._config.const.urlBase}test/core-reload">View "test/core-reload"</a>`,
|
|
169
170
|
`<br><a href="${this._config.const.urlBase}test/core-restart">View "test/core-restart"</a>`,
|
|
170
171
|
`<br><a href="${this._config.const.urlBase}test/core-global">View "test/core-global"</a>`,
|
|
@@ -1030,13 +1031,14 @@ for (let i = 0; i < 30000; ++i) {
|
|
|
1030
1031
|
async coreGetlog() {
|
|
1031
1032
|
const path = lTime.format(null, 'Y/m/d/H');
|
|
1032
1033
|
const list = await lCore.getLog({
|
|
1033
|
-
'
|
|
1034
|
+
'hostname': this._config.const.hostname,
|
|
1034
1035
|
'path': path,
|
|
1035
1036
|
'fend': '-visit',
|
|
1036
1037
|
});
|
|
1037
1038
|
const echo = [];
|
|
1038
|
-
echo.push('<table style="width: 100%;"
|
|
1039
|
+
echo.push('<table style="width: 100%;">');
|
|
1039
1040
|
if (list) {
|
|
1041
|
+
echo.push('<tr><th>TIME</th><th>UNIX</th><th>URL</th><th>COOKIE</th><th>SESSION</th><th>JWT</th><th>USER_AGENT</th><th>REALIP</th><th>CLIENTIP</th><th>MESSAGE</th></tr>');
|
|
1040
1042
|
for (const row of list) {
|
|
1041
1043
|
echo.push('<tr>');
|
|
1042
1044
|
for (const item of row) {
|
|
@@ -1046,7 +1048,41 @@ for (let i = 0; i < 30000; ++i) {
|
|
|
1046
1048
|
}
|
|
1047
1049
|
}
|
|
1048
1050
|
else {
|
|
1049
|
-
echo.push('<th>' + JSON.stringify(list) + '</th></tr>');
|
|
1051
|
+
echo.push('<tr><th>' + JSON.stringify(list) + '</th></tr>');
|
|
1052
|
+
}
|
|
1053
|
+
echo.push('</table>');
|
|
1054
|
+
return echo.join('') + '<br>' + this._getEnd();
|
|
1055
|
+
}
|
|
1056
|
+
async coreLs() {
|
|
1057
|
+
const echo = [
|
|
1058
|
+
'./'
|
|
1059
|
+
];
|
|
1060
|
+
const list = await lCore.ls({
|
|
1061
|
+
'path': './',
|
|
1062
|
+
});
|
|
1063
|
+
echo.push('<table style="width: 100%;">');
|
|
1064
|
+
for (const item of list) {
|
|
1065
|
+
echo.push('<tr>');
|
|
1066
|
+
echo.push('<td>' + lText.htmlescape(item.name) + '</td>');
|
|
1067
|
+
echo.push('<td>isDirectory:' + (item.isDirectory ? 'true' : 'false') + '</td>');
|
|
1068
|
+
echo.push('<td>isFile:' + (item.isFile ? 'true' : 'false') + '</td>');
|
|
1069
|
+
echo.push('<td>isSymbolicLink:' + (item.isSymbolicLink ? 'true' : 'false') + '</td>');
|
|
1070
|
+
echo.push('</tr>');
|
|
1071
|
+
}
|
|
1072
|
+
echo.push('</table>');
|
|
1073
|
+
// --- source/ ---
|
|
1074
|
+
echo.push('source/');
|
|
1075
|
+
const list2 = await lCore.ls({
|
|
1076
|
+
'path': 'source/',
|
|
1077
|
+
});
|
|
1078
|
+
echo.push('<table style="width: 100%;">');
|
|
1079
|
+
for (const item of list2) {
|
|
1080
|
+
echo.push('<tr>');
|
|
1081
|
+
echo.push('<td>' + lText.htmlescape(item.name) + '</td>');
|
|
1082
|
+
echo.push('<td>isDirectory:' + (item.isDirectory ? 'true' : 'false') + '</td>');
|
|
1083
|
+
echo.push('<td>isFile:' + (item.isFile ? 'true' : 'false') + '</td>');
|
|
1084
|
+
echo.push('<td>isSymbolicLink:' + (item.isSymbolicLink ? 'true' : 'false') + '</td>');
|
|
1085
|
+
echo.push('</tr>');
|
|
1050
1086
|
}
|
|
1051
1087
|
echo.push('</table>');
|
|
1052
1088
|
return echo.join('') + '<br>' + this._getEnd();
|
|
@@ -2620,6 +2656,7 @@ ${lTime.format(null, 'd|D|j|l|N|w|Y|y|F|M|m|H|h|i|s|T')}`;
|
|
|
2620
2656
|
<div style="margin-top: 10px; display: flex;">
|
|
2621
2657
|
<input id="text" style="flex: 1;">
|
|
2622
2658
|
<input id="send" type="button" value="Send" onclick="send()" disabled style="margin-left: 10px;">
|
|
2659
|
+
<input type="button" value="!Ping" onclick="pinging = !pinging; this.value = pinging ? 'Ping' : '!Ping';" style="margin-left: 10px;">
|
|
2623
2660
|
</div>
|
|
2624
2661
|
<script>
|
|
2625
2662
|
var ws = null;
|
|
@@ -2630,6 +2667,12 @@ var stopEl = document.getElementById('stop');
|
|
|
2630
2667
|
|
|
2631
2668
|
var textEl = document.getElementById('text');
|
|
2632
2669
|
var sendEl = document.getElementById('send');
|
|
2670
|
+
|
|
2671
|
+
function dateStr() {
|
|
2672
|
+
const date = new Date();
|
|
2673
|
+
return date.getHours().toString().padStart(2, '0') + ':' + date.getMinutes().toString().padStart(2, '0') + ':' + date.getSeconds().toString().padStart(2, '0');
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2633
2676
|
function enter() {
|
|
2634
2677
|
var nick = nickEl.value.trim();
|
|
2635
2678
|
if (nick === '') {
|
|
@@ -2638,27 +2681,27 @@ function enter() {
|
|
|
2638
2681
|
}
|
|
2639
2682
|
nickEl.disabled = true;
|
|
2640
2683
|
btnEl.disabled = true;
|
|
2641
|
-
listEl.insertAdjacentHTML('afterbegin', '<div>Connecting...</div>');
|
|
2684
|
+
listEl.insertAdjacentHTML('afterbegin', '<div>[' + dateStr() + '] Connecting...</div>');
|
|
2642
2685
|
ws = new WebSocket('ws${this._config.const.https ? 's' : ''}://${this._config.const.host}/${this._get['ac'] === 'rproxy' ? 'rproxy' : 'test'}');
|
|
2643
2686
|
ws.onopen = function() {
|
|
2644
|
-
listEl.insertAdjacentHTML('afterbegin', '<div>Event: onOpen.</div>');
|
|
2687
|
+
listEl.insertAdjacentHTML('afterbegin', '<div>[' + dateStr() + '] Event: onOpen.</div>');
|
|
2645
2688
|
ws.send('Hello: ' + nick);
|
|
2646
|
-
listEl.insertAdjacentHTML('afterbegin', '<div>Client: send "Hello: ' + nick + '".</div>');
|
|
2689
|
+
listEl.insertAdjacentHTML('afterbegin', '<div>[' + dateStr() + '] Client: send "Hello: ' + nick + '".</div>');
|
|
2647
2690
|
stopEl.disabled = false;
|
|
2648
2691
|
sendEl.disabled = false;
|
|
2649
2692
|
};
|
|
2650
2693
|
ws.onmessage = function(ev) {
|
|
2651
|
-
listEl.insertAdjacentHTML('afterbegin', '<div>Server: ' + ev.data + '.</div>');
|
|
2694
|
+
listEl.insertAdjacentHTML('afterbegin', '<div>[' + dateStr() + '] Server: ' + ev.data + '.</div>');
|
|
2652
2695
|
};
|
|
2653
2696
|
ws.onclose = function() {
|
|
2654
|
-
listEl.insertAdjacentHTML('afterbegin', '<div>Event: onClose.</div>');
|
|
2697
|
+
listEl.insertAdjacentHTML('afterbegin', '<div>[' + dateStr() + '] Event: onClose.</div>');
|
|
2655
2698
|
nickEl.disabled = false;
|
|
2656
2699
|
btnEl.disabled = false;
|
|
2657
2700
|
stopEl.disabled = true;
|
|
2658
2701
|
sendEl.disabled = true;
|
|
2659
2702
|
};
|
|
2660
2703
|
ws.onerror = function(ev) {
|
|
2661
|
-
listEl.insertAdjacentHTML('afterbegin', '<div>Event: onError.</div>');
|
|
2704
|
+
listEl.insertAdjacentHTML('afterbegin', '<div>[' + dateStr() + '] Event: onError.</div>');
|
|
2662
2705
|
nickEl.disabled = false;
|
|
2663
2706
|
btnEl.disabled = false;
|
|
2664
2707
|
stopEl.disabled = true;
|
|
@@ -2673,6 +2716,16 @@ function send() {
|
|
|
2673
2716
|
ws.send(textEl.value);
|
|
2674
2717
|
textEl.value = '';
|
|
2675
2718
|
}
|
|
2719
|
+
var pinging = false;
|
|
2720
|
+
setInterval(() => {
|
|
2721
|
+
if (!ws) {
|
|
2722
|
+
return;
|
|
2723
|
+
}
|
|
2724
|
+
if (!pinging) {
|
|
2725
|
+
return;
|
|
2726
|
+
}
|
|
2727
|
+
ws.send('ping');
|
|
2728
|
+
}, 5_000);
|
|
2676
2729
|
</script>`;
|
|
2677
2730
|
return echo + '<br>' + this._getEnd();
|
|
2678
2731
|
}
|
package/www/example/mod/test.js
CHANGED
|
@@ -36,8 +36,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const lCore = __importStar(require("
|
|
40
|
-
const mod_1 = __importDefault(require("
|
|
39
|
+
const lCore = __importStar(require("~/lib/core"));
|
|
40
|
+
const mod_1 = __importDefault(require("~/sys/mod"));
|
|
41
41
|
/*
|
|
42
42
|
CREATE TABLE `m_test` (
|
|
43
43
|
`id` int NOT NULL AUTO_INCREMENT,
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const mod_1 = __importDefault(require("
|
|
6
|
+
const mod_1 = __importDefault(require("~/sys/mod"));
|
|
7
7
|
/*
|
|
8
8
|
CREATE TABLE `m_test_data_0` (
|
|
9
9
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
package/www/example/ws/mproxy.js
CHANGED
|
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const sCtr = __importStar(require("
|
|
37
|
-
const lWs = __importStar(require("
|
|
36
|
+
const sCtr = __importStar(require("~/sys/ctr"));
|
|
37
|
+
const lWs = __importStar(require("~/lib/ws"));
|
|
38
38
|
class default_1 extends sCtr.Ctr {
|
|
39
39
|
async onLoad() {
|
|
40
40
|
console.log('WebSocket mproxy test onLoad.');
|
package/www/example/ws/rproxy.js
CHANGED
|
@@ -33,8 +33,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const sCtr = __importStar(require("
|
|
37
|
-
const lWs = __importStar(require("
|
|
36
|
+
const sCtr = __importStar(require("~/sys/ctr"));
|
|
37
|
+
const lWs = __importStar(require("~/lib/ws"));
|
|
38
38
|
class default_1 extends sCtr.Ctr {
|
|
39
39
|
async onLoad() {
|
|
40
40
|
console.log('WebSocket rproxy test onLoad.');
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const sCtr = __importStar(require("~/sys/ctr"));
|
|
37
|
+
const lWs = __importStar(require("~/lib/ws"));
|
|
38
|
+
class default_1 extends sCtr.Ctr {
|
|
39
|
+
async onLoad() {
|
|
40
|
+
console.log('WebSocket rsocket test onLoad.');
|
|
41
|
+
if (await lWs.rsocket(this, '192.168.31.99', 5900)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.default = default_1;
|
package/www/example/ws/test.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import * as sCtr from '
|
|
1
|
+
import * as sCtr from '~/sys/ctr';
|
|
2
|
+
import * as http from 'http';
|
|
2
3
|
export default class extends sCtr.Ctr {
|
|
3
4
|
private _nick;
|
|
5
|
+
onUpgrade(): {
|
|
6
|
+
'headers'?: http.OutgoingHttpHeaders;
|
|
7
|
+
'timeout'?: number;
|
|
8
|
+
};
|
|
4
9
|
onLoad(): boolean;
|
|
5
10
|
onData(data: Buffer | string): string;
|
|
6
11
|
onClose(): void;
|
package/www/example/ws/test.js
CHANGED
|
@@ -33,13 +33,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const sCtr = __importStar(require("
|
|
37
|
-
const lCrypto = __importStar(require("
|
|
36
|
+
const sCtr = __importStar(require("~/sys/ctr"));
|
|
37
|
+
const lCrypto = __importStar(require("~/lib/crypto"));
|
|
38
38
|
class default_1 extends sCtr.Ctr {
|
|
39
39
|
constructor() {
|
|
40
40
|
super(...arguments);
|
|
41
41
|
this._nick = '';
|
|
42
42
|
}
|
|
43
|
+
onUpgrade() {
|
|
44
|
+
return {
|
|
45
|
+
'timeout': 60_000 * 2,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
43
48
|
onLoad() {
|
|
44
49
|
console.log('WebSocket test onLoad.');
|
|
45
50
|
setTimeout(() => {
|
|
@@ -47,7 +52,7 @@ class default_1 extends sCtr.Ctr {
|
|
|
47
52
|
return;
|
|
48
53
|
}
|
|
49
54
|
this._writeText('Other message, host: ' + this._config.const.host);
|
|
50
|
-
},
|
|
55
|
+
}, 2_000);
|
|
51
56
|
return true;
|
|
52
57
|
}
|
|
53
58
|
onData(data) {
|
|
@@ -59,6 +64,8 @@ class default_1 extends sCtr.Ctr {
|
|
|
59
64
|
return 'Base64: ' + lCrypto.base64Encode(data);
|
|
60
65
|
}
|
|
61
66
|
// --- 用户消息 ---
|
|
67
|
+
const date = new Date();
|
|
68
|
+
console.log('[' + date.getHours().toString().padStart(2, '0') + ':' + date.getMinutes().toString().padStart(2, '0') + ':' + date.getSeconds().toString().padStart(2, '0') + '] WebSocket test onData, data: ' + data);
|
|
62
69
|
return '<b>' + this._nick + ':</b> ' + data;
|
|
63
70
|
}
|
|
64
71
|
onClose() {
|