返回提交历史
Modified
package-lock.json
+0
-13
Modified
package.json
+0
-1
Modified
src/services/loginService.ts
+3
-2
XFEstudio/XFESpaceNinjaServer
chore: use node-builtin crc32 function to remove a dependency (#3596)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3596 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
736cc5bb
代码差异
3 个文件
+3
-16
@@ -10,7 +10,6 @@
10
10
"dependencies": {
11
11
"body-parser": "^2.2.0",
12
12
"chokidar": "^4.0.3",
13
"crc-32": "^1.2.2",
14
13
"express": "^5",
15
14
"google-auth-library": "^10.5.0",
16
15
"json-with-bigint": "^3.4.4",
@@ -1243,18 +1242,6 @@
1243
1242
"node": ">=6.6.0"
1244
1243
}
1245
1244
},
1246
"node_modules/crc-32": {
1247
"version": "1.2.2",
1248
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
1249
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
1250
"license": "Apache-2.0",
1251
"bin": {
1252
"crc32": "bin/crc32.njs"
1253
},
1254
"engines": {
1255
"node": ">=0.8"
1256
}
1257
},
1258
1245
"node_modules/cross-spawn": {
1259
1246
"version": "7.0.6",
1260
1247
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
@@ -27,7 +27,6 @@
27
27
"dependencies": {
28
28
"body-parser": "^2.2.0",
29
29
"chokidar": "^4.0.3",
30
"crc-32": "^1.2.2",
31
30
"express": "^5",
32
31
"google-auth-library": "^10.5.0",
33
32
"json-with-bigint": "^3.4.4",
@@ -8,7 +8,7 @@ import { PersonalRooms } from "../models/personalRoomsModel.ts";
8
8
import type { Request } from "express";
9
9
import { config } from "./configService.ts";
10
10
import { createStats } from "./statsService.ts";
11
import crc32 from "crc-32";
11
import { crc32 } from "node:zlib";
12
12
import crypto from "node:crypto";
13
13
import { logger } from "../utils/logger.ts";
14
14
import { version_compare } from "../helpers/inventoryHelpers.ts";
@@ -136,7 +136,8 @@ const platform_magics = [753, 639, 247, 37, 60, 161];
136
136
export const getSuffixedName = (account: TAccountDocument): string => {
137
137
const name = account.DisplayName;
138
138
const platformId = getOriginalPlatform(account); // Name suffix is based on the original platform, so cross-save does not change it.
139
const suffix = ((crc32.str(name.toLowerCase() + "595") >>> 0) + platform_magics[platformId]) % 1000;
139
const suffix =
140
((crc32(Buffer.from(name.toLowerCase() + "595", "utf8")) >>> 0) + platform_magics[platformId]) % 1000;
140
141
return name + "#" + suffix.toString().padStart(3, "0");
141
142
};
142
143