Add CSP nonce for Tamagui styles
This commit is contained in:
@@ -4,6 +4,7 @@ import { RouterProvider } from 'react-router-dom';
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { TamaguiProvider, Theme } from '@tamagui/core';
|
||||
import { setNonce } from '@tamagui/web';
|
||||
import '@tamagui/core/reset.css';
|
||||
import tamaguiConfig from '../../../tamagui.config';
|
||||
import { AuthProvider } from './auth/context';
|
||||
@@ -23,6 +24,14 @@ const DevTenantSwitcher = React.lazy(() => import('./DevTenantSwitcher'));
|
||||
|
||||
const enableDevSwitcher = import.meta.env.DEV || import.meta.env.VITE_ENABLE_TENANT_SWITCHER === 'true';
|
||||
|
||||
const styleNonce = document
|
||||
.querySelector('meta[name="csp-style-nonce"]')
|
||||
?.getAttribute('content');
|
||||
|
||||
if (styleNonce) {
|
||||
setNonce(styleNonce);
|
||||
}
|
||||
|
||||
initializeTheme();
|
||||
initSentry('admin');
|
||||
const rootEl = document.getElementById('root')!;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<title>{{ __('admin.shell.tenant_admin_title') }}</title>
|
||||
<link rel="icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<meta name="csp-style-nonce" content="{{ $cspStyleNonce }}">
|
||||
<meta name="theme-color" content="#f43f5e">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
|
||||
Reference in New Issue
Block a user