@easy-cms/nuxt 0.47.4 → 0.49.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
@@ -10,7 +10,7 @@ import {
10
10
  DEFAULT_API_PATH,
11
11
  importConfig,
12
12
  resolveAdminModule
13
- } from "@easy-cms/core";
13
+ } from "@easy-cms/core/internal";
14
14
  import {
15
15
  addImports,
16
16
  addServerHandler,
@@ -111,7 +111,7 @@ declare module '${SERVER}' {
111
111
  locale: rawConfig?.admin?.locale ?? "en",
112
112
  brand: rawConfig?.admin?.brand ?? {},
113
113
  // The site is this Nuxt app.
114
- siteUrl: rawConfig?.admin?.siteUrl ?? "/"
114
+ siteURL: rawConfig?.admin?.siteURL ?? "/"
115
115
  };
116
116
  const shell = renderShell(readFileSync(shellFile, "utf8"), shellOptions);
117
117
  nitro.virtual[ADMIN_SHELL] = `export const basePath = ${JSON.stringify(adminPath)}
@@ -3,7 +3,7 @@ import { Config } from '@easy-cms/core';
3
3
 
4
4
  interface HandlerOptions {
5
5
  readonly basePath: string;
6
- /** Trust `X-Forwarded-For` for the client IP (only behind a proxy you control). */
6
+ /** The client IP from `X-Forwarded-For`, its last entry (only behind a proxy you control). */
7
7
  readonly trustProxy: boolean;
8
8
  }
9
9
  /** Mounts the Easy CMS REST API as a Nitro event handler. */
@@ -1,5 +1,12 @@
1
1
  import { createApiHandler } from "@easy-cms/core";
2
- import { defineEventHandler, getRequestIP, sendWebResponse, toWebRequest } from "h3";
2
+ import { forwardedClientIp, platformClientIp } from "@easy-cms/core/internal";
3
+ import {
4
+ defineEventHandler,
5
+ getRequestHeader,
6
+ getRequestIP,
7
+ sendWebResponse,
8
+ toWebRequest
9
+ } from "h3";
3
10
  function createHandler(config, options) {
4
11
  const clientIps = /* @__PURE__ */ new WeakMap();
5
12
  const api = createApiHandler(config, {
@@ -8,7 +15,10 @@ function createHandler(config, options) {
8
15
  });
9
16
  return defineEventHandler(async (event) => {
10
17
  const request = toWebRequest(event);
11
- clientIps.set(request, getRequestIP(event, { xForwardedFor: options.trustProxy }));
18
+ clientIps.set(
19
+ request,
20
+ options.trustProxy ? forwardedClientIp(getRequestHeader(event, "x-forwarded-for")) : platformClientIp(request.headers) ?? getRequestIP(event)
21
+ );
12
22
  return sendWebResponse(event, await api(request));
13
23
  });
14
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/nuxt",
3
- "version": "0.47.4",
3
+ "version": "0.49.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.47.4"
23
+ "@easy-cms/admin": "^0.49.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "nuxt": "^4.0.0",
27
- "@easy-cms/core": "^0.47.4"
27
+ "@easy-cms/core": "^0.49.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.47.4",
35
- "@easy-cms/db-sqlite": "^0.47.4"
34
+ "@easy-cms/core": "^0.49.0",
35
+ "@easy-cms/db-sqlite": "^0.49.0"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"