Add gateway pings #20
3 changed files with 3 additions and 4 deletions
|
@ -1,6 +1,5 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
|
||||||
"commonjs": true,
|
"commonjs": true,
|
||||||
"es2021": true,
|
"es2021": true,
|
||||||
"node": true
|
"node": true
|
||||||
|
|
|
@ -10,7 +10,7 @@ class RateLimiter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RateLimiter.prototype.consoom = function(discriminator) {
|
RateLimiter.prototype.consume = function(discriminator) {
|
||||||
if (!this._flooding[discriminator]) this._flooding[discriminator] = { points: this.points, lastReset: Date.now() };
|
if (!this._flooding[discriminator]) this._flooding[discriminator] = { points: this.points, lastReset: Date.now() };
|
||||||
|
|
||||||
if (Math.abs(new Date() - this._flooding[discriminator].lastReset) >= this.time) {
|
if (Math.abs(new Date() - this._flooding[discriminator].lastReset) >= this.time) {
|
||||||
|
|
|
@ -30,10 +30,10 @@ app.use("/api/v1", apiRoute);
|
||||||
app.use(express.static("app"));
|
app.use(express.static("app"));
|
||||||
|
|
||||||
app.use((err, req, res, next) => {
|
app.use((err, req, res, next) => {
|
||||||
console.error("error: Internal server error", err);
|
console.error("error: server: internal server error", err);
|
||||||
res.status(500).json({ error: true, status: 500, message: "ERR_INTERNAL_SERVER_ERROR" });
|
res.status(500).json({ error: true, status: 500, message: "ERR_INTERNAL_SERVER_ERROR" });
|
||||||
});
|
});
|
||||||
|
|
||||||
httpServer.listen(config.ports.mainServerPort, () => {
|
httpServer.listen(config.ports.mainServerPort, () => {
|
||||||
console.log(`[*] [server] Main server is listening on port ${config.ports.mainServerPort}`);
|
console.log(`server: listening on port ${config.ports.mainServerPort}`);
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue