diff --git a/bun.lockb b/bun.lockb
index 5536a146c..07e157fee 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/package.json b/package.json
index a4412336d..edcb361ce 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,8 @@
"jsontoxml": "^1.0.1",
"katex": "^0.16.9",
"memoizee": "^0.4.15",
- "next": "^14.0.4",
+ "next": "^14.1.0",
+ "next-themes": "^0.2.1",
"object-hash": "^3.0.0",
"p-map": "^7.0.0",
"parse-cache-control": "^1.0.1",
diff --git a/src/app/[spaceId]/ClientContexts.tsx b/src/app/[spaceId]/ClientContexts.tsx
index f2b1ce7da..11870d518 100644
--- a/src/app/[spaceId]/ClientContexts.tsx
+++ b/src/app/[spaceId]/ClientContexts.tsx
@@ -1,5 +1,7 @@
'use client';
+import { CustomizationThemeMode } from '@gitbook/api';
+import { ThemeProvider } from 'next-themes';
import React from 'react';
import { RecoilRoot } from 'recoil';
@@ -7,14 +9,18 @@ import { TranslateContext } from '@/intl/client';
import { TranslationLanguage } from '@/intl/translations';
export function ClientContexts(props: {
+ nonce: string;
language: TranslationLanguage;
+ forcedTheme: CustomizationThemeMode | undefined;
children: React.ReactNode;
}) {
- const { children, language } = props;
+ const { nonce, children, forcedTheme, language } = props;
return (
-
- {children}
-
+
+
+ {children}
+
+
);
}
diff --git a/src/app/[spaceId]/layout.tsx b/src/app/[spaceId]/layout.tsx
index ea30ac13c..ab3f59f59 100644
--- a/src/app/[spaceId]/layout.tsx
+++ b/src/app/[spaceId]/layout.tsx
@@ -6,6 +6,7 @@ import { fonts, ibmPlexMono } from '@/fonts';
import { getSpaceLanguage } from '@/intl/server';
import { getSpaceContent } from '@/lib/api';
import { hexToRgb, shadesOfColor } from '@/lib/colors';
+import { getContentSecurityPolicyNonce } from '@/lib/csp';
import { tcls } from '@/lib/tailwind';
import { ClientContexts } from './ClientContexts';
@@ -27,9 +28,11 @@ export default async function SpaceRootLayout(props: {
});
const headerTheme = generateHeaderTheme(customization);
const language = getSpaceLanguage(customization);
+ const nonce = getContentSecurityPolicyNonce();
return (
- {children}
+
+ {children}
+