@lvce-editor/main-process 6.10.0 → 6.11.0

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.
@@ -4248,6 +4248,18 @@ const {
4248
4248
  argv
4249
4249
  } = process;
4250
4250
 
4251
+ const accessControlAllowOrigin = 'access-control-allow-origin';
4252
+ const getCorsResponseHeaders = (responseHeaders = {}) => {
4253
+ const hasAccessControlAllowOrigin = Object.keys(responseHeaders).some(key => key.toLowerCase() === accessControlAllowOrigin);
4254
+ if (hasAccessControlAllowOrigin) {
4255
+ return responseHeaders;
4256
+ }
4257
+ return {
4258
+ ...responseHeaders,
4259
+ 'Access-Control-Allow-Origin': ['*']
4260
+ };
4261
+ };
4262
+
4251
4263
  const ClipBoardRead = 'clipboard-read';
4252
4264
  const ClipBoardSanitizedWrite = 'clipboard-sanitized-write';
4253
4265
  const FullScreen = 'fullscreen';
@@ -4386,10 +4398,7 @@ const isSessionCacheEnabled = isProduction;
4386
4398
 
4387
4399
  const onHeadersReceivedCallback = (details, callback) => {
4388
4400
  callback({
4389
- responseHeaders: {
4390
- 'Access-Control-Allow-Origin': ['*'],
4391
- ...details.responseHeaders
4392
- }
4401
+ responseHeaders: getCorsResponseHeaders(details.responseHeaders)
4393
4402
  });
4394
4403
  };
4395
4404
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.10.0",
3
+ "version": "6.11.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"