diff --git a/config/index.js b/config/index.js index e71db10..6d61215 100644 --- a/config/index.js +++ b/config/index.js @@ -9,20 +9,7 @@ const ENV_DEV = 'development' export default { db: {}, - session: { - ttl: 3600 * 24 * 7, - domain: '', // NODESSID域, 默认等于domain - level: 0, // 校验级别, 0: 不校验客户端, 2: ua, 4: ip, 6: ua + ip - db: { - host: '127.0.0.1', - port: 6379, - db: 0 - } - }, - spa: false, // 单路由模式, 即无论是访问路径是什么, 永远只会调用 \apps\index\index() - website: 'localhost', - domain: '', // cookie域, 默认等于website port: 3000, env: process.env.NODE_ENV === ENV_PROD ? ENV_PROD : ENV_DEV, debug: process.env.NODE_ENV === ENV_DEV, // debug模式 @@ -33,10 +20,7 @@ export default { name: 'no-reply', passwd: '' }, - views: { - dir: '', - ext: '.htm' - }, + cors: { enabled: false, credentials: false, diff --git a/index.js b/index.js index bae1f43..488e621 100644 --- a/index.js +++ b/index.js @@ -67,7 +67,7 @@ class Five { /*------------------------------------------------------------------------*/ - get server(){ + get server() { return this.#server } diff --git a/middleware/cors.js b/middleware/cors.js index 35d0bd9..bda2f90 100644 --- a/middleware/cors.js +++ b/middleware/cors.js @@ -8,15 +8,15 @@ import { parse } from 'node:url' export function createCors() { return function (req, res, next) { - var opts = this.get('cors') + let opts = this.get('cors') if (opts.enabled) { - var origin = req.header('origin') || req.header('referer') || '' - var headers = req.header('access-control-request-headers') - var { hostname, host, protocol } = parse(origin) + let origin = req.header('origin') || req.header('referer') || '' + let headers = req.header('access-control-request-headers') + let { hostname, host, protocol } = parse(origin) if (opts.origin.length && hostname) { - var pass = false + let pass = false for (let it of opts.origin) { if (hostname.endsWith(it)) { pass = true diff --git a/middleware/router.js b/middleware/router.js index 287fc42..37868f5 100644 --- a/middleware/router.js +++ b/middleware/router.js @@ -8,8 +8,8 @@ import { readonlyProp } from '../lib.js' export function createRouter() { return function (req, res, next) { - var debug = this.get('debug') - var spa = this.get('spa') + let debug = this.get('debug') + let spa = this.get('spa') // 1. 先判断控制器是否存在 if (!this.$load(spa ? 'index' : req.controller)) { diff --git a/package.json b/package.json index ca9aae3..3b48145 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,14 @@ "author": "yutent ", "main": "index.js", "dependencies": { - "@gm5/session": "^1.1.1", - "@gm5/request": "^1.2.3", - "@gm5/response": "^1.3.1", - "@gm5/controller": "^1.0.0", - "@gm5/jwt": "^1.1.0", + "@gm5/session": "^2.0.0", + "@gm5/request": "^2.0.3", + "@gm5/response": "^2.0.1", + "@gm5/controller": "^2.0.2", + "@gm5/jwt": "^2.0.2", "@gm5/views": "^1.0.0", - "crypto.js": "^3.1.0", - "es.shim": "^2.0.1", + "crypto.js": "^3.1.2", + "es.shim": "^2.2.0", "iofs": "^1.5.3" }, "devDependencies": {}, @@ -25,7 +25,7 @@ "five, fivejs, node-five, five.js, nodejs, mvc, koa, express" ], "engines": { - "node": ">=10.0.0" + "node": ">=16.0.0" }, "license": "MIT" }