Skip to content

Commit

Permalink
speculation-rules test
Browse files Browse the repository at this point in the history
  • Loading branch information
dbushell committed Dec 6, 2024
1 parent a5ff02e commit d7c34ae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
13 changes: 9 additions & 4 deletions components/my-layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@
{
"prefetch": [
{
"source": "document",
"where": {
"and": [
{ "href_matches": "/*", "relative_to": "document" }
]
"href_matches": "/*"
},
"eagerness": "immediate"
}
],
"prerender": [
{
"where": {
"href_matches": "/*"
},
"eagerness": "moderate"
}
Expand Down
13 changes: 9 additions & 4 deletions public/speculation-rules.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"prefetch": [
{
"source": "document",
"where": {
"and": [
{ "href_matches": "/*", "relative_to": "document" }
]
"href_matches": "/*"
},
"eagerness": "immediate"
}
],
"prerender": [
{
"where": {
"href_matches": "/*"
},
"eagerness": "moderate"
}
Expand Down
2 changes: 1 addition & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const middleware: HyperHandle = ({ request, platform }) => {
// TODO - generate? - Hash for Logo inline styles
["x-style-src", `'sha256-kXLrG8qzlz0MMhgMvdF9YD6tca5CYXeC1iFSTHDsO8w='`],
// Inline speculation rules
["x-script-src", `'sha256-+0XEkXfEhTK/fdyJwJ40zJo+/+nwkO10LI+U1CnyEXA='`],
["x-script-src", `'sha256-wJ17tFso+XVW2pKPhXkRCUyukGeWjM3DmjQUc7cNNMw='`],
// "this.rel=`stylesheet`"
["x-script-src", `'unsafe-hashes'`],
["x-script-src", `'sha256-BGXQRYq/G9+8wEtSYSbQRnDRz8/8apfi/W/CUBMh9w0='`],
Expand Down

0 comments on commit d7c34ae

Please sign in to comment.