Socket
Socket
Sign inDemoInstall

rjweb-server

Package Overview
Dependencies
Maintainers
1
Versions
373
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rjweb-server - npm Package Compare versions

Comparing version 8.6.3 to 8.6.4

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 8.6.4
- Fix some `@default`'s not being correct
## 8.6.3

@@ -2,0 +6,0 @@

5

lib/cjs/classes/router/rateLimit.js

@@ -25,10 +25,9 @@ "use strict";

var import_rjutils_collection = require("rjutils-collection");
let rateLimitIds = 0;
class RouteRateLimit {
constructor() {
this.data = {
sortTo: rateLimitIds++,
sortTo: (0, import_rjutils_collection.randomNum)(1, 1e7),
penalty: (0, import_rjutils_collection.time)(10).s(),
timeWindow: (0, import_rjutils_collection.time)(10).s(),
maxHits: 60
maxHits: Infinity
};

@@ -35,0 +34,0 @@ }

@@ -253,3 +253,3 @@ "use strict";

skipRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return this;

@@ -275,3 +275,3 @@ const data = this.ctg.rateLimits.get(`http+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`, {

clearRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return this;

@@ -288,3 +288,3 @@ this.ctg.rateLimits.delete(`http+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`);

getRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return null;

@@ -291,0 +291,0 @@ const data = this.ctg.rateLimits.get(`http+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`, {

@@ -95,3 +95,3 @@ "use strict";

skipRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return this;

@@ -117,3 +117,3 @@ const data = this.ctg.rateLimits.get(`ws+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`, {

clearRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return this;

@@ -130,3 +130,3 @@ this.ctg.rateLimits.delete(`ws+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`);

getRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return null;

@@ -133,0 +133,0 @@ const data = this.ctg.rateLimits.get(`ws+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`, {

@@ -485,3 +485,3 @@ "use strict";

}
if (ctx.execute.route && "ratelimit" in ctx.execute.route.data && ctx.execute.route.data.ratelimit.timeWindow !== Infinity) {
if (ctx.execute.route && "ratelimit" in ctx.execute.route.data && ctx.execute.route.data.ratelimit.maxHits !== Infinity) {
let data = ctg.rateLimits.get(`http+${ctr.client.ip}-${ctx.execute.route.data.ratelimit.sortTo}`, {

@@ -488,0 +488,0 @@ hits: 0,

@@ -57,3 +57,3 @@ "use strict";

ctr["@"] = custom;
if (ctx.execute.route && "ratelimit" in ctx.execute.route.data && ctx.execute.route.data.ratelimit.timeWindow !== Infinity) {
if (ctx.execute.route && "ratelimit" in ctx.execute.route.data && ctx.execute.route.data.ratelimit.maxHits !== Infinity) {
let data = ctg.rateLimits.get(`ws+${ctr.client.ip}-${ctx.execute.route.data.ratelimit.sortTo}`, {

@@ -60,0 +60,0 @@ hits: 0,

{
"name": "rjweb-server",
"version": "8.6.3",
"version": "8.6.4",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js",

@@ -1,10 +0,9 @@

import { as, time } from "rjutils-collection";
let rateLimitIds = 0;
import { as, time, randomNum } from "rjutils-collection";
class RouteRateLimit {
constructor() {
this.data = {
sortTo: rateLimitIds++,
sortTo: randomNum(1, 1e7),
penalty: time(10).s(),
timeWindow: time(10).s(),
maxHits: 60
maxHits: Infinity
};

@@ -11,0 +10,0 @@ }

@@ -219,3 +219,3 @@ import Status from "../../misc/statusEnum";

skipRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return this;

@@ -241,3 +241,3 @@ const data = this.ctg.rateLimits.get(`http+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`, {

clearRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return this;

@@ -254,3 +254,3 @@ this.ctg.rateLimits.delete(`http+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`);

getRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return null;

@@ -257,0 +257,0 @@ const data = this.ctg.rateLimits.get(`http+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`, {

@@ -62,3 +62,3 @@ import WSConnect from "./WsConnect";

skipRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return this;

@@ -84,3 +84,3 @@ const data = this.ctg.rateLimits.get(`ws+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`, {

clearRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return this;

@@ -97,3 +97,3 @@ this.ctg.rateLimits.delete(`ws+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`);

getRateLimit() {
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.timeWindow === Infinity)
if (!this.ctx.execute.route || !("ratelimit" in this.ctx.execute.route.data) || this.ctx.execute.route.data.ratelimit.maxHits === Infinity)
return null;

@@ -100,0 +100,0 @@ const data = this.ctg.rateLimits.get(`ws+${this.client.ip}-${this.ctx.execute.route.data.ratelimit.sortTo}`, {

@@ -452,3 +452,3 @@ import parsePath from "../parsePath";

}
if (ctx.execute.route && "ratelimit" in ctx.execute.route.data && ctx.execute.route.data.ratelimit.timeWindow !== Infinity) {
if (ctx.execute.route && "ratelimit" in ctx.execute.route.data && ctx.execute.route.data.ratelimit.maxHits !== Infinity) {
let data = ctg.rateLimits.get(`http+${ctr.client.ip}-${ctx.execute.route.data.ratelimit.sortTo}`, {

@@ -455,0 +455,0 @@ hits: 0,

@@ -24,3 +24,3 @@ import handleEvent from "../handleEvent";

ctr["@"] = custom;
if (ctx.execute.route && "ratelimit" in ctx.execute.route.data && ctx.execute.route.data.ratelimit.timeWindow !== Infinity) {
if (ctx.execute.route && "ratelimit" in ctx.execute.route.data && ctx.execute.route.data.ratelimit.maxHits !== Infinity) {
let data = ctg.rateLimits.get(`ws+${ctr.client.ip}-${ctx.execute.route.data.ratelimit.sortTo}`, {

@@ -27,0 +27,0 @@ hits: 0,

{
"name": "rjweb-server",
"version": "8.6.3",
"version": "8.6.4",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js",

{
"name": "rjweb-server",
"version": "8.6.3",
"version": "8.6.4",
"description": "Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS",

@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc