From 78addafe1845acebe9a90214ad0e2b31e092749d Mon Sep 17 00:00:00 2001 From: Yanis Rigaudeau Date: Tue, 25 Oct 2022 23:06:10 +0200 Subject: [PATCH] misc --- .gitignore | 2 +- README.md | 21 ++++++++++++++++++++- api/package.json | 4 ++-- api/src/framework/express/middleware.ts | 2 -- api/src/framework/express/server.ts | 1 + banner.png | Bin 0 -> 2744 bytes core/package.json | 2 +- scripts/tools.py | 6 +++--- www/package.json | 4 ++-- 9 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 banner.png diff --git a/.gitignore b/.gitignore index 7b1c6ee..3a0f46c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ **/dist **/config -!.prettierrc.json \ No newline at end of file +!.prettierrc.json diff --git a/README.md b/README.md index 0fd6b13..d5b1a63 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,31 @@ Version Live : https://html5.yayeet.cf +![Bannière](./banner.png) + +Necessite un fichier config (./api/config/config.json) comme celui-ci + +```json +{ + "server": { + "port": 8000, + "origin": ["http://localhost:8080"] + }, + "mongo": { + "uri": "mongodb://localhost:27017", + "dbName": "rate" + } +} +``` + +Ainsi qu'un SGBD MongoDB + ## Installation des dépendances Dans ./ ```bash -python ./scripts/install.py +python ./scripts/tools.py install ``` ## Pour lancer le projet diff --git a/api/package.json b/api/package.json index 6debfcb..26835db 100644 --- a/api/package.json +++ b/api/package.json @@ -7,8 +7,8 @@ "scripts": { "build": "tsc", "dev": "CONFIGFILE=config/config.json NODE_ENV=dev ts-node-dev --respawn --transpile-only ./src/app.ts", - "start": "npm run build && CONFIGFILE=config/config.json node ./dist/api/src/app.js", - "prettier": "prettier -w ./src" + "start": "CONFIGFILE=config/config.json NODE_ENV=dev node ./dist/api/src/app.js", + "prettier": "prettier -w --cache ./src" }, "devDependencies": { "@types/cors": "^2.8.12", diff --git a/api/src/framework/express/middleware.ts b/api/src/framework/express/middleware.ts index 6069954..86b24f6 100644 --- a/api/src/framework/express/middleware.ts +++ b/api/src/framework/express/middleware.ts @@ -22,7 +22,6 @@ export function RequestId(): RequestHandler { export function CheckPermissions(): RequestHandler { function getResourceId(req: Request): string | null { - console.log(req.url); if (req.params.uuid) return req.params.uuid; if (req.body.uuid) return req.body.uuid; return null; @@ -45,7 +44,6 @@ export function CheckPermissions(): RequestHandler { } const ressourceId = getResourceId(req); - console.log(ressourceId); if (!ressourceId) { next({ status: 403, messsage: 'Forbidden' }); return; diff --git a/api/src/framework/express/server.ts b/api/src/framework/express/server.ts index 1ead917..5150448 100644 --- a/api/src/framework/express/server.ts +++ b/api/src/framework/express/server.ts @@ -41,6 +41,7 @@ class Server { store: MongoStore.create({ mongoUrl: mongoConfig.uri, dbName: mongoConfig.dbName, + collectionName: 'sessions', touchAfter: 3600, }), resave: false, diff --git a/banner.png b/banner.png new file mode 100644 index 0000000000000000000000000000000000000000..3e236f40243c5205d952cc691edcaac92dfcd2a5 GIT binary patch literal 2744 zcmZuzdpwkB8-C`UF~(pK<1DrfyNa2gmUb(Q5I#u><2+`|p-B!=Sz=~PCxzOTV}@DU zt%$agP%>((4cnM)MU$G@@+~<|4jE?5e9!Cq^ZWjI55N1l-}}C<>%QOnc?x##^3^4p z69E9a{(j!U03h%cunBm0&!vg9;X^CUFCqhg&mN%{=4tBH{QwY|{@$J;S>mZT^g^pp zD^1ypqXAKu`C*3qoB368d(mYPagXQKI#JS@eAhK+e$+Qy`y2ln@rf)sA93XW#(sk9 zW{H@|FT(a^NjaKpZ5*{ixKHx;92b1YnNB(8R>FH$!{fbqn=r%scJXbHUG4B6u5U80 zlvK|w@iOuZw-asy!BDy(ph9#w@V^gnOT$PkWKt-S(sMhXtUxEz+{RvEMtxB}umJ*j zpOSp0rl_VM<%}x90TDw9O@E9<5 zeUg<}i&w|yQ}>w3zi+wow**4~)Bvu!`IL(~FZM%1ceZ{TIlBoZ(myR_4IW65Ptbg9 z+_uP%XGXR7ud=8vn4K%eTwKY~MQ$_FY27Sui4hJ8j^8Y&8yL4PPQCkAIWk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ff>X+A5ADlzM-^njui1d6)2c2sWUM3C12xvohUqXQYc4D`+2 zr?8Yl1A*%Ka${Ln(2hZKIqc->`!|PwXhtX%fqBQg6YX=HE-ImQqXRHG)$S^A04tRX zG`jk$j&1FdY!#en5m)h-Z=77p_)x-l;8{fNR|r_nl?x_|A1C}PS$7h3VQ+oJQAHZE zv~XpI_$!9ArFX@n=&gaV^=)(}{V5*fil#(#bNsz*Q;J+DIsa}svE`AS2OLF18?fa& z?$v$4_-HX{caSUDY1#$J%`P14ExI`HfOts>Tl}Y69gKfE+{Lle`&rDLE#gF72bjR{Q9VOi7!%uQt;!TIFRu+tM@H-B? zWKpuOM4;alGvewPmD01$I@{iO#m6PUt@^`=f_2V4wZs~3l^OAIUhPh*m9ffGZdgb= zVpj?y?%Jl6#nbIapAF0;qfP>6hP03}s5LV^_Nwr_u~Xo1fPyOeBrd|Ss|2KMjF z)1jPS0`th;n+JMU5>{*gxWWkZikJ4yCjHIR?ZxeNoHFwh&Ij4iJ*tyuqvBuc!GlEw zWw)iHGI;*=Y*vg#Dd(46c|M`L$FqKSYDG}EiX9*I$m^;A*uVz`-K;z~~4-AfCw4Rm}>lOpZD>58@+vhHm0 zHm%s@x)gI@Rf!}=!~3=!H?QkhHlE}t9zGmgs6xLelsb1`>g^G5MXe(W!)Y_9S=L5F zoCQkd$!IuZAd%W`{r`?{aGJo;yn3{Yqp0-CJlxk;?6ckuEx_Mrmv{5_xcvVBF%*m8 literal 0 HcmV?d00001 diff --git a/core/package.json b/core/package.json index 25d9ddb..a341c53 100644 --- a/core/package.json +++ b/core/package.json @@ -6,7 +6,7 @@ "private": true, "scripts": { "build": "tsc", - "prettier": "prettier -w ./src" + "prettier": "prettier -w --cache ./src" }, "devDependencies": { "@types/node": "^18.8.4", diff --git a/scripts/tools.py b/scripts/tools.py index 25f9e74..0915d93 100755 --- a/scripts/tools.py +++ b/scripts/tools.py @@ -1,7 +1,6 @@ #!/usr/bin/python import os import sys -import json apps = ['core', 'api', 'www'] commands = { @@ -12,7 +11,7 @@ commands = { def print_commands(): - print('Commandes disponibles: ', [c for c in commands]) + print('Available commands:', [c for c in commands]) if __name__ == '__main__': @@ -22,10 +21,11 @@ if __name__ == '__main__': cmd = sys.argv[1] if cmd not in commands: - print('Commande \'%s\' non disponible' % cmd) + print('Command \'%s\' not available' % cmd) print_commands() exit() + print('Running \'%s\' on %d apps: %s' % (commands[cmd], len(apps), apps)) for app in apps: os.chdir(app) os.system(commands[cmd]) diff --git a/www/package.json b/www/package.json index 7a4a58e..f6b40ad 100644 --- a/www/package.json +++ b/www/package.json @@ -6,10 +6,10 @@ "private": true, "scripts": { "build": "rollup -c", - "dev": "rollup -c -w ", + "dev": "rollup -c -w", "start": "sirv public --no-clear --host --single", "check": "svelte-check --tsconfig ./tsconfig.json", - "prettier": "prettier -w ./src" + "prettier": "prettier -w --cache ./src" }, "devDependencies": { "@rollup/plugin-commonjs": "^17.0.0",