mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-09 22:24:35 +02:00
* System stats
* Last callers rewritten using format and VM * Some minor MCI stuff
This commit is contained in:
parent
d02d9e4a7c
commit
1c1f4394ca
15 changed files with 126 additions and 39 deletions
|
@ -4,6 +4,8 @@
|
|||
var Config = require('./config.js').config;
|
||||
var Log = require('./logger.js').log;
|
||||
var getMessageAreaByName = require('./message_area.js').getMessageAreaByName;
|
||||
var clientConnections = require('./client_connections.js');
|
||||
var sysProp = require('./system_property.js');
|
||||
|
||||
var packageJson = require('../package.json');
|
||||
var assert = require('assert');
|
||||
|
@ -21,7 +23,12 @@ function getPredefinedMCIValue(client, code) {
|
|||
|
||||
try {
|
||||
return {
|
||||
//
|
||||
// Board
|
||||
//
|
||||
BN : function boardName() { return Config.general.boardName; },
|
||||
|
||||
// ENiGMA
|
||||
VL : function versionLabel() { return 'ENiGMA½ v' + packageJson.version; },
|
||||
VN : function version() { return packageJson.version; },
|
||||
|
||||
|
@ -29,6 +36,9 @@ function getPredefinedMCIValue(client, code) {
|
|||
// :TODO: SysOp real name
|
||||
|
||||
|
||||
//
|
||||
// Current user / session
|
||||
//
|
||||
UN : function userName() { return client.user.username; },
|
||||
UI : function userId() { return client.user.userId.toString(); },
|
||||
UG : function groups() { return _.values(client.user.groups).join(', '); },
|
||||
|
@ -42,6 +52,8 @@ function getPredefinedMCIValue(client, code) {
|
|||
UF : function affils() { return client.user.properties.affiliation; },
|
||||
UT : function themeId() { return client.user.properties.theme_id; },
|
||||
UC : function loginCount() { return client.user.properties.login_count.toString(); },
|
||||
ND : function connectedNode() { return client.node.toString(); },
|
||||
IP : function clientIpAddress() { return client.address().address; },
|
||||
|
||||
MS : function accountCreated() { return moment(client.user.properties.account_created).format(client.currentTheme.helpers.getDateFormat()); },
|
||||
CS : function currentStatus() { return client.currentStatus; },
|
||||
|
@ -58,13 +70,16 @@ function getPredefinedMCIValue(client, code) {
|
|||
SH : function termHeight() { return client.term.termHeight.toString(); },
|
||||
SW : function termWidth() { return client.term.termWidth.toString(); },
|
||||
|
||||
ND : function connectedNode() { return client.node.toString(); },
|
||||
|
||||
//
|
||||
// Date/Time
|
||||
//
|
||||
// :TODO: change to CD for 'Current Date'
|
||||
DT : function date() { return moment().format(client.currentTheme.helpers.getDateFormat()); },
|
||||
CT : function time() { return moment().format(client.currentTheme.helpers.getTimeFormat()) ;},
|
||||
|
||||
|
||||
//
|
||||
// OS/System Info
|
||||
//
|
||||
OS : function operatingSystem() {
|
||||
return {
|
||||
linux : 'Linux',
|
||||
|
@ -78,7 +93,12 @@ function getPredefinedMCIValue(client, code) {
|
|||
OA : function systemArchitecture() { return os.arch(); },
|
||||
SC : function systemCpuModel() { return os.cpus()[0].model; },
|
||||
|
||||
IP : function clientIpAddress() { return client.address().address; },
|
||||
// :TODO: cpu load average (over N seconds): http://stackoverflow.com/questions/9565912/convert-the-output-of-os-cpus-in-node-js-to-percentage
|
||||
|
||||
AN : function activeNodes() { return clientConnections.getActiveConnections().toString(); },
|
||||
|
||||
TC : function totalCalls() { return sysProp.getSystemProperty('login_count').toString(); },
|
||||
|
||||
}[code]();
|
||||
|
||||
} catch(e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue