diff --git a/package.json b/package.json index 8a52246..11117d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/code-center", - "version": "0.0.11", + "version": "0.0.12", "description": "code center", "type": "module", "main": "index.js", diff --git a/src/modules/fm-manager/utils.ts b/src/modules/fm-manager/utils.ts index 1d13628..89055cf 100644 --- a/src/modules/fm-manager/utils.ts +++ b/src/modules/fm-manager/utils.ts @@ -27,6 +27,9 @@ export const getDNS = (req: http.IncomingMessage) => { }; export const isLocalhost = (hostName: string) => { + if(!hostName) { + return false; + } return hostName.includes('localhost') || hostName.includes('192.168'); }; diff --git a/src/routes-simple/page-proxy.ts b/src/routes-simple/page-proxy.ts index 3196a53..91e9c39 100644 --- a/src/routes-simple/page-proxy.ts +++ b/src/routes-simple/page-proxy.ts @@ -145,7 +145,7 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR let user, app; let domainApp = false; - const isDev = isLocalhost(dns.hostName); + const isDev = isLocalhost(dns?.hostName); if (isDev) { console.debug('开发环境访问:', req.url, 'Host:', dns.hostName); } else { diff --git a/src/routes/light-code/list.ts b/src/routes/light-code/list.ts index 747fbf8..d72cc49 100644 --- a/src/routes/light-code/list.ts +++ b/src/routes/light-code/list.ts @@ -34,6 +34,7 @@ app type: schema.kvContainer.type, tags: schema.kvContainer.tags, data: schema.kvContainer.data, + code: schema.kvContainer.code, uid: schema.kvContainer.uid, createdAt: schema.kvContainer.createdAt, updatedAt: schema.kvContainer.updatedAt, @@ -42,7 +43,7 @@ app .from(schema.kvContainer) .where(and(...conditions)) .orderBy(desc(schema.kvContainer.updatedAt)); - ctx.body = list; + ctx.body = { list }; return ctx; }) .addTo(app); diff --git a/src/test/add-demo-light-code.ts b/src/test/add-demo-light-code.ts index 3f3bd71..ef7c68e 100644 --- a/src/test/add-demo-light-code.ts +++ b/src/test/add-demo-light-code.ts @@ -11,7 +11,7 @@ const app = new App(); app.route({ path: 'hello', - description: 'LightCode 示例路由', + description: 'LightCode 示例路由 2323232323', metadata: { tags: ['light-code', 'example'], },