This commit is contained in:
HugoRCD
2025-05-19 16:05:36 +02:00
parent 47ed1e0f74
commit d75093a160
4 changed files with 4 additions and 13 deletions

View File

@@ -14,8 +14,7 @@ export const getDefaultUiConfig = (colors?: string[], csp?: { nonce?: string })
}, [...(colors || []), 'neutral' as any]),
icons,
csp: csp || {
nonce: '',
scriptNonce: ''
nonce: ''
}
})
@@ -28,8 +27,7 @@ export const defaultOptions = {
transitions: true
},
csp: {
nonce: '',
scriptNonce: ''
nonce: ''
}
}

View File

@@ -39,12 +39,6 @@ export interface ModuleOptions {
* @defaultValue ``
*/
nonce?: string
/**
* Enable nonce for inline scripts.
* @defaultValue ``
*/
scriptNonce?: string
}
/**

View File

@@ -24,7 +24,7 @@ export default defineNuxtPlugin(() => {
const nuxtApp = useNuxtApp()
const nonce = computed(() => appConfig.ui?.csp?.nonce)
const scriptNonce = computed(() => appConfig.ui?.csp?.scriptNonce)
const root = computed(() => {
const { neutral, ...colors } = appConfig.ui.colors
@@ -65,7 +65,7 @@ export default defineNuxtPlugin(() => {
headData.script = [{
innerHTML: 'document.head.removeChild(document.querySelector(\'[data-nuxt-ui-colors]\'))',
...(scriptNonce.value ? { nonce: scriptNonce.value } : {})
...(nonce.value ? { nonce: nonce.value } : {})
}]
}

View File

@@ -167,7 +167,6 @@ type AppConfigUI = {
tv?: typeof defaultConfig
csp?: {
nonce?: string
scriptNonce?: string
}
} & TVConfig<typeof ui>