add getSuffixedName
This commit is contained in:
parent
92d53e1c00
commit
2f24b61825
12
package-lock.json
generated
12
package-lock.json
generated
@ -10,6 +10,7 @@
|
||||
"license": "GNU",
|
||||
"dependencies": {
|
||||
"copyfiles": "^2.4.1",
|
||||
"crc-32": "^1.2.2",
|
||||
"express": "^5",
|
||||
"mongoose": "^8.11.0",
|
||||
"warframe-public-export-plus": "^0.5.41",
|
||||
@ -1249,6 +1250,17 @@
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/crc-32": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
|
||||
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
|
||||
"bin": {
|
||||
"crc32": "bin/crc32.njs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
|
@ -15,6 +15,7 @@
|
||||
"license": "GNU",
|
||||
"dependencies": {
|
||||
"copyfiles": "^2.4.1",
|
||||
"crc-32": "^1.2.2",
|
||||
"express": "^5",
|
||||
"mongoose": "^8.11.0",
|
||||
"warframe-public-export-plus": "^0.5.41",
|
||||
|
@ -8,6 +8,7 @@ import { PersonalRooms } from "@/src/models/personalRoomsModel";
|
||||
import { Request } from "express";
|
||||
import { config } from "@/src/services/configService";
|
||||
import { createStats } from "@/src/services/statsService";
|
||||
import crc32 from "crc-32";
|
||||
|
||||
export const isCorrectPassword = (requestPassword: string, databasePassword: string): boolean => {
|
||||
return requestPassword === databasePassword;
|
||||
@ -108,3 +109,11 @@ export const isAdministrator = (account: TAccountDocument): boolean => {
|
||||
}
|
||||
return !!config.administratorNames.find(x => x == account.DisplayName);
|
||||
};
|
||||
|
||||
const platform_magics = [753, 639, 247, 37, 60];
|
||||
export const getSuffixedName = (account: TAccountDocument): string => {
|
||||
const name = account.DisplayName;
|
||||
const platformId = 0;
|
||||
const suffix = ((crc32.str(name.toLowerCase() + "595") >>> 0) + platform_magics[platformId]) % 1000;
|
||||
return name + "#" + suffix.toString().padStart(3, "0");
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user