返回提交历史
Modified
Dockerfile
+1
-1
Modified
package-lock.json
+16
-157
Modified
package.json
+1
-1
Modified
src/services/webService.ts
+8
-15
XFEstudio/XFESpaceNinjaServer
chore: replace 'websocket' with 'undici' (#2253)
This is a lot more lightweight Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2253 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
f61d15b4
代码差异
4 个文件
+26
-174
@@ -1,6 +1,6 @@
1
1
FROM node:24-alpine3.21
2
2
3
RUN apk add --no-cache bash jq python3 make gcc alpine-sdk
3
RUN apk add --no-cache bash jq
4
4
5
5
COPY . /app
6
6
WORKDIR /app
@@ -20,9 +20,9 @@
20
20
"morgan": "^1.10.0",
21
21
"ncp": "^2.0.0",
22
22
"typescript": "^5.5",
23
"undici": "^7.10.0",
23
24
"warframe-public-export-plus": "^0.5.68",
24
25
"warframe-riven-info": "^0.1.2",
25
"websocket": "^1.0.35",
26
26
"winston": "^3.17.0",
27
27
"winston-daily-rotate-file": "^5.0.0",
28
28
"ws": "^8.18.2"
@@ -927,6 +927,8 @@
927
927
"integrity": "sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw==",
928
928
"hasInstallScript": true,
929
929
"license": "MIT",
930
"optional": true,
931
"peer": true,
930
932
"dependencies": {
931
933
"node-gyp-build": "^4.3.0"
932
934
},
@@ -1152,19 +1154,6 @@
1152
1154
"node": ">= 8"
1153
1155
}
1154
1156
},
1155
"node_modules/d": {
1156
"version": "1.0.2",
1157
"resolved": "https://registry.npmjs.org/d/-/d-1.0.2.tgz",
1158
"integrity": "sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==",
1159
"license": "ISC",
1160
"dependencies": {
1161
"es5-ext": "^0.10.64",
1162
"type": "^2.7.2"
1163
},
1164
"engines": {
1165
"node": ">=0.12"
1166
}
1167
},
1168
1157
"node_modules/debug": {
1169
1158
"version": "4.4.0",
1170
1159
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
@@ -1276,46 +1265,6 @@
1276
1265
"node": ">= 0.4"
1277
1266
}
1278
1267
},
1279
"node_modules/es5-ext": {
1280
"version": "0.10.64",
1281
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.64.tgz",
1282
"integrity": "sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==",
1283
"hasInstallScript": true,
1284
"license": "ISC",
1285
"dependencies": {
1286
"es6-iterator": "^2.0.3",
1287
"es6-symbol": "^3.1.3",
1288
"esniff": "^2.0.1",
1289
"next-tick": "^1.1.0"
1290
},
1291
"engines": {
1292
"node": ">=0.10"
1293
}
1294
},
1295
"node_modules/es6-iterator": {
1296
"version": "2.0.3",
1297
"resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
1298
"integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==",
1299
"license": "MIT",
1300
"dependencies": {
1301
"d": "1",
1302
"es5-ext": "^0.10.35",
1303
"es6-symbol": "^3.1.1"
1304
}
1305
},
1306
"node_modules/es6-symbol": {
1307
"version": "3.1.4",
1308
"resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.4.tgz",
1309
"integrity": "sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==",
1310
"license": "ISC",
1311
"dependencies": {
1312
"d": "^1.0.2",
1313
"ext": "^1.7.0"
1314
},
1315
"engines": {
1316
"node": ">=0.12"
1317
}
1318
},
1319
1268
"node_modules/escape-html": {
1320
1269
"version": "1.0.3",
1321
1270
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -1477,21 +1426,6 @@
1477
1426
"node": "*"
1478
1427
}
1479
1428
},
1480
"node_modules/esniff": {
1481
"version": "2.0.1",
1482
"resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz",
1483
"integrity": "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==",
1484
"license": "ISC",
1485
"dependencies": {
1486
"d": "^1.0.1",
1487
"es5-ext": "^0.10.62",
1488
"event-emitter": "^0.3.5",
1489
"type": "^2.7.2"
1490
},
1491
"engines": {
1492
"node": ">=0.10"
1493
}
1494
},
1495
1429
"node_modules/espree": {
1496
1430
"version": "9.6.1",
1497
1431
"resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
@@ -1565,16 +1499,6 @@
1565
1499
"node": ">= 0.6"
1566
1500
}
1567
1501
},
1568
"node_modules/event-emitter": {
1569
"version": "0.3.5",
1570
"resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
1571
"integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==",
1572
"license": "MIT",
1573
"dependencies": {
1574
"d": "1",
1575
"es5-ext": "~0.10.14"
1576
}
1577
},
1578
1502
"node_modules/express": {
1579
1503
"version": "5.1.0",
1580
1504
"resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
@@ -1617,15 +1541,6 @@
1617
1541
"url": "https://opencollective.com/express"
1618
1542
}
1619
1543
},
1620
"node_modules/ext": {
1621
"version": "1.7.0",
1622
"resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz",
1623
"integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==",
1624
"license": "ISC",
1625
"dependencies": {
1626
"type": "^2.7.2"
1627
}
1628
},
1629
1544
"node_modules/fast-deep-equal": {
1630
1545
"version": "3.1.3",
1631
1546
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -2155,12 +2070,6 @@
2155
2070
"url": "https://github.com/sponsors/sindresorhus"
2156
2071
}
2157
2072
},
2158
"node_modules/is-typedarray": {
2159
"version": "1.0.0",
2160
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
2161
"integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",
2162
"license": "MIT"
2163
},
2164
2073
"node_modules/isexe": {
2165
2074
"version": "2.0.0",
2166
2075
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -2566,17 +2475,13 @@
2566
2475
"node": ">= 0.6"
2567
2476
}
2568
2477
},
2569
"node_modules/next-tick": {
2570
"version": "1.1.0",
2571
"resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz",
2572
"integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==",
2573
"license": "ISC"
2574
},
2575
2478
"node_modules/node-gyp-build": {
2576
2479
"version": "4.8.4",
2577
2480
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",
2578
2481
"integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",
2579
2482
"license": "MIT",
2483
"optional": true,
2484
"peer": true,
2580
2485
"bin": {
2581
2486
"node-gyp-build": "bin.js",
2582
2487
"node-gyp-build-optional": "optional.js",
@@ -3373,12 +3278,6 @@
3373
3278
"dev": true,
3374
3279
"license": "0BSD"
3375
3280
},
3376
"node_modules/type": {
3377
"version": "2.7.3",
3378
"resolved": "https://registry.npmjs.org/type/-/type-2.7.3.tgz",
3379
"integrity": "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==",
3380
"license": "ISC"
3381
},
3382
3281
"node_modules/type-check": {
3383
3282
"version": "0.4.0",
3384
3283
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@@ -3419,15 +3318,6 @@
3419
3318
"node": ">= 0.6"
3420
3319
}
3421
3320
},
3422
"node_modules/typedarray-to-buffer": {
3423
"version": "3.1.5",
3424
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
3425
"integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
3426
"license": "MIT",
3427
"dependencies": {
3428
"is-typedarray": "^1.0.0"
3429
}
3430
},
3431
3321
"node_modules/typescript": {
3432
3322
"version": "5.8.3",
3433
3323
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
@@ -3441,6 +3331,15 @@
3441
3331
"node": ">=14.17"
3442
3332
}
3443
3333
},
3334
"node_modules/undici": {
3335
"version": "7.10.0",
3336
"resolved": "https://registry.npmjs.org/undici/-/undici-7.10.0.tgz",
3337
"integrity": "sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw==",
3338
"license": "MIT",
3339
"engines": {
3340
"node": ">=20.18.1"
3341
}
3342
},
3444
3343
"node_modules/undici-types": {
3445
3344
"version": "6.21.0",
3446
3345
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
@@ -3472,6 +3371,8 @@
3472
3371
"integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==",
3473
3372
"hasInstallScript": true,
3474
3373
"license": "MIT",
3374
"optional": true,
3375
"peer": true,
3475
3376
"dependencies": {
3476
3377
"node-gyp-build": "^4.3.0"
3477
3378
},
@@ -3513,38 +3414,6 @@
3513
3414
"node": ">=12"
3514
3415
}
3515
3416
},
3516
"node_modules/websocket": {
3517
"version": "1.0.35",
3518
"resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.35.tgz",
3519
"integrity": "sha512-/REy6amwPZl44DDzvRCkaI1q1bIiQB0mEFQLUrhz3z2EK91cp3n72rAjUlrTP0zV22HJIUOVHQGPxhFRjxjt+Q==",
3520
"license": "Apache-2.0",
3521
"dependencies": {
3522
"bufferutil": "^4.0.1",
3523
"debug": "^2.2.0",
3524
"es5-ext": "^0.10.63",
3525
"typedarray-to-buffer": "^3.1.5",
3526
"utf-8-validate": "^5.0.2",
3527
"yaeti": "^0.0.6"
3528
},
3529
"engines": {
3530
"node": ">=4.0.0"
3531
}
3532
},
3533
"node_modules/websocket/node_modules/debug": {
3534
"version": "2.6.9",
3535
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
3536
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
3537
"license": "MIT",
3538
"dependencies": {
3539
"ms": "2.0.0"
3540
}
3541
},
3542
"node_modules/websocket/node_modules/ms": {
3543
"version": "2.0.0",
3544
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
3545
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
3546
"license": "MIT"
3547
},
3548
3417
"node_modules/whatwg-url": {
3549
3418
"version": "14.2.0",
3550
3419
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
@@ -3665,16 +3534,6 @@
3665
3534
}
3666
3535
}
3667
3536
},
3668
"node_modules/yaeti": {
3669
"version": "0.0.6",
3670
"resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz",
3671
"integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==",
3672
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
3673
"license": "MIT",
3674
"engines": {
3675
"node": ">=0.10.32"
3676
}
3677
},
3678
3537
"node_modules/yocto-queue": {
3679
3538
"version": "0.1.0",
3680
3539
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
@@ -32,9 +32,9 @@
32
32
"morgan": "^1.10.0",
33
33
"ncp": "^2.0.0",
34
34
"typescript": "^5.5",
35
"undici": "^7.10.0",
35
36
"warframe-public-export-plus": "^0.5.68",
36
37
"warframe-riven-info": "^0.1.2",
37
"websocket": "^1.0.35",
38
38
"winston": "^3.17.0",
39
39
"winston-daily-rotate-file": "^5.0.0",
40
40
"ws": "^8.18.2"
@@ -10,7 +10,7 @@ import { Account } from "../models/loginModel";
10
10
import { createAccount, createNonce, getUsernameFromEmail, isCorrectPassword } from "./loginService";
11
11
import { IDatabaseAccountJson } from "../types/loginTypes";
12
12
import { HydratedDocument } from "mongoose";
13
import websocket from "websocket";
13
import { Agent, WebSocket } from "undici";
14
14
15
15
let httpServer: http.Server | undefined;
16
16
let httpsServer: https.Server | undefined;
@@ -67,21 +67,14 @@ export const startWebServer = (): void => {
67
67
68
68
const runWsSelfTest = (protocol: "ws" | "wss", port: number): Promise<boolean> => {
69
69
return new Promise(resolve => {
70
const client = new websocket.client({ tlsOptions: { rejectUnauthorized: false } });
71
client.connect(`${protocol}://localhost:${port}/custom/selftest`);
72
client.on("connect", connection => {
73
connection.on("message", msg => {
74
if (msg.type == "utf8" && msg.utf8Data == "SpaceNinjaServer") {
75
resolve(true);
76
}
77
});
78
connection.on("close", () => {
79
resolve(false);
80
});
81
});
82
client.on("connectFailed", () => {
70
const agent = new Agent({ connect: { rejectUnauthorized: false } });
71
const client = new WebSocket(`${protocol}://localhost:${port}/custom/selftest`, { dispatcher: agent });
72
client.onmessage = (e): void => {
73
resolve(e.data == "SpaceNinjaServer");
74
};
75
client.onerror = client.onclose = (): void => {
83
76
resolve(false);
84
});
77
};
85
78
});
86
79
};
87
80