diff --git a/helper/version.js b/helper/version.js new file mode 100644 index 0000000..6727151 --- /dev/null +++ b/helper/version.js @@ -0,0 +1,31 @@ +const { + WebSocketObserver +} = require('../../model/WebSocketModel'); +const response = require('../../helper/Response'); +const permssion = require('../../helper/Permission'); +const os = require("os"); + +//前端显示版本 +//每次更新之后,修改此处,表明修改 +//这样, 用户截图时, 可以知道具体的版本 +const oversion = "Beta_8.3.0.0"; //前端 +const tversion = "Beta_8.3.0.0"; //后端 + +//首页 +// WebSocketObserver().listener('index/update', (data) => { +// if (!permssion.isMaster(data.WsSession)) return; +// response.wsSend(data.ws, 'index/update', { +// system: os.type() + " " + os.arch(), +// root: process.cwd(), +// oneversion: oversion, +// twoversion: tversion +// }) +// }); + + +module.exports = { + system: os.type() + " " + os.arch(), + root: process.cwd(), + oneversion: oversion, + twoversion: tversion +} \ No newline at end of file diff --git a/route/websocket/center.js b/route/websocket/center.js index 4ce27ba..88b995b 100644 --- a/route/websocket/center.js +++ b/route/websocket/center.js @@ -10,6 +10,8 @@ const permssion = require('../../helper/Permission'); const userModel = require('../../model/UserModel'); const os = require("os"); +const mversion = require('../../helper/version'); + const MB_SIZE = 1024 * 1024; let serverM = serverModel.ServerManager(); let userM = userModel.userCenter(); @@ -88,8 +90,10 @@ setInterval(function () { banip: banipc, //封的ip passwordError: counter.get('passwordError'), //密码错误次数 csrfCounter: counter.get('csrfCounter'), //可能存在的CSRF攻击次数 - notPermssionCounter: counter.get('notPermssionCounter') //API的无权访问 - + notPermssionCounter: counter.get('notPermssionCounter'), //API的无权访问 + root: mversion.root, + oneversion: mversion.oneversion, + twoversion: mversion.twoversion } let useMemBai = ((os.freemem() / 1024) / (os.totalmem() / 1024) * 100).toFixed(0); diff --git a/route/websocket/index.js b/route/websocket/index.js deleted file mode 100644 index 442c822..0000000 --- a/route/websocket/index.js +++ /dev/null @@ -1,23 +0,0 @@ -const { - WebSocketObserver -} = require('../../model/WebSocketModel'); -const response = require('../../helper/Response'); -const permssion = require('../../helper/Permission'); -const os = require("os"); - -//前端显示版本 -//每次更新之后,修改此处,表明修改 -//这样, 用户截图时, 可以知道具体的版本 -const oversion = "Release_8.2.8.1"; //前端 -const tversion = "Release_8.2.8.1"; //后端 - -//首页 -WebSocketObserver().listener('index/update', (data) => { - if (!permssion.isMaster(data.WsSession)) return; - response.wsSend(data.ws, 'index/update', { - system: os.type() + " " + os.arch(), - root: process.cwd(), - oneversion: oversion, - twoversion: tversion - }) -}); \ No newline at end of file