@20syldev/api 3.3.4 → 3.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/app.js +7 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <a href="https://api.sylvain.pro"><img src="https://api.sylvain.pro/favicon.ico" alt="Logo" width="25%" height="auto"/></a>
3
3
 
4
4
  # API Personnelle
5
- [![Version](https://custom-icon-badges.demolab.com/badge/Version%20:-v3.3.4-6479ee?logo=api.sylvain.pro&labelColor=23272A)](https://github.com/20syldev/api/releases/latest)
5
+ [![Version](https://custom-icon-badges.demolab.com/badge/Version%20:-v3.3.6-6479ee?logo=api.sylvain.pro&labelColor=23272A)](https://github.com/20syldev/api/releases/latest)
6
6
  </div>
7
7
 
8
8
  ---
@@ -46,7 +46,7 @@ Enfin, **exécutez** le script de build, qui installera les **dépendances** et
46
46
  $ npm run build
47
47
  ```
48
48
  ```console
49
- > @20syldev/api@3.3.4 build
49
+ > @20syldev/api@3.3.6 build
50
50
  > npm install && node app.js
51
51
 
52
52
  [...]
package/app.js CHANGED
@@ -136,6 +136,10 @@ app.use((req, res, next) => {
136
136
  return res.status(429).jsonResponse({ message: 'Too Many Requests' });
137
137
  }
138
138
 
139
+ if (['__proto__', 'constructor', 'prototype'].includes(ip)) {
140
+ return res.status(400).jsonResponse({ message: 'Invalid IP address' });
141
+ }
142
+
139
143
  if (!ipLimits[ip]) ipLimits[ip] = {};
140
144
  if (!ipLimits[ip][hour]) ipLimits[ip][hour] = {};
141
145
  ipLimits[ip][hour][minute] = (ipLimits[ip][hour][minute] || 0) + 1;
@@ -350,7 +354,7 @@ app.get('/:version/algorithms', (req, res) => {
350
354
  if (!['anagram', 'bubblesort', 'factorial', 'fibonacci', 'gcd', 'isprime', 'palindrome', 'primefactors', 'primelist', 'reverse'].includes(method)) {
351
355
  return res.jsonResponse({
352
356
  error: 'Please provide a valid algorithm (?method={algorithm})',
353
- documentation: `https://docs.sylvain.pro/${version}/algorithms`
357
+ documentation: `https://docs.sylvain.pro/${version}/en/algorithms`
354
358
  });
355
359
  }
356
360
  if (!value) return res.jsonResponse({ error: 'Please provide a valid value (&value={value})' });
@@ -1006,8 +1010,8 @@ app.post('/:version/hash', (req, res) => {
1006
1010
 
1007
1011
  if (!text) return res.jsonResponse({ error: 'Please provide a text (?text={text})' });
1008
1012
  if (!method) return res.jsonResponse({
1009
- error: 'Please provide a valid hash algorithm (?method={algorithm})',
1010
- documentation: `https://docs.sylvain.pro/${version}/hash`
1013
+ error: 'Please provide a valid hash algorithm (&method={algorithm})',
1014
+ documentation: `https://docs.sylvain.pro/${version}/en/hash`
1011
1015
  });
1012
1016
 
1013
1017
  const methods = getHashes();
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.4",
2
+ "version": "3.3.6",
3
3
  "name": "@20syldev/api",
4
4
  "description": "Node.js API with multiple features. Check the documentation at https://docs.sylvain.pro",
5
5
  "main": "app.js",