This repository was archived by the owner on Dec 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +10781
-19
lines changed Expand file tree Collapse file tree 6 files changed +10781
-19
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,16 @@ module.exports = {
10
10
resourceHints : false
11
11
} ,
12
12
modules : [
13
- { handler : require ( '../' ) }
13
+ {
14
+ handler : require ( '../' ) ,
15
+ options : {
16
+ hsts : {
17
+ maxAge : 15552000 ,
18
+ includeSubDomains : true ,
19
+ preload : true
20
+ }
21
+ }
22
+ }
14
23
] ,
15
- buildModules : [
16
- '@nuxtjs/dotenv' ,
17
- ]
24
+ buildModules : [ '@nuxtjs/dotenv' ]
18
25
}
Original file line number Diff line number Diff line change 5
5
</template >
6
6
7
7
<script >
8
- export default {
9
-
10
- }
8
+ export default {}
11
9
</script >
Original file line number Diff line number Diff line change 1
- const { resolve } = require ( 'path ' )
1
+ const hsts = require ( 'hsts ' )
2
2
3
- module . exports = async function ( moduleOptions ) {
3
+ module . exports = function ( moduleOptions ) {
4
+ const defaults = {
5
+ hsts : null
6
+ }
4
7
const options = {
8
+ ...defaults ,
5
9
...this . options [ 'nuxt-csp' ] ,
6
10
...moduleOptions
7
11
}
8
12
9
- this . addPlugin ( {
10
- src : resolve ( __dirname , 'plugin.js' ) ,
11
- fileName : 'nuxt-csp.js' ,
12
- options
13
- } )
13
+ const configureHsts = options => {
14
+ return hsts ( options )
15
+ }
16
+
17
+ if ( options . hsts ) {
18
+ this . addServerMiddleware ( configureHsts ( options . hsts ) )
19
+ }
14
20
}
15
21
16
22
module . exports . meta = require ( '../package.json' )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
"name" : " @dansmaculotte/nuxt-csp" ,
3
3
"version" : " 0.0.0" ,
4
4
"description" : " Module for Nuxt.js to configure CSP headers" ,
5
+ "keywords" : [
6
+ " nuxt" ,
7
+ " nuxt-module" ,
8
+ " csp" ,
9
+ " content-security-policy"
10
+ ],
5
11
"repository" : " dansmaculotte/nuxt-csp" ,
6
12
"license" : " MIT" ,
7
13
"contributors" : [
19
25
"release" : " yarn test && standard-version && git push --follow-tags && npm publish" ,
20
26
"test" : " yarn lint && jest"
21
27
},
22
- "dependencies" : {},
28
+ "dependencies" : {
29
+ "hsts" : " ^2.2.0"
30
+ },
23
31
"devDependencies" : {
24
32
"@babel/core" : " latest" ,
25
33
"@babel/preset-env" : " latest" ,
You can’t perform that action at this time.
0 commit comments