@lvce-editor/shared-process 0.34.4 → 0.34.6

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": "@lvce-editor/shared-process",
3
- "version": "0.34.4",
3
+ "version": "0.34.6",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "^1.3.0",
21
- "@lvce-editor/extension-host-helper-process": "0.34.4",
21
+ "@lvce-editor/extension-host-helper-process": "0.34.6",
22
22
  "@lvce-editor/ipc": "^11.0.1",
23
- "@lvce-editor/json-rpc": "^3.0.0",
23
+ "@lvce-editor/json-rpc": "^4.0.0",
24
24
  "@lvce-editor/jsonc-parser": "^1.4.0",
25
25
  "@lvce-editor/pretty-error": "^1.6.0",
26
26
  "@lvce-editor/verror": "^1.4.0",
@@ -1,8 +1,19 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { isAbsolute, join } from 'node:path';
3
3
  import * as FileSystem from '../FileSystem/FileSystem.js';
4
+ import * as GetContentSecurityPolicy from '../GetContentSecurityPolicy/GetContentSecurityPolicy.js';
4
5
  import * as JsonFile from '../JsonFile/JsonFile.js';
5
6
  import * as Path from '../Path/Path.js';
7
+ const staticContentSecurityPolicy = GetContentSecurityPolicy.getContentSecurityPolicy([
8
+ `default-src 'none'`,
9
+ `font-src 'self'`,
10
+ `img-src 'self' https: data: blob:`, // TODO maybe disallow https and data images
11
+ `manifest-src 'self'`,
12
+ `media-src 'self'`,
13
+ `script-src 'self'`,
14
+ `style-src 'self'`,
15
+ `frame-src 'self' blob:`,
16
+ ]);
6
17
  const readExtensionManifest = async (path) => {
7
18
  const json = await JsonFile.readJson(path);
8
19
  return { ...json, path };
@@ -137,20 +148,22 @@ const applyOverrides = async ({ root, commitHash, pathPrefix, serverStaticPath }
137
148
  const iconThemeId = iconThemeDirent.slice('builtin.'.length);
138
149
  await FileSystem.copy(Path.join(serverStaticPath, commitHash, 'extensions', iconThemeDirent, 'icon-theme.json'), Path.join(root, 'dist', commitHash, 'icon-themes', `${iconThemeId}.json`));
139
150
  }
140
- await replace(Path.join(root, 'dist', 'index.html'), `/${commitHash}`, `${pathPrefix}/${commitHash}`);
151
+ const indexHtmlPath = Path.join(root, 'dist', 'index.html');
152
+ await replace(indexHtmlPath, `/${commitHash}`, `${pathPrefix}/${commitHash}`);
153
+ await replace(indexHtmlPath, '</title>', `</title>
154
+ <meta http-equiv="Content-Security-Policy" content="${staticContentSecurityPolicy}">`);
141
155
  if (pathPrefix) {
142
- await replace(Path.join(root, 'dist', 'index.html'), '</title>', `</title>
156
+ await replace(indexHtmlPath, '</title>', `</title>
143
157
  <link rel="shortcut icon" type="image/x-icon" href="${pathPrefix}/favicon.ico">`);
144
158
  }
145
159
  else {
146
- await replace(Path.join(root, 'dist', 'index.html'), '</title>', `</title>
160
+ await replace(indexHtmlPath, '</title>', `</title>
147
161
  <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">`);
148
162
  }
149
163
  if (pathPrefix) {
150
164
  await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `/${commitHash}`, `${pathPrefix}/${commitHash}`);
151
165
  await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"start_url": "/"`, `"start_url": "${pathPrefix}"`);
152
166
  await replace(Path.join(root, 'dist', commitHash, 'css', 'App.css'), `/${commitHash}`, `${pathPrefix}/${commitHash}`);
153
- await replace(Path.join(root, 'dist', commitHash, 'css', 'parts', 'Symbol.css'), `/${commitHash}`, `${pathPrefix}/${commitHash}`);
154
167
  }
155
168
  };
156
169
  const addExtensionSeo = async ({ root, name, description, commitHash }) => {
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.34.4';
45
- export const commit = '39ddfdf';
46
- export const date = '2024-09-15T08:04:55.000Z';
44
+ export const version = '0.34.6';
45
+ export const commit = 'a8931f9';
46
+ export const date = '2024-09-15T14:22:54.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };