feat: ajouter les en-têtes de sécurité pour atteindre 100/100 sur MDN Observatory
This commit is contained in:
+8
-3
@@ -1,3 +1,4 @@
|
||||
import {headers} from 'next/headers'
|
||||
import PlausibleProvider from 'next-plausible'
|
||||
import TopLoader from '../components/top-loader'
|
||||
import Navigasyon from '../components/navigasyon'
|
||||
@@ -61,16 +62,20 @@ const jsonLd = {
|
||||
}
|
||||
|
||||
export default async function RootLayout({children}) {
|
||||
const requestHeaders = await headers()
|
||||
const nonce = requestHeaders.get('x-nonce') || undefined
|
||||
|
||||
const inner = (
|
||||
<>
|
||||
<TopLoader color='#ffeb3b' />
|
||||
<ThemeRegistry>
|
||||
<TopLoader color='#ffeb3b' nonce={nonce} />
|
||||
<ThemeRegistry nonce={nonce}>
|
||||
<Navigasyon />
|
||||
{children}
|
||||
</ThemeRegistry>
|
||||
<section>
|
||||
<script
|
||||
type='application/ld+json'
|
||||
nonce={nonce}
|
||||
dangerouslySetInnerHTML={{__html: JSON.stringify(jsonLd)}}
|
||||
/>
|
||||
</section>
|
||||
@@ -81,7 +86,7 @@ export default async function RootLayout({children}) {
|
||||
<html suppressHydrationWarning lang='fr'>
|
||||
<body>
|
||||
{plausibleUrl
|
||||
? <PlausibleProvider src={plausibleUrl}>{inner}</PlausibleProvider>
|
||||
? <PlausibleProvider src={plausibleUrl} scriptProps={{nonce}}>{inner}</PlausibleProvider>
|
||||
: inner}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user