@20syldev/api 3.2.2 → 3.2.4
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/README.md +2 -2
- package/app.js +20 -19
- 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
|
-
[](https://github.com/20syldev/api/releases/latest)
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
8
|
---
|
|
@@ -44,7 +44,7 @@ Enfin, **exécutez** le script de build, qui installera les **dépendances** et
|
|
|
44
44
|
$ npm run build
|
|
45
45
|
```
|
|
46
46
|
```console
|
|
47
|
-
> @20syldev/api@3.2.
|
|
47
|
+
> @20syldev/api@3.2.4 build
|
|
48
48
|
> npm install && node app.js
|
|
49
49
|
|
|
50
50
|
[...]
|
package/app.js
CHANGED
|
@@ -861,6 +861,7 @@ app.get('/:version/website', async (req, res) => {
|
|
|
861
861
|
gemsync: process.env.GEMSYNC,
|
|
862
862
|
gitsite: process.env.GITSITE,
|
|
863
863
|
logs: process.env.LOGS,
|
|
864
|
+
logvault: process.env.LOGVAULT,
|
|
864
865
|
minify: process.env.MINIFY,
|
|
865
866
|
morpion: process.env.MORPION,
|
|
866
867
|
nitrogen: process.env.NITROGEN,
|
|
@@ -951,6 +952,24 @@ app.post('/:version/chat/private', (req, res) => {
|
|
|
951
952
|
return res.jsonResponse({ error: 'Invalid or expired token.' });
|
|
952
953
|
});
|
|
953
954
|
|
|
955
|
+
// Generate hash
|
|
956
|
+
app.post('/:version/hash', (req, res) => {
|
|
957
|
+
const { text, method } = req.body;
|
|
958
|
+
const { version } = req.params;
|
|
959
|
+
|
|
960
|
+
if (!text) return res.jsonResponse({ error: 'Please provide a text (?text={text})' });
|
|
961
|
+
if (!method) return res.jsonResponse({
|
|
962
|
+
error: 'Please provide a valid hash algorithm (?method={algorithm})',
|
|
963
|
+
documentation: `https://docs.sylvain.pro/${version}/hash`
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
const methods = getHashes();
|
|
967
|
+
if (!methods.includes(method)) return res.jsonResponse({ error: `Unsupported method. Use one of: ${methods.join(', ')}` });
|
|
968
|
+
|
|
969
|
+
const hash = createHash(method).update(text).digest('hex');
|
|
970
|
+
res.jsonResponse({ method, hash });
|
|
971
|
+
});
|
|
972
|
+
|
|
954
973
|
// Display a planning from an ICS file
|
|
955
974
|
app.post('/:version/hyperplanning', async (req, res) => {
|
|
956
975
|
const { url, detail } = req.body;
|
|
@@ -988,7 +1007,7 @@ app.post('/:version/hyperplanning', async (req, res) => {
|
|
|
988
1007
|
return { summary: evt.summary, start, end };
|
|
989
1008
|
})
|
|
990
1009
|
.sort((a, b) => new Date(a.start) - new Date(b.start))
|
|
991
|
-
.filter(e => new Date(e.
|
|
1010
|
+
.filter(e => new Date(e.end) >= new Date());
|
|
992
1011
|
|
|
993
1012
|
res.jsonResponse(events);
|
|
994
1013
|
} catch { res.jsonResponse({ error: 'Failed to parse ICS file.' }); }
|
|
@@ -1072,24 +1091,6 @@ app.post('/:version/tic-tac-toe/fetch', (req, res) => {
|
|
|
1072
1091
|
res.jsonResponse({ game: data, turn, ID, ...result });
|
|
1073
1092
|
});
|
|
1074
1093
|
|
|
1075
|
-
// Generate hash
|
|
1076
|
-
app.post('/:version/hash', (req, res) => {
|
|
1077
|
-
const { text, method } = req.body;
|
|
1078
|
-
const { version } = req.params;
|
|
1079
|
-
|
|
1080
|
-
if (!text) return res.jsonResponse({ error: 'Please provide a text (?text={text})' });
|
|
1081
|
-
if (!method) return res.jsonResponse({
|
|
1082
|
-
error: 'Please provide a valid hash algorithm (?method={algorithm})',
|
|
1083
|
-
documentation: `https://docs.sylvain.pro/${version}/hash`
|
|
1084
|
-
});
|
|
1085
|
-
|
|
1086
|
-
const methods = getHashes();
|
|
1087
|
-
if (!methods.includes(method)) return res.jsonResponse({ error: `Unsupported method. Use one of: ${methods.join(', ')}` });
|
|
1088
|
-
|
|
1089
|
-
const hash = createHash(method).update(text).digest('hex');
|
|
1090
|
-
res.jsonResponse({ method, hash });
|
|
1091
|
-
});
|
|
1092
|
-
|
|
1093
1094
|
// Generate Token
|
|
1094
1095
|
app.post('/:version/token', (req, res) => {
|
|
1095
1096
|
let { len, type } = req.body;
|
package/package.json
CHANGED