easy-cms 0.63.0 → 0.64.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/bin.js +1 -1
- package/dist/{chunk-GX6RYPUR.js → chunk-F42YCHIP.js} +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/dist/bin.js
CHANGED
|
@@ -26,12 +26,12 @@ import {
|
|
|
26
26
|
createRestHandler
|
|
27
27
|
} from "@easy-cms/core";
|
|
28
28
|
import { createRootEndpointHandler, forwardedClientIp } from "@easy-cms/core/internal";
|
|
29
|
-
function createStandaloneHandler(cms) {
|
|
29
|
+
function createStandaloneHandler(cms, options = {}) {
|
|
30
30
|
const config = cms.config;
|
|
31
31
|
const adminPath = `/${config.admin.path.replace(/^\/+|\/+$/g, "")}`;
|
|
32
32
|
const clientIps = /* @__PURE__ */ new WeakMap();
|
|
33
33
|
const getClientIp = (request) => clientIps.get(request);
|
|
34
|
-
const api = createRestHandler(cms, { getClientIp });
|
|
34
|
+
const api = createRestHandler(cms, { getClientIp, trustProxy: options.trustProxy === true });
|
|
35
35
|
const rootEndpoints = createRootEndpointHandler(cms, { getClientIp });
|
|
36
36
|
const admin = adminHandlerFor(config, {});
|
|
37
37
|
const under = (path, base) => path === base || path.startsWith(`${base}/`);
|
|
@@ -100,7 +100,7 @@ async function startServer(options) {
|
|
|
100
100
|
const { logger, cwd } = options;
|
|
101
101
|
const trustProxy = options.trustProxy ?? false;
|
|
102
102
|
let cms = await createEasyCMS(await options.loadConfig(), { cwd, logger });
|
|
103
|
-
let handler = createStandaloneHandler(cms);
|
|
103
|
+
let handler = createStandaloneHandler(cms, { trustProxy });
|
|
104
104
|
const server = createServer(async (req, res) => {
|
|
105
105
|
try {
|
|
106
106
|
await sendWebResponse(
|
|
@@ -126,7 +126,7 @@ async function startServer(options) {
|
|
|
126
126
|
const next = await createEasyCMS(await options.loadConfig(), { cwd, logger });
|
|
127
127
|
const previous = cms;
|
|
128
128
|
cms = next;
|
|
129
|
-
handler = createStandaloneHandler(next);
|
|
129
|
+
handler = createStandaloneHandler(next, { trustProxy });
|
|
130
130
|
await previous.destroy();
|
|
131
131
|
logger.info("Config reloaded.");
|
|
132
132
|
} catch (error) {
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,9 @@ type Handler = (request: Request, clientIp?: string) => Promise<Response>;
|
|
|
11
11
|
* admin at `admin.path`, `/healthz` for load balancers, and endpoints marked `root` (such as a
|
|
12
12
|
* plugin's `/robots.txt`). `/` redirects to the admin.
|
|
13
13
|
*/
|
|
14
|
-
declare function createStandaloneHandler<C extends Config>(cms: EasyCMS<C
|
|
14
|
+
declare function createStandaloneHandler<C extends Config>(cms: EasyCMS<C>, options?: {
|
|
15
|
+
trustProxy?: boolean;
|
|
16
|
+
}): Handler;
|
|
15
17
|
interface StartOptions extends StandaloneOptions {
|
|
16
18
|
readonly port: number;
|
|
17
19
|
readonly host?: string;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-cms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"description": "Command line tool for Easy CMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"node": ">=22.12"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@easy-cms/core": "^0.
|
|
25
|
-
"@easy-cms/admin": "^0.
|
|
24
|
+
"@easy-cms/core": "^0.64.0",
|
|
25
|
+
"@easy-cms/admin": "^0.64.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@easy-cms/db-sqlite": "^0.
|
|
28
|
+
"@easy-cms/db-sqlite": "^0.64.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|