依赖更新; 模块更新

v2
yutent 2023-11-01 18:46:47 +08:00
parent 566432e529
commit 98c1033392
5 changed files with 17 additions and 33 deletions

View File

@ -9,20 +9,7 @@ const ENV_DEV = 'development'
export default { export default {
db: {}, 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() spa: false, // 单路由模式, 即无论是访问路径是什么, 永远只会调用 \apps\index\index()
website: 'localhost',
domain: '', // cookie域, 默认等于website
port: 3000, port: 3000,
env: process.env.NODE_ENV === ENV_PROD ? ENV_PROD : ENV_DEV, env: process.env.NODE_ENV === ENV_PROD ? ENV_PROD : ENV_DEV,
debug: process.env.NODE_ENV === ENV_DEV, // debug模式 debug: process.env.NODE_ENV === ENV_DEV, // debug模式
@ -33,10 +20,7 @@ export default {
name: 'no-reply', name: 'no-reply',
passwd: '' passwd: ''
}, },
views: {
dir: '',
ext: '.htm'
},
cors: { cors: {
enabled: false, enabled: false,
credentials: false, credentials: false,

View File

@ -67,7 +67,7 @@ class Five {
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
get server(){ get server() {
return this.#server return this.#server
} }

View File

@ -8,15 +8,15 @@ import { parse } from 'node:url'
export function createCors() { export function createCors() {
return function (req, res, next) { return function (req, res, next) {
var opts = this.get('cors') let opts = this.get('cors')
if (opts.enabled) { if (opts.enabled) {
var origin = req.header('origin') || req.header('referer') || '' let origin = req.header('origin') || req.header('referer') || ''
var headers = req.header('access-control-request-headers') let headers = req.header('access-control-request-headers')
var { hostname, host, protocol } = parse(origin) let { hostname, host, protocol } = parse(origin)
if (opts.origin.length && hostname) { if (opts.origin.length && hostname) {
var pass = false let pass = false
for (let it of opts.origin) { for (let it of opts.origin) {
if (hostname.endsWith(it)) { if (hostname.endsWith(it)) {
pass = true pass = true

View File

@ -8,8 +8,8 @@ import { readonlyProp } from '../lib.js'
export function createRouter() { export function createRouter() {
return function (req, res, next) { return function (req, res, next) {
var debug = this.get('debug') let debug = this.get('debug')
var spa = this.get('spa') let spa = this.get('spa')
// 1. 先判断控制器是否存在 // 1. 先判断控制器是否存在
if (!this.$load(spa ? 'index' : req.controller)) { if (!this.$load(spa ? 'index' : req.controller)) {

View File

@ -6,14 +6,14 @@
"author": "yutent <yutent.io@gmail.com>", "author": "yutent <yutent.io@gmail.com>",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@gm5/session": "^1.1.1", "@gm5/session": "^2.0.0",
"@gm5/request": "^1.2.3", "@gm5/request": "^2.0.3",
"@gm5/response": "^1.3.1", "@gm5/response": "^2.0.1",
"@gm5/controller": "^1.0.0", "@gm5/controller": "^2.0.2",
"@gm5/jwt": "^1.1.0", "@gm5/jwt": "^2.0.2",
"@gm5/views": "^1.0.0", "@gm5/views": "^1.0.0",
"crypto.js": "^3.1.0", "crypto.js": "^3.1.2",
"es.shim": "^2.0.1", "es.shim": "^2.2.0",
"iofs": "^1.5.3" "iofs": "^1.5.3"
}, },
"devDependencies": {}, "devDependencies": {},
@ -25,7 +25,7 @@
"five, fivejs, node-five, five.js, nodejs, mvc, koa, express" "five, fivejs, node-five, five.js, nodejs, mvc, koa, express"
], ],
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=16.0.0"
}, },
"license": "MIT" "license": "MIT"
} }