forked from Hri7566/mpp-server-dev2
add freeze_name
This commit is contained in:
parent
d0941ff3a2
commit
74f7985e7b
File diff suppressed because it is too large
Load Diff
|
@ -32,7 +32,6 @@
|
||||||
"level": "^7.0.0",
|
"level": "^7.0.0",
|
||||||
"mongoose": "^5.12.7",
|
"mongoose": "^5.12.7",
|
||||||
"mppclone-client": "^1.0.0",
|
"mppclone-client": "^1.0.0",
|
||||||
"node-json-color-stringify": "^1.1.0",
|
|
||||||
"nodemon": "^2.0.15",
|
"nodemon": "^2.0.15",
|
||||||
"ws": "^7.2.3"
|
"ws": "^7.2.3"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ const RateLimit = require('./Ratelimit.js').RateLimit;
|
||||||
const RateLimitChain = require('./Ratelimit.js').RateLimitChain;
|
const RateLimitChain = require('./Ratelimit.js').RateLimitChain;
|
||||||
const User = require("./User.js");
|
const User = require("./User.js");
|
||||||
const Database = require("./Database.js");
|
const Database = require("./Database.js");
|
||||||
require('node-json-color-stringify');
|
|
||||||
|
|
||||||
class Client extends EventEmitter {
|
class Client extends EventEmitter {
|
||||||
constructor(ws, req, server) {
|
constructor(ws, req, server) {
|
||||||
|
@ -92,10 +91,13 @@ class Client extends EventEmitter {
|
||||||
|
|
||||||
userset(name, admin) {
|
userset(name, admin) {
|
||||||
if (name.length > 40 && !admin) return;
|
if (name.length > 40 && !admin) return;
|
||||||
if(!this.quotas.userset.attempt()) return;
|
if (!this.quotas.userset.attempt()) return;
|
||||||
this.user.name = name;
|
this.user.name = name;
|
||||||
Database.getUserData(this, this.server).then((usr) => {
|
Database.getUserData(this, this.server).then((usr) => {
|
||||||
|
if (!this.user.hasFlag('freeze_name', true)) {
|
||||||
Database.updateUser(this.user._id, this.user);
|
Database.updateUser(this.user._id, this.user);
|
||||||
|
}
|
||||||
|
|
||||||
this.server.rooms.forEach((room) => {
|
this.server.rooms.forEach((room) => {
|
||||||
room.updateParticipant(this.user._id, {
|
room.updateParticipant(this.user._id, {
|
||||||
name: name
|
name: name
|
||||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -301,11 +301,6 @@ color-name@~1.1.4:
|
||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
|
||||||
colors@^1.1.2:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
|
|
||||||
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
|
|
||||||
|
|
||||||
concat-map@0.0.1:
|
concat-map@0.0.1:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||||
|
@ -1094,13 +1089,6 @@ node-gyp-build@^4.3.0:
|
||||||
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4"
|
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4"
|
||||||
integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==
|
integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ==
|
||||||
|
|
||||||
node-json-color-stringify@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/node-json-color-stringify/-/node-json-color-stringify-1.1.0.tgz#8bb124f913859591058026513121d6609d6ef5b7"
|
|
||||||
integrity sha512-EfCyON2e1RVY9zECodKxwnrE2c858xj1GlueR5w3s5d3sdHALFkyouaii+34Ga3+nt8cF99mtkXau7VTTJaJXg==
|
|
||||||
dependencies:
|
|
||||||
colors "^1.1.2"
|
|
||||||
|
|
||||||
nodemon@^2.0.15:
|
nodemon@^2.0.15:
|
||||||
version "2.0.16"
|
version "2.0.16"
|
||||||
resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.16.tgz#d71b31bfdb226c25de34afea53486c8ef225fdef"
|
resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-2.0.16.tgz#d71b31bfdb226c25de34afea53486c8ef225fdef"
|
||||||
|
|
Loading…
Reference in New Issue