From 3ade1a816a1a56215f0dbdeb85ac8c6eb3d53a19 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 11 Aug 2023 12:19:54 +0300 Subject: [PATCH] change username index to not be case sensitive --- package.json | 2 +- src/server/components/UserDatabase.ts | 6 +-- yarn.lock | 58 +++++++++++++++++++-------- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 2268ed7..1de7dc9 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@navy.gif/commandparser": "^1.5.2", "@navy.gif/logger": "^2.4.1", "@navy.gif/passport-discord": "^0.2.2-b", - "@navy.gif/wrappers": "^1.5.6", + "@navy.gif/wrappers": "^1.5.8", "@types/cors": "^2.8.13", "@types/express-fileupload": "^1.4.1", "@types/express-session": "^1.17.7", diff --git a/src/server/components/UserDatabase.ts b/src/server/components/UserDatabase.ts index fc96567..f58e9fd 100644 --- a/src/server/components/UserDatabase.ts +++ b/src/server/components/UserDatabase.ts @@ -76,7 +76,7 @@ class UserDatabase implements UserDatabaseInterface async init () { for (const coll of [ this.#userCollection, this.#appCollection, this.#roleCollection ]) - await this.#db.ensureIndex(coll, [ 'name' ], { unique: true }); + await this.#db.ensureIndex(coll, [ 'name' ], { unique: true, collation: { locale: 'en', strength: 2 } }); await this.#db.ensureIndex(this.#settingsCollection, [ 'user' ], { unique: true }); await this.count(true); } @@ -290,8 +290,6 @@ class UserDatabase implements UserDatabaseInterface /** * Find user by name * - * @param {string} name - * @return {*} * @memberof UserDatabase */ async findUser (name: string) @@ -319,8 +317,6 @@ class UserDatabase implements UserDatabaseInterface /** * Matches a token against an application * - * @param {string} token - * @return {User} * @memberof UserDatabase */ async matchToken (token: string) diff --git a/yarn.lock b/yarn.lock index 0ce8c97..d47d352 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1773,15 +1773,17 @@ __metadata: languageName: node linkType: hard -"@navy.gif/wrappers@npm:^1.5.6": - version: 1.5.6 - resolution: "@navy.gif/wrappers@npm:1.5.6" +"@navy.gif/wrappers@npm:^1.5.8": + version: 1.5.8 + resolution: "@navy.gif/wrappers@npm:1.5.8" dependencies: + "@types/amqplib": ^0.10.1 + "@types/mysql": ^2.15.21 amqp-connection-manager: ^4.1.12 amqplib: ^0.10.3 - mongodb: ^5.2.0 + mongodb: ^5.7.0 mysql: ^2.18.1 - checksum: 86b9c6cd3edc0b29256d5c132ba65e78781bfe4a41559f288fb8f74cedf4b3d7f961d97e8a83d94b4bc21c287c3b61258d98b72ec135e881b35e7baf94fb3cd4 + checksum: a37e4f0b7c43542bbdb15a74fb23059476219a9ba018efd6b98fe499f7942fe77541c2bcd91230bdcee660c570942739e30eb4530865d20058d7bc3b58f0db53 languageName: node linkType: hard @@ -1919,6 +1921,15 @@ __metadata: languageName: node linkType: hard +"@types/amqplib@npm:^0.10.1": + version: 0.10.1 + resolution: "@types/amqplib@npm:0.10.1" + dependencies: + "@types/node": "*" + checksum: 9f7dd964d15df82f73c26e84f028a5fe91ee96878e34625cf09d0153079007d3d506fcf9d327463227e6e30a357e0220bfb0848fb40c121ccd795154004d3733 + languageName: node + linkType: hard + "@types/babel__core@npm:^7.1.14": version: 7.20.0 resolution: "@types/babel__core@npm:7.20.0" @@ -2087,6 +2098,15 @@ __metadata: languageName: node linkType: hard +"@types/mysql@npm:^2.15.21": + version: 2.15.21 + resolution: "@types/mysql@npm:2.15.21" + dependencies: + "@types/node": "*" + checksum: 6f526e0183c2d03628ca3bdeec839900403863641d61397de3aa0431b8e92457f1580de16b54ee3cd81ccb3968f949a5fa9be939a2101f2148ed5ff3c775c0a7 + languageName: node + linkType: hard + "@types/node@npm:*": version: 18.15.11 resolution: "@types/node@npm:18.15.11" @@ -2851,10 +2871,10 @@ __metadata: languageName: node linkType: hard -"bson@npm:^5.2.0": - version: 5.2.0 - resolution: "bson@npm:5.2.0" - checksum: 1297f8776a05fe3c03b5a1c73210389bc3e596ee6f1e772b76c021fff5537d0c91e523462ba196a8a839246613a87cffbd6486d387a849c7de7cde64d1af7812 +"bson@npm:^5.4.0": + version: 5.4.0 + resolution: "bson@npm:5.4.0" + checksum: 1c07e3d09f139d414bd226bf7f4e9aaa7a726e0c9718c55b53bb23ffa2805cac8b66e4fa46b424c73a35c6e292ed5f7432df5c76ea5d08052642b2ac9e0399e3 languageName: node linkType: hard @@ -5366,17 +5386,19 @@ __metadata: languageName: node linkType: hard -"mongodb@npm:^5.2.0": - version: 5.2.0 - resolution: "mongodb@npm:5.2.0" +"mongodb@npm:^5.7.0": + version: 5.7.0 + resolution: "mongodb@npm:5.7.0" dependencies: - bson: ^5.2.0 + bson: ^5.4.0 mongodb-connection-string-url: ^2.6.0 saslprep: ^1.0.3 socks: ^2.7.1 peerDependencies: "@aws-sdk/credential-providers": ^3.201.0 - mongodb-client-encryption: ^2.3.0 + "@mongodb-js/zstd": ^1.1.0 + kerberos: ^2.0.1 + mongodb-client-encryption: ">=2.3.0 <3" snappy: ^7.2.2 dependenciesMeta: saslprep: @@ -5384,11 +5406,15 @@ __metadata: peerDependenciesMeta: "@aws-sdk/credential-providers": optional: true + "@mongodb-js/zstd": + optional: true + kerberos: + optional: true mongodb-client-encryption: optional: true snappy: optional: true - checksum: 2114175fab6a56c2d2902d97117c98c7b240155af6b7880174dbdf90bdcd8eb60c959ced7ed8b6327abfe226d6ae9933356344fc7d6e71798fef86e6eddd0173 + checksum: 16357b6229abac165aecea15a6efa873ec8662a00411ecb9e49853f05a590be31aab63d404486125778eedaafe76d70e84eea682fa89b138decc247f4870d2ec languageName: node linkType: hard @@ -7045,7 +7071,7 @@ __metadata: "@navy.gif/commandparser": ^1.5.2 "@navy.gif/logger": ^2.4.1 "@navy.gif/passport-discord": ^0.2.2-b - "@navy.gif/wrappers": ^1.5.6 + "@navy.gif/wrappers": ^1.5.8 "@types/cors": ^2.8.13 "@types/express-fileupload": ^1.4.1 "@types/express-session": ^1.17.7