From 45151874ce0809088c5886d58647b3f0b58bfb82 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 08:43:59 +0000 Subject: [PATCH 1/6] [npm] Bump the vre-panel-npm group in /vre-panel with 13 updates Bumps the vre-panel-npm group in /vre-panel with 13 updates: | Package | From | To | | --- | --- | --- | | [@headlessui/react](https://github.com/tailwindlabs/headlessui/tree/HEAD/packages/@headlessui-react) | `1.7.19` | `2.1.2` | | [axios](https://github.com/axios/axios) | `1.6.8` | `1.7.3` | | [keycloak-js](https://github.com/keycloak/keycloak) | `23.0.7` | `25.0.2` | | [next](https://github.com/vercel/next.js) | `13.4.4` | `14.2.5` | | [next-auth](https://github.com/nextauthjs/next-auth) | `4.5.0` | `4.24.7` | | [react](https://github.com/facebook/react/tree/HEAD/packages/react) | `18.2.0` | `18.3.1` | | [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom) | `18.2.0` | `18.3.1` | | [typescript](https://github.com/Microsoft/TypeScript) | `4.9.5` | `5.5.4` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `20.11.30` | `22.1.0` | | [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) | `18.2.79` | `18.3.3` | | [axios-mock-adapter](https://github.com/ctimmerm/axios-mock-adapter) | `1.22.0` | `2.0.0` | | [eslint](https://github.com/eslint/eslint) | `8.57.0` | `9.8.0` | | [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) | `14.1.0` | `14.2.5` | Updates `@headlessui/react` from 1.7.19 to 2.1.2 - [Release notes](https://github.com/tailwindlabs/headlessui/releases) - [Changelog](https://github.com/tailwindlabs/headlessui/blob/main/packages/@headlessui-react/CHANGELOG.md) - [Commits](https://github.com/tailwindlabs/headlessui/commits/@headlessui/react@v2.1.2/packages/@headlessui-react) Updates `axios` from 1.6.8 to 1.7.3 - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v1.6.8...v1.7.3) Updates `keycloak-js` from 23.0.7 to 25.0.2 - [Release notes](https://github.com/keycloak/keycloak/releases) - [Commits](https://github.com/keycloak/keycloak/compare/23.0.7...25.0.2) Updates `next` from 13.4.4 to 14.2.5 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v13.4.4...v14.2.5) Updates `next-auth` from 4.5.0 to 4.24.7 - [Release notes](https://github.com/nextauthjs/next-auth/releases) - [Commits](https://github.com/nextauthjs/next-auth/compare/next-auth@v4.5.0...next-auth@4.24.7) Updates `react` from 18.2.0 to 18.3.1 - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v18.3.1/packages/react) Updates `react-dom` from 18.2.0 to 18.3.1 - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v18.3.1/packages/react-dom) Updates `typescript` from 4.9.5 to 5.5.4 - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.9.5...v5.5.4) Updates `@types/node` from 20.11.30 to 22.1.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@types/react` from 18.2.79 to 18.3.3 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) Updates `axios-mock-adapter` from 1.22.0 to 2.0.0 - [Release notes](https://github.com/ctimmerm/axios-mock-adapter/releases) - [Changelog](https://github.com/ctimmerm/axios-mock-adapter/blob/master/CHANGELOG.md) - [Commits](https://github.com/ctimmerm/axios-mock-adapter/compare/v1.22.0...v2.0.0) Updates `eslint` from 8.57.0 to 9.8.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.57.0...v9.8.0) Updates `eslint-config-next` from 14.1.0 to 14.2.5 - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/commits/v14.2.5/packages/eslint-config-next) --- updated-dependencies: - dependency-name: "@headlessui/react" dependency-type: direct:production update-type: version-update:semver-major dependency-group: vre-panel-npm - dependency-name: axios dependency-type: direct:production update-type: version-update:semver-minor dependency-group: vre-panel-npm - dependency-name: keycloak-js dependency-type: direct:production update-type: version-update:semver-major dependency-group: vre-panel-npm - dependency-name: next dependency-type: direct:production update-type: version-update:semver-major dependency-group: vre-panel-npm - dependency-name: next-auth dependency-type: direct:production update-type: version-update:semver-minor dependency-group: vre-panel-npm - dependency-name: react dependency-type: direct:production update-type: version-update:semver-minor dependency-group: vre-panel-npm - dependency-name: react-dom dependency-type: direct:production update-type: version-update:semver-minor dependency-group: vre-panel-npm - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-major dependency-group: vre-panel-npm - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-major dependency-group: vre-panel-npm - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: vre-panel-npm - dependency-name: axios-mock-adapter dependency-type: direct:development update-type: version-update:semver-major dependency-group: vre-panel-npm - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major dependency-group: vre-panel-npm - dependency-name: eslint-config-next dependency-type: direct:development update-type: version-update:semver-minor dependency-group: vre-panel-npm ... Signed-off-by: dependabot[bot] --- vre-panel/package.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/vre-panel/package.json b/vre-panel/package.json index aef2f74..aafdc79 100644 --- a/vre-panel/package.json +++ b/vre-panel/package.json @@ -8,18 +8,18 @@ "lint": "next lint" }, "dependencies": { - "@headlessui/react": "~1.7.17", + "@headlessui/react": "~2.1.2", "@react-keycloak/ssr": "~3.3.0", "@tailwindcss/line-clamp": "latest", - "axios": "~1.6.0", + "axios": "~1.7.3", "clsx": "^2.0.0", "cookie": "~0.6.0", "http": "~0.0.1-security", - "keycloak-js": "~23.0.3", - "next": "13.4.4", - "next-auth": "~4.5.0", - "react": "18.2.0", - "react-dom": "18.2.0", + "keycloak-js": "~25.0.2", + "next": "14.2.5", + "next-auth": "~4.24.7", + "react": "18.3.1", + "react-dom": "18.3.1", "react-markdown": "^9.0.0", "react-scripts": "5.0.1", "tailwindcss": "~3.4.1", @@ -29,14 +29,14 @@ "leaflet": "~1.9.0" }, "devDependencies": { - "typescript": "^4.5", + "typescript": "^5.5", "@tailwindcss/typography": "^0.5.10", - "@types/node": "~20.11.25", - "@types/react": "~18.2.0", + "@types/node": "~22.1.0", + "@types/react": "~18.3.3", "autoprefixer": "~10.4.15", - "axios-mock-adapter": "~1.22.0", - "eslint": "8.57.0", - "eslint-config-next": "14.1.0", + "axios-mock-adapter": "~2.0.0", + "eslint": "9.8.0", + "eslint-config-next": "14.2.5", "postcss": "^8.4.27", "@types/object-hash": "~3.0.0", "@types/leaflet": "~1.9.1" From 214d8ae3be55d7a6c502659a702921bf0fb7bfc5 Mon Sep 17 00:00:00 2001 From: Gabriel Pelouze Date: Thu, 8 Aug 2024 14:50:13 +0200 Subject: [PATCH 2/6] fix npm version incompatibilities --- vre-panel/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vre-panel/package.json b/vre-panel/package.json index aafdc79..bd0fbbf 100644 --- a/vre-panel/package.json +++ b/vre-panel/package.json @@ -21,7 +21,6 @@ "react": "18.3.1", "react-dom": "18.3.1", "react-markdown": "^9.0.0", - "react-scripts": "5.0.1", "tailwindcss": "~3.4.1", "use-subscription": "~1.8.0", "object-hash": "~3.0.0", @@ -35,7 +34,7 @@ "@types/react": "~18.3.3", "autoprefixer": "~10.4.15", "axios-mock-adapter": "~2.0.0", - "eslint": "9.8.0", + "eslint": "^8", "eslint-config-next": "14.2.5", "postcss": "^8.4.27", "@types/object-hash": "~3.0.0", From 47eb3e82f9ab5b9150a9763794a2f420ac937d8d Mon Sep 17 00:00:00 2001 From: Gabriel Pelouze Date: Thu, 8 Aug 2024 15:20:07 +0200 Subject: [PATCH 3/6] fix code following headlessui update --- vre-panel/components/NewVREDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vre-panel/components/NewVREDialog.tsx b/vre-panel/components/NewVREDialog.tsx index ece241d..b5eadf7 100644 --- a/vre-panel/components/NewVREDialog.tsx +++ b/vre-panel/components/NewVREDialog.tsx @@ -20,7 +20,7 @@ const NewVREDialog = ({ isOpen, setIsOpen }: { isOpen: boolean, setIsOpen: Funct leaveFrom="opacity-100" leaveTo="opacity-0" > - +
{/* This element is to trick the browser into centering the modal contents. */} From d4192f55413145bc582d6f4325c1952230e724b1 Mon Sep 17 00:00:00 2001 From: Gabriel Pelouze Date: Thu, 8 Aug 2024 15:23:21 +0200 Subject: [PATCH 4/6] fix code following next update --- vre-panel/next.config.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vre-panel/next.config.js b/vre-panel/next.config.js index 56ab911..a0c76f2 100644 --- a/vre-panel/next.config.js +++ b/vre-panel/next.config.js @@ -2,9 +2,7 @@ console.log(process.env.NODE_ENV); module.exports = { reactStrictMode: true, - experimental: { - outputStandalone: true - }, + output: "standalone", basePath: process.env.FRONTEND_BASE_PATH, publicRuntimeConfig: { basePath: process.env.FRONTEND_BASE_PATH, From 77f99f33211bc2ab22c19df437ed018bd6a13b3d Mon Sep 17 00:00:00 2001 From: Gabriel Pelouze Date: Thu, 8 Aug 2024 16:40:06 +0200 Subject: [PATCH 5/6] fix code following next-auth update --- vre-panel/components/VLabInstances.tsx | 2 +- vre-panel/next-auth.d.ts | 78 ++--------------------- vre-panel/pages/api/auth/[...nextauth].ts | 16 +++-- 3 files changed, 15 insertions(+), 81 deletions(-) diff --git a/vre-panel/components/VLabInstances.tsx b/vre-panel/components/VLabInstances.tsx index 727e76b..394f3dd 100644 --- a/vre-panel/components/VLabInstances.tsx +++ b/vre-panel/components/VLabInstances.tsx @@ -31,7 +31,7 @@ const VLabInstances: React.FC = ({vlab, slug}) => { return } - const username = session.data.user.name + const username = session.data.user?.name const requestOptions: RequestInit = { method: "POST", diff --git a/vre-panel/next-auth.d.ts b/vre-panel/next-auth.d.ts index 1fc0c0f..568ba3b 100644 --- a/vre-panel/next-auth.d.ts +++ b/vre-panel/next-auth.d.ts @@ -5,86 +5,18 @@ declare module 'next-auth' { * Returned by `useSession`, `getSession` and received as a prop on the `Provider` React Context */ interface Session { - user: { - sub: string; - email_verified: boolean; - name: string; - preferred_username: string; - given_name: string; - family_name: string; - email: string; - id: string; - org_name?: string; - telephone?: string; - }; + accessToken?: string; + accessTokenExpiry?: number; error: string; - accessTokenExpiry: number; - } - /** - * The shape of the user object returned in the OAuth providers' `profile` callback, - * or the second parameter of the `session` callback, when using a database. - */ - interface User { - sub: string; - email_verified: boolean; - name: string; - telephone: string; - preferred_username: string; - org_name: string; - given_name: string; - family_name: string; - email: string; - id: string; - } - /** - * Usually contains information about the provider being used - * and also extends `TokenSet`, which is different tokens returned by OAuth Providers. - */ - interface Account { - provider: string; - type: string; - id: string; - accessToken: string; - accessTokenExpires?: any; - refreshToken: string; - idToken: string; - access_token: string; - expires_at: number; - refresh_expires_in: number; - refresh_token: string; - token_type: string; - id_token: string; - 'not-before-policy': number; - session_state: string; - scope: string; - } - /** The OAuth profile returned from your provider */ - interface Profile { - sub: string; - email_verified: boolean; - name: string; - telephone: string; - preferred_username: string; - org_name: string; - given_name: string; - family_name: string; - email: string; } } declare module 'next-auth/jwt' { /** Returned by the `jwt` callback and `getToken`, when using JWT sessions */ interface JWT { - name: string; - email: string; - sub: string; - name: string; - email: string; - sub: string; - accessToken: string; - refreshToken: string; - accessTokenExpiry: number; - user: User; + accessToken?: string; + refreshToken?: string; + accessTokenExpiry?: number; error: string; } } \ No newline at end of file diff --git a/vre-panel/pages/api/auth/[...nextauth].ts b/vre-panel/pages/api/auth/[...nextauth].ts index b137ef9..66ef9fb 100644 --- a/vre-panel/pages/api/auth/[...nextauth].ts +++ b/vre-panel/pages/api/auth/[...nextauth].ts @@ -1,5 +1,6 @@ import axios from "axios"; import NextAuth from "next-auth" +import { Session } from "next-auth"; import { JWT } from "next-auth/jwt"; import KeycloakProvider from "next-auth/providers/keycloak" import type { NextApiRequest, NextApiResponse } from 'next' @@ -64,18 +65,19 @@ export default (req : NextApiRequest, res: NextApiResponse) => { token.accessTokenExpiry = account.expires_at; } - const expDate = new Date(token.accessTokenExpiry * 1e3) - const nowDate = new Date() - const tokenExpired = (expDate < nowDate) - - if (tokenExpired) { - token = await refreshAccessToken(token); + if (token.accessTokenExpiry) { + const expDate = new Date(token.accessTokenExpiry * 1e3) + const nowDate = new Date() + const tokenExpired = (expDate < nowDate) + if (tokenExpired) { + token = await refreshAccessToken(token); + } } return token; }, - async session({ session, token }) { + async session({ session, token }: { session: Session, token: JWT }) { if (token) { session.error = token.error; session.accessToken = token.accessToken; From cdf09a869ea12dd3ab2455e5b9f2167f2951979b Mon Sep 17 00:00:00 2001 From: Gabriel Pelouze Date: Fri, 9 Aug 2024 10:18:25 +0200 Subject: [PATCH 6/6] fix docker healthcheck --- vre-panel/docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/vre-panel/docker-compose.yaml b/vre-panel/docker-compose.yaml index 65109b5..6082258 100644 --- a/vre-panel/docker-compose.yaml +++ b/vre-panel/docker-compose.yaml @@ -8,6 +8,7 @@ services: - AUTH0_ID= - AUTH0_ISSUER= - SECRET=secret + - HOSTNAME=localhost ports: - '127.0.0.1:3000:3000' healthcheck: