chanjs 2.6.17 → 2.6.19

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.
@@ -25,7 +25,16 @@ export const setStatic = async function (app, statics) {
25
25
  if (statics.length > 0) {
26
26
  statics.forEach((item) => {
27
27
  const { prefix, dir, maxAge } = item;
28
- app.use(prefix, express.static(dir, { maxAge: maxAge || 0 }));
28
+ app.use(prefix, express.static(dir, { setHeaders: (res, filePath) => {
29
+ // wasm MIME
30
+ if (filePath.endsWith('.wasm')) {
31
+ res.setHeader('Content-Type', 'application/wasm');
32
+ res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
33
+ }
34
+ // Wasm必需隔离头
35
+ res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
36
+ res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
37
+ }, maxAge: maxAge || 0 }));
29
38
  });
30
39
  }
31
40
  };
package/middleware/waf.js CHANGED
@@ -68,10 +68,10 @@ function createWafMiddleware(wafConfig) {
68
68
 
69
69
  const clientIp = getIp(req);
70
70
  const requestPath = req.path || "";
71
-
71
+ //
72
72
  res.setHeader("X-Content-Type-Options", "nosniff");
73
73
  res.setHeader("X-XSS-Protection", "1; mode=block");
74
- res.setHeader("X-Frame-Options", "DENY");
74
+ res.setHeader("X-Frame-Options", "SAMEORIGIN");
75
75
 
76
76
  if (!isWhitelistedPath(requestPath)) {
77
77
  const isBlockedHeader = req.headers[WAF_BLOCKED_HEADER];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "chanjs",
4
- "version": "2.6.17",
4
+ "version": "2.6.19",
5
5
  "description": "chanjs基于express5 纯js研发的轻量级mvc框架。",
6
6
  "main": "index.js",
7
7
  "module": "index.js",