@easy-cms/nuxt 0.66.1 → 0.67.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.
package/dist/module.js CHANGED
@@ -119,7 +119,9 @@ declare module '${SERVER}' {
119
119
  siteURL: rawConfig?.admin?.siteURL ?? "/"
120
120
  };
121
121
  const shell = renderShell(readFileSync(shellFile, "utf8"), shellOptions);
122
- nitro.virtual[ADMIN_SHELL] = `export const basePath = ${JSON.stringify(adminPath)}
122
+ nitro.virtual[ADMIN_SHELL] = `import config from ${config}
123
+ export { config }
124
+ export const basePath = ${JSON.stringify(adminPath)}
123
125
  export const html = ${JSON.stringify(shell)}
124
126
  export const headers = ${JSON.stringify(SECURITY_HEADERS)}
125
127
  export const hsts = ${JSON.stringify(STRICT_TRANSPORT_SECURITY)}
@@ -1,10 +1,5 @@
1
1
  import * as h3 from 'h3';
2
2
 
3
- /**
4
- * Serves the admin SPA's HTML for every route under the admin path.
5
- * Assets are served by Nitro as public assets; a request that reaches this
6
- * handler for /assets/* means the file does not exist.
7
- */
8
3
  declare const _default: h3.EventHandler<h3.EventHandlerRequest, string>;
9
4
 
10
5
  export { _default as default };
@@ -1,10 +1,19 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { renderShell } from "@easy-cms/admin";
3
3
  import { defineEventHandler, getRequestURL, setResponseHeaders, setResponseStatus } from "h3";
4
- import { basePath, headers, hsts, html, reload } from "#easy-cms-admin-shell";
4
+ import { basePath, config, headers, hsts, html, reload } from "#easy-cms-admin-shell";
5
+ const origins = [config.upload?.storage, config.upload?.privateStorage].flatMap((storage) => storage?.uploadOrigins ?? []).filter((origin) => /^https?:\/\/[^\s;,'"]+$/.test(origin));
6
+ const csp = headers["content-security-policy"];
7
+ const allHeaders = origins.length && csp ? {
8
+ ...headers,
9
+ "content-security-policy": csp.replace(
10
+ "connect-src 'self'",
11
+ `connect-src 'self' ${[...new Set(origins)].join(" ")}`
12
+ )
13
+ } : headers;
5
14
  var admin_default = defineEventHandler((event) => {
6
15
  const url = getRequestURL(event);
7
- setResponseHeaders(event, headers);
16
+ setResponseHeaders(event, allHeaders);
8
17
  if (process.env.NODE_ENV === "production")
9
18
  setResponseHeaders(event, { "strict-transport-security": hsts });
10
19
  if (event.method !== "GET" && event.method !== "HEAD") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/nuxt",
3
- "version": "0.66.1",
3
+ "version": "0.67.0",
4
4
  "description": "Nuxt module for Easy CMS",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,19 +20,19 @@
20
20
  "dependencies": {
21
21
  "@nuxt/kit": "^4.5.2",
22
22
  "h3": "^1.15.11",
23
- "@easy-cms/admin": "^0.66.1"
23
+ "@easy-cms/admin": "^0.67.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "nuxt": "^4.0.0",
27
- "@easy-cms/core": "^0.66.1"
27
+ "@easy-cms/core": "^0.67.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@nuxt/schema": "^4.5.2",
31
31
  "@nuxt/test-utils": "^4.3.2",
32
32
  "nuxt": "^4.5.2",
33
33
  "vue": "^3.5.0",
34
- "@easy-cms/core": "^0.66.1",
35
- "@easy-cms/db-sqlite": "^0.66.1"
34
+ "@easy-cms/core": "^0.67.0",
35
+ "@easy-cms/db-sqlite": "^0.67.0"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"