添加 - Session 定时器

This commit is contained in:
suwings 2018-04-21 10:55:23 +08:00
parent fe61d7f45f
commit 113f1244b2
3 changed files with 12 additions and 4 deletions

2
app.js
View File

@ -131,7 +131,7 @@ app.use(session({
secret: UUID.v4(),
name: 'MCSM_SESSION_ID',
cookie: {
maxAge: 1000 * 60 * 60 * 4
maxAge: MCSERVER.localProperty.session_max_age * 1000 * 60
},
resave: false,
saveUninitialized: false

View File

@ -24,7 +24,7 @@ module.exports.isLogined = (sessionID) => {
}
//登录验证时间删除
const MAX_AGE = 1000 * 10;
const MAX_AGE = MCSERVER.localProperty.session_max_age * 1000 * 60;
setInterval(() => {
let time = Date.now();
let oldtime = null;
@ -36,4 +36,4 @@ setInterval(() => {
}
}
}
}, 1000 * 60);
}, 1000 * 50); //50秒检索一遍

View File

@ -81,4 +81,12 @@ MCSERVER.localProperty.data_center_times = 2000;
//是否准许本控制面板使用自定义参数 | 默认准许使用
//注意! 此功能既可以让你的控制面板尝试更多姿势 (包括 WebShell)
//注意! 也会让其他别有用心的管理员 (只有管理员有权使用),入侵你的宿主机
MCSERVER.localProperty.customize_commande = true;
MCSERVER.localProperty.customize_commande = true;
//Session Cookie 与 Login 管理器最大时间
//意味着,第一次登录之后,这段时间内是可以不需要输入密码就可以登录的。
//超过这段时间后,访问需要重新登录
//单位 分钟 | 默认 240 分钟
MCSERVER.localProperty.session_max_age = 240