@20syldev/api 3.3.9 → 3.4.0
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.
- package/.github/FUNDING.yml +1 -1
- package/.github/workflows/publish.yml +27 -27
- package/LICENSE +27 -27
- package/README.md +110 -60
- package/app.js +817 -1174
- package/modules/v3/algorithms.js +218 -0
- package/modules/v3/captcha.js +55 -0
- package/modules/v3/chat.js +109 -0
- package/modules/v3/color.js +41 -0
- package/modules/v3/convert.js +39 -0
- package/modules/v3/domain.js +39 -0
- package/modules/v3/hash.js +16 -0
- package/modules/v3/hyperplanning.js +51 -0
- package/modules/v3/levenshtein.js +46 -0
- package/modules/v3/personal.js +127 -0
- package/modules/v3/qrcode.js +20 -0
- package/modules/v3/tic_tac_toe.js +167 -0
- package/modules/v3/time.js +87 -0
- package/modules/v3/token.js +48 -0
- package/modules/v3/username.js +32 -0
- package/modules/v3/utils.js +66 -0
- package/modules/v3.js +15 -0
- package/package.json +53 -49
- package/robots.txt +73 -73
package/.github/FUNDING.yml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
github: [20syldev]
|
|
1
|
+
github: [20syldev]
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
name: 20syldev/api package publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [created]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v4
|
|
12
|
-
- uses: actions/setup-node@v4
|
|
13
|
-
with:
|
|
14
|
-
node-version: 20
|
|
15
|
-
|
|
16
|
-
publish-npm:
|
|
17
|
-
needs: build
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@v4
|
|
21
|
-
- uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: 20
|
|
24
|
-
registry-url: https://registry.npmjs.org/
|
|
25
|
-
- run: npm publish
|
|
26
|
-
env:
|
|
27
|
-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
1
|
+
name: 20syldev/api package publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: actions/setup-node@v4
|
|
13
|
+
with:
|
|
14
|
+
node-version: 20
|
|
15
|
+
|
|
16
|
+
publish-npm:
|
|
17
|
+
needs: build
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 20
|
|
24
|
+
registry-url: https://registry.npmjs.org/
|
|
25
|
+
- run: npm publish
|
|
26
|
+
env:
|
|
27
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
package/LICENSE
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024, Sylvain L.
|
|
4
|
-
|
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
|
6
|
-
modification, are permitted provided that the following conditions are met:
|
|
7
|
-
|
|
8
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
-
list of conditions and the following disclaimer.
|
|
10
|
-
|
|
11
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
-
this list of conditions and the following disclaimer in the documentation
|
|
13
|
-
and/or other materials provided with the distribution.
|
|
14
|
-
|
|
15
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
-
contributors may be used to endorse or promote products derived from
|
|
17
|
-
this software without specific prior written permission.
|
|
18
|
-
|
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Sylvain L.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
28
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,60 +1,110 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<a href="https://api.sylvain.pro"><img src="https://api.sylvain.pro/favicon.ico" alt="Logo" width="25%" height="auto"/></a>
|
|
3
|
-
|
|
4
|
-
# API Personnelle
|
|
5
|
-
[.
|
|
12
|
-
L'API est développée avec Node.js et hébergée **24h/7j**. Elle est **simple d'utilisation** et a une **documentation** disponible sur [docs.sylvain.pro](https://docs.sylvain.pro) !
|
|
13
|
-
> *Une limite de **2000** requêtes **par heure** est fixée. Elle change pour certains endpoints nécessitant plus de ressources. Si vous souhaitez une **augmentation** de cette limite, n'hésitez pas à visiter la [documentation](https://docs.sylvain.pro/pricing).*
|
|
14
|
-
|
|
15
|
-
## Installer le paquet de l'API sur votre machine
|
|
16
|
-
```console
|
|
17
|
-
$ sudo apt install nodejs npm
|
|
18
|
-
$ npm install @20syldev/api
|
|
19
|
-
$ npm init
|
|
20
|
-
```
|
|
21
|
-
> *Attention, vous devez configurer le type sur "**module**" dans votre fichier `package.json`.*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://api.sylvain.pro"><img src="https://api.sylvain.pro/favicon.ico" alt="Logo" width="25%" height="auto"/></a>
|
|
3
|
+
|
|
4
|
+
# API Personnelle
|
|
5
|
+
[](https://github.com/20syldev/api/releases/latest)
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## À propos de l'API
|
|
11
|
+
Voici mon API personnelle, disponible sur le domaine [api.sylvain.pro](https://api.sylvain.pro).
|
|
12
|
+
L'API est développée avec Node.js et hébergée **24h/7j**. Elle est **simple d'utilisation** et a une **documentation** disponible sur [docs.sylvain.pro](https://docs.sylvain.pro) !
|
|
13
|
+
> *Une limite de **2000** requêtes **par heure** est fixée. Elle change pour certains endpoints nécessitant plus de ressources. Si vous souhaitez une **augmentation** de cette limite, n'hésitez pas à visiter la [documentation](https://docs.sylvain.pro/pricing).*
|
|
14
|
+
|
|
15
|
+
## Installer le paquet de l'API sur votre machine
|
|
16
|
+
```console
|
|
17
|
+
$ sudo apt install nodejs npm
|
|
18
|
+
$ npm install @20syldev/api
|
|
19
|
+
$ npm init
|
|
20
|
+
```
|
|
21
|
+
> *Attention, vous devez configurer le type sur "**module**" dans votre fichier `package.json`.*
|
|
22
|
+
|
|
23
|
+
## Utiliser l'API
|
|
24
|
+
|
|
25
|
+
### Option 1 : Démarrer un serveur local
|
|
26
|
+
|
|
27
|
+
Pour démarrer un serveur local avec tous les endpoints, créez un fichier JavaScript, par exemple `index.js` :
|
|
28
|
+
```js
|
|
29
|
+
import '@20syldev/api';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Puis, **démarrez** un serveur [Node.js](https://nodejs.org) :
|
|
33
|
+
```console
|
|
34
|
+
$ node index.js
|
|
35
|
+
API is running on
|
|
36
|
+
- http://127.0.0.1:3000
|
|
37
|
+
- http://localhost:3000
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Option 2 : Utiliser les modules directement dans votre code
|
|
41
|
+
|
|
42
|
+
Vous pouvez également importer les modules spécifiques dont vous avez besoin :
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// Importer des modules spécifiques depuis la v3
|
|
46
|
+
import { color, token, username } from '@20syldev/api/v3';
|
|
47
|
+
|
|
48
|
+
// Générer une couleur aléatoire
|
|
49
|
+
const couleur = color();
|
|
50
|
+
console.log(`Couleur HEX: ${couleur.hex}`);
|
|
51
|
+
console.log(`Couleur RGB: ${couleur.rgb}`);
|
|
52
|
+
console.log(`Couleur HSL: ${couleur.hsl}`);
|
|
53
|
+
|
|
54
|
+
// Générer un nom d'utilisateur aléatoire
|
|
55
|
+
const utilisateur = username();
|
|
56
|
+
console.log(`Nom d'utilisateur: ${utilisateur.username}`);
|
|
57
|
+
|
|
58
|
+
// Générer un jeton sécurisé
|
|
59
|
+
const jeton = token(16, 'hex');
|
|
60
|
+
console.log(`Jeton: ${jeton}`);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Tester l'API sur votre machine
|
|
64
|
+
**Téléchargez** la [dernière mise à jour](https://github.com/20syldev/api/releases/latest) de l'API, puis **extrayez** le contenu du fichier `.zip` ou `.tar.gz` dans un de vos **répertoires**.
|
|
65
|
+
Ensuite, **déplacez-vous** dans le dossier du projet, via un terminal **Linux**, **Windows** ou **macOS** :
|
|
66
|
+
```console
|
|
67
|
+
$ cd /chemin/vers/le/projet
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Enfin, **exécutez** le script de build, qui installera les **dépendances** et lancera le **serveur** de l'[API](https://api.sylvain.pro) :
|
|
71
|
+
```console
|
|
72
|
+
$ npm run build
|
|
73
|
+
```
|
|
74
|
+
```console
|
|
75
|
+
> @20syldev/api@3.4.0 build
|
|
76
|
+
> npm install && node app.js
|
|
77
|
+
|
|
78
|
+
[...]
|
|
79
|
+
|
|
80
|
+
found 0 vulnerabilities
|
|
81
|
+
API is running on
|
|
82
|
+
- http://127.0.0.1:3000
|
|
83
|
+
- http://localhost:3000
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Modules disponibles
|
|
87
|
+
|
|
88
|
+
L'API v3 expose plusieurs modules que vous pouvez importer :
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
import {
|
|
92
|
+
algorithms, // Fonctions algorithmiques diverses
|
|
93
|
+
captcha, // Génération d'images captcha
|
|
94
|
+
chat, // Système de chat temporaire
|
|
95
|
+
color, // Génération de couleurs aléatoires
|
|
96
|
+
convert, // Conversions d'unités
|
|
97
|
+
domain, // Informations de domaine aléatoires
|
|
98
|
+
hash, // Hachage de texte
|
|
99
|
+
hyperplanning, // Analyse de calendriers
|
|
100
|
+
levenshtein, // Distance entre chaînes
|
|
101
|
+
personal, // Informations personnelles aléatoires
|
|
102
|
+
qrcode, // Génération de QR codes
|
|
103
|
+
tic_tac_toe, // Jeu de morpion
|
|
104
|
+
time, // Informations temporelles
|
|
105
|
+
token, // Génération de jetons sécurisés
|
|
106
|
+
username // Génération de noms d'utilisateur
|
|
107
|
+
} from '@20syldev/api/v3';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
*Visitez la [documentation](https://docs.sylvain.pro) dédiée, vous y retrouverez des exemples de requêtes et des codes simples pour tester l'[API](https://api.sylvain.pro) !*
|