autosnippet 2.19.6 → 2.19.7

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.
@@ -123,8 +123,21 @@ export class HttpServer {
123
123
  this.app.use(this.performanceMonitor.middleware());
124
124
  }
125
125
 
126
- // 安全头
127
- this.app.use(helmet());
126
+ // 安全头(放宽 CSP 以兼容 Vite 构建的 Dashboard SPA:script/style 需要内联和 crossorigin)
127
+ this.app.use(helmet({
128
+ contentSecurityPolicy: {
129
+ directives: {
130
+ defaultSrc: ["'self'"],
131
+ scriptSrc: ["'self'", "'unsafe-inline'"],
132
+ styleSrc: ["'self'", "'unsafe-inline'", "https:"],
133
+ imgSrc: ["'self'", "data:", "blob:"],
134
+ connectSrc: ["'self'", "ws:", "wss:"],
135
+ fontSrc: ["'self'", "https:", "data:"],
136
+ objectSrc: ["'none'"],
137
+ frameSrc: ["'none'"],
138
+ },
139
+ },
140
+ }));
128
141
 
129
142
  // 请求日志
130
143
  this.app.use(requestLogger(this.logger));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosnippet",
3
- "version": "2.19.6",
3
+ "version": "2.19.7",
4
4
  "description": "AutoSnippet - 连接开发者、AI 与项目知识库的工具",
5
5
  "type": "module",
6
6
  "main": "lib/bootstrap.js",