@e-mc/watch 0.5.1 → 0.5.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.
- package/index.js +23 -25
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -53,42 +53,40 @@ class Watch extends core_1.Client {
|
|
|
53
53
|
let wss;
|
|
54
54
|
try {
|
|
55
55
|
if ((0, types_1.isPlainObject)(secure)) {
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
else {
|
|
75
|
-
this.writeFail('TLS/SSL key and cert not found', (0, types_1.errorMessage)('ws', 'Missing TLS/SSL credentials'));
|
|
56
|
+
if (wss = SECURE_MAP[port]) {
|
|
57
|
+
return wss;
|
|
58
|
+
}
|
|
59
|
+
const { ca, passphrase, version, config } = secure;
|
|
60
|
+
let { key, cert } = secure;
|
|
61
|
+
if (key && cert && (key = request_1.default.readTLSKey(key, true)) && (cert = request_1.default.readTLSKey(cert, true))) {
|
|
62
|
+
const server = https.createServer({
|
|
63
|
+
...config,
|
|
64
|
+
ca: ca && request_1.default.readCACert(ca, true) || undefined,
|
|
65
|
+
key: passphrase ? [{ pem: key, passphrase }] : key,
|
|
66
|
+
cert,
|
|
67
|
+
minVersion: version || config?.minVersion
|
|
68
|
+
});
|
|
69
|
+
server.listen(port);
|
|
70
|
+
wss = new ws.Server({ server });
|
|
71
|
+
SECURE_MAP[port] = wss;
|
|
72
|
+
if (active) {
|
|
73
|
+
STATE_MAP.add(wss);
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
76
|
else {
|
|
79
|
-
|
|
77
|
+
this.writeFail('TLS/SSL key and cert not found', (0, types_1.errorMessage)('ws', 'Missing TLS/SSL credentials'));
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
|
-
else if (
|
|
80
|
+
else if (wss = PORT_MAP[port]) {
|
|
81
|
+
return wss;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
83
84
|
wss = new ws.Server({ port });
|
|
84
85
|
PORT_MAP[port] = wss;
|
|
85
86
|
if (active) {
|
|
86
87
|
STATE_MAP.add(wss);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
else {
|
|
90
|
-
return wss;
|
|
91
|
-
}
|
|
92
90
|
}
|
|
93
91
|
catch (err) {
|
|
94
92
|
this.writeFail("Unknown" /* ERR_MESSAGE.UNKNOWN */, err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/watch",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Watch constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"license": "BSD 3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/core": "0.5.
|
|
24
|
-
"@e-mc/request": "0.5.
|
|
25
|
-
"@e-mc/types": "0.5.
|
|
23
|
+
"@e-mc/core": "0.5.3",
|
|
24
|
+
"@e-mc/request": "0.5.3",
|
|
25
|
+
"@e-mc/types": "0.5.3",
|
|
26
26
|
"picomatch": "^2.3.1",
|
|
27
27
|
"ws": "^8.13.0"
|
|
28
28
|
}
|