diff --git a/.env.example b/.env.example index 54b852e8..a7bfa67b 100644 --- a/.env.example +++ b/.env.example @@ -55,7 +55,7 @@ VITE_BOOTSTRAPURL=https://dev4.4nkweb.com/ws/ SUCCES='4242 4242 4242 4242' DECLINED='4000 0025 0000 3155' CORS_ALLOWED_ORIGINS=http://local.4nkweb.com:3000,https://dev4.4nkweb.com - +ENABLE_SUBSCRIPTION_STUB=true # ================================= /!\ sensible ======================== @@ -86,4 +86,5 @@ STRIPE_STANDARD_ANNUAL_SUBSCRIPTION_PRICE_ID= STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID= STRIPE_UNLIMITED_ANNUAL_SUBSCRIPTION_PRICE_ID= -SIGNER_API_KEY=your-api-key-change-this \ No newline at end of file +SIGNER_API_KEY=your-api-key-change-this +VITE_JWT_SECRET_KEY=52b3d77617bb00982dfee15b08effd52cfe5b2e69b2f61cc4848cfe1e98c0bc9 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index fe89e93a..b72e63ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ ## v0.1.3 ## v0.1.4 +## v0.1.5 + +- IdNot: appel backend changé en POST `/api/v1/idnot/auth` avec `{ code }` dans le corps (évite erreurs 502 proxy sur URL longue). +- Documentation et tests mis à jour. +- Rappel déploiement: builder et pousser l’image tagguée `ext` pour récupération par `lecoffre_node`. + - Sous-chemin Next activé: `basePath: '/lecoffre'`. - Normalisation SSR du `targetOrigin` de l’iframe sur l’origine de `NEXT_PUBLIC_4NK_URL`. - CI: build-arg optionnel `NEXT_PUBLIC_4NK_URL` depuis les secrets. diff --git a/docs/analyse.md b/docs/analyse.md index cc1ba780..6c6b5130 100644 --- a/docs/analyse.md +++ b/docs/analyse.md @@ -42,3 +42,40 @@ Analyse synthétique de `lecoffre-front` (Next.js) : périmètre, dépendances, ### Déploiement - **Dockerfile**: présent (build Next standalone) - **Intégration**: orchestré via `lecoffre_node` (voir analyse dédiée) + +## Scripts npm, build et configuration + +### Scripts +- **dev**: `next dev` +- **build**: `NEXT_TELEMETRY_DISABLED=1 next build --no-lint` +- **start**: `next start` +- **lint**: `next lint` +- **format**: `prettier --write src` + +### next.config.js +- `output: 'standalone'`, `basePath: '/lecoffre'` +- `typescript.ignoreBuildErrors: true` (risque: masquage d’erreurs) +- Exposition de nombreuses variables `NEXT_PUBLIC_*` via `env`, `publicRuntimeConfig` et `serverRuntimeConfig` + +### Docker (multi‑stage) +- Étapes: `deps` (install), `development` (dev), `builder` (build), `ext` (runtime) +- BuildKit SSH pour `le-coffre-resources` (clé non copiée dans l’image) +- Port runtime 3000; utilisateur non‑root `lecoffreuser` + +### Dépendances (extraits) +- UI: `@mui/material`, `@emotion/*`, `react-select`, `react-toastify` +- Utilitaires: `jwt-decode`, `file-saver`, `jszip`, `pdf-lib`, `sass`, `sharp` +- Ressources: `le-coffre-resources` (SSH Git 4NK) +- Versions Node/Next: Node 19‑alpine; Next `^14.2.3` + +## Risques et recommandations +- Désactiver `ignoreBuildErrors` et corriger les erreurs TypeScript avant build +- Envisager Node LTS (20/22) pour les images +- Vérifier qu’aucune info sensible n’est exposée via `NEXT_PUBLIC_*` +- Assurer la cohérence `basePath` `/lecoffre` avec Nginx et les liens internes +- Introduire du code splitting ciblé (`React.lazy`/`Suspense`) sur pages lourdes +- Centraliser l’état (Redux/Context) pour limiter le prop drilling dans `src/front` + +## Changements IdNot +- L’authentification IdNot appelle désormais le backend en POST avec le code d’autorisation dans le corps JSON sur `/api/v1/idnot/auth`. +- Ce changement évite des erreurs en reverse proxy liées à des segments d’URL très longs. diff --git a/package.json b/package.json index b294be8a..92c7a90a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lecoffre-front", - "version": "0.1.4", + "version": "0.1.5", "private": true, "scripts": { "dev": "next dev", diff --git a/src/front/Api/Auth/IdNot/index.ts b/src/front/Api/Auth/IdNot/index.ts index d8c66cf5..b1ea8caa 100644 --- a/src/front/Api/Auth/IdNot/index.ts +++ b/src/front/Api/Auth/IdNot/index.ts @@ -43,19 +43,20 @@ export default class Auth extends BaseApiService { } } - public async idNotAuth(autorizationCode: string | string[]): Promise<{ idNotUser: any; authToken: string }> { - const variables = FrontendVariables.getInstance(); + public async idNotAuth(autorizationCode: string | string[]): Promise<{ idNotUser: any; authToken: string }> { + const variables = FrontendVariables.getInstance(); const baseBackUrl = this.getBaseUrl(); - const url = new URL(`${baseBackUrl}/idnot/auth/${autorizationCode}`); - try { - return await this.postRequest<{ idNotUser: any; authToken: string }>(url); - } catch (err) { - this.onError(err); - return Promise.reject(err); - } - } + const url = new URL(`${baseBackUrl}/idnot/auth`); + const code = Array.isArray(autorizationCode) ? autorizationCode[0] : autorizationCode; + try { + return await this.postRequest<{ idNotUser: any; authToken: string }>(url, { code }); + } catch (err) { + this.onError(err); + return Promise.reject(err); + } + } public async getIdNotUser(): Promise<{ success: boolean; data: any }> { const variables = FrontendVariables.getInstance(); diff --git a/tests/analyse.md b/tests/analyse.md index 8e473e84..ab5567e1 100644 --- a/tests/analyse.md +++ b/tests/analyse.md @@ -11,6 +11,7 @@ Axes de tests pour `lecoffre-front` (sans exemples d’implémentation). ### Données et intégrations - **API Back**: validation des URL via `NEXT_PUBLIC_BACK_API_*` et `NEXT_PUBLIC_API_URL` +- **IdNot Auth**: vérifier que l’appel se fait en POST `/api/v1/idnot/auth` avec `{ code }` dans le corps, et qu’aucune URL longue n’est utilisée. - **Idnot/Docaposte**: vérification des redirections et scopes ### Non-régressions UI/UX