Skip to content

Commit

Permalink
[Fix] emotion nonce (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
sijav authored Mar 14, 2024
1 parent 8fa1baa commit 7793925
Show file tree
Hide file tree
Showing 62 changed files with 1,041 additions and 366 deletions.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="csp-nonce" content="{{ styleNonce }}" />
<meta property="csp-nonce" content="{{ nonce }}" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
Expand All @@ -16,7 +16,7 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" />
<style>
<style nonce="{{ nonce }}">
body {
margin: 0;
}
Expand Down Expand Up @@ -124,7 +124,7 @@
</svg>
</div>
</div>
<script>
<script nonce="{{ nonce }}">
particlesJS('particles', {
particles: {
number: {
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AppRouter } from './AppRouter'
import { Providers } from './shared/providers'

export const App = () => {
export const App = ({ nonce }: { nonce?: string }) => {
return (
<Providers>
<Providers nonce={nonce}>
<AppRouter />
</Providers>
)
Expand Down
12 changes: 11 additions & 1 deletion src/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LicenseInfo } from '@mui/x-license-pro'
import { HTMLAttributes, MetaHTMLAttributes } from 'react'
import ReactDOM from 'react-dom/client'
import { App } from './App'
import reportWebVitals from './reportWebVitals'
Expand All @@ -7,9 +8,18 @@ import { env } from './shared/constants'
if (env.muiLicenseKey) {
LicenseInfo.setLicenseKey(env.muiLicenseKey)
}
let nonceEl = window?.document?.head?.querySelector?.('meta[property="csp-nonce"]') as unknown as { remove: () => void } | undefined
let nonce = (nonceEl as MetaHTMLAttributes<HTMLAttributes<HTMLElement>>)?.content

if (nonceEl) {
nonceEl.remove()
nonceEl = undefined
}

const root = ReactDOM.createRoot(window.document.getElementById('root') as HTMLElement)
root.render(<App />)
root.render(<App nonce={nonce} />)

nonce = undefined

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.info))
Expand Down
15 changes: 2 additions & 13 deletions src/assets/icons/aws-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 4 additions & 23 deletions src/assets/icons/gcp-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Crown from './crown.svg?react'
import DiscordIcon from './discord-icon.svg?react'
import DiscordWithTextLogo from './discord-with-text-logo.svg?react'
import FixBetaLogo from './fix-beta-logo.svg?react'
import FixLogoUrl from './fix-logo.svg'
import FixLogo from './fix-logo.svg?react'
import GcpLogo from './gcp-logo.svg?react'
import GithubSEBIcon from './github-seb-icon.svg?react'
Expand All @@ -20,6 +21,7 @@ export {
DiscordWithTextLogo,
FixBetaLogo,
FixLogo,
FixLogoUrl,
GcpLogo,
GithubSEBIcon,
GoogleSEBIcon,
Expand Down
2 changes: 1 addition & 1 deletion src/assets/icons/pagerduty-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/assets/raw-icons/icon_account.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion src/assets/raw-icons/icon_acl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7793925

Please sign in to comment.