From e1f409c56fe6cf40a0d28b24a10c6fb3c12bcbb5 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 10 Oct 2024 15:37:53 +0200 Subject: [PATCH 1/5] Fix/slug link prefix --- .../views/verification/EmailVerificationIndex.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/views/verification/EmailVerificationIndex.tsx b/src/components/views/verification/EmailVerificationIndex.tsx index 3df9a7a3dd..d2a15227d3 100644 --- a/src/components/views/verification/EmailVerificationIndex.tsx +++ b/src/components/views/verification/EmailVerificationIndex.tsx @@ -78,10 +78,20 @@ export default function EmailVerificationIndex() { } function Verified() { + const [querySlug, setQuerySlug] = useState(undefined); const router = useRouter(); const { slug } = router.query; const { formatMessage } = useIntl(); + // we must wait for the router to be ready to get the slug from the query + useEffect(() => { + if (router.isReady) { + if (typeof slug === 'string') { + setQuerySlug(slug); + } + } + }, [router.isReady, slug]); + return ( <> - + Date: Tue, 15 Oct 2024 21:14:26 +0200 Subject: [PATCH 2/5] Feat/Adding security headers --- next.config.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/next.config.js b/next.config.js index e3b9624895..d290b6c412 100644 --- a/next.config.js +++ b/next.config.js @@ -163,6 +163,14 @@ const moduleExports = withBundleAnalyzer({ key: 'Access-Control-Allow-Headers', value: 'X-Requested-With, content-type, Authorization', }, + { + key: 'X-Frame-Options', + value: 'SAMEORIGIN', + }, + { + key: 'Content-Security-Policy', + value: "frame-ancestors 'self'", + }, ], }, ]; From aae420d682e62a5261065cfe70df6503bbebbfce Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 17 Oct 2024 14:58:17 +0200 Subject: [PATCH 3/5] fixing header config --- next-env.d.ts | 2 +- next.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/next-env.d.ts b/next-env.d.ts index 4f11a03dc6..a4a7b3f5cf 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -2,4 +2,4 @@ /// // NOTE: This file should not be edited -// see https://nextjs.org/docs/basic-features/typescript for more information. +// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information. diff --git a/next.config.js b/next.config.js index d290b6c412..e33a8980fb 100644 --- a/next.config.js +++ b/next.config.js @@ -148,7 +148,7 @@ const moduleExports = withBundleAnalyzer({ locales, defaultLocale, }, - headers: () => { + headers: async () => { return [ { // Adding CORS headers for /manifest.json From f73f735c443b1fa231223869257aebbd7ae404ae Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 17 Oct 2024 15:20:08 +0200 Subject: [PATCH 4/5] trying --- next.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/next.config.js b/next.config.js index e33a8980fb..115c0884dc 100644 --- a/next.config.js +++ b/next.config.js @@ -153,6 +153,7 @@ const moduleExports = withBundleAnalyzer({ { // Adding CORS headers for /manifest.json source: '/manifest.json', + locale: false, headers: [ { key: 'Access-Control-Allow-Origin', From ec3fa78f9fe0a92740bceea9c62876a98172b802 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Mon, 21 Oct 2024 14:45:42 +0200 Subject: [PATCH 5/5] moved headers to new item of the array --- next.config.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/next.config.js b/next.config.js index 115c0884dc..00bc518a80 100644 --- a/next.config.js +++ b/next.config.js @@ -150,6 +150,20 @@ const moduleExports = withBundleAnalyzer({ }, headers: async () => { return [ + { + source: '/:path*', + locale: false, + headers: [ + { + key: 'X-Frame-Options', + value: 'SAMEORIGIN', + }, + { + key: 'Content-Security-Policy', + value: "frame-ancestors 'self'", + }, + ], + }, { // Adding CORS headers for /manifest.json source: '/manifest.json', @@ -164,14 +178,6 @@ const moduleExports = withBundleAnalyzer({ key: 'Access-Control-Allow-Headers', value: 'X-Requested-With, content-type, Authorization', }, - { - key: 'X-Frame-Options', - value: 'SAMEORIGIN', - }, - { - key: 'Content-Security-Policy', - value: "frame-ancestors 'self'", - }, ], }, ];