@rimelight/ui 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimelight/ui",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "private": false,
5
5
  "description": "Rimelight Entertainment UI Library.",
6
6
  "homepage": "https://rimelight.com/docs",
@@ -39,26 +39,28 @@ export const security = defineMiddleware(async (context, next) => {
39
39
  }
40
40
 
41
41
  if (typeof HTMLRewriter !== "undefined") {
42
- return new HTMLRewriter()
43
- .on("script[src]", {
44
- element(el: any) {
45
- const src = el.getAttribute("src")
46
- if (src && manifest[src]) {
47
- el.setAttribute("integrity", manifest[src])
48
- el.setAttribute("crossorigin", "anonymous")
42
+ return addSecurityHeaders(
43
+ new HTMLRewriter()
44
+ .on("script[src]", {
45
+ element(el: any) {
46
+ const src = el.getAttribute("src")
47
+ if (src && manifest[src]) {
48
+ el.setAttribute("integrity", manifest[src])
49
+ el.setAttribute("crossorigin", "anonymous")
50
+ }
49
51
  }
50
- }
51
- })
52
- .on('link[rel="stylesheet"][href]', {
53
- element(el: any) {
54
- const href = el.getAttribute("href")
55
- if (href && manifest[href]) {
56
- el.setAttribute("integrity", manifest[href])
57
- el.setAttribute("crossorigin", "anonymous")
52
+ })
53
+ .on('link[rel="stylesheet"][href]', {
54
+ element(el: any) {
55
+ const href = el.getAttribute("href")
56
+ if (href && manifest[href]) {
57
+ el.setAttribute("integrity", manifest[href])
58
+ el.setAttribute("crossorigin", "anonymous")
59
+ }
58
60
  }
59
- }
60
- })
61
- .transform(response)
61
+ })
62
+ .transform(response)
63
+ )
62
64
  }
63
65
 
64
66
  let modifiedHtml = await response.text()