More user/system stat constants & usage
This commit is contained in:
parent
e464f95924
commit
ec97b3e8d4
|
@ -11,6 +11,7 @@ const logger = require('./logger.js');
|
||||||
const database = require('./database.js');
|
const database = require('./database.js');
|
||||||
const resolvePath = require('./misc_util.js').resolvePath;
|
const resolvePath = require('./misc_util.js').resolvePath;
|
||||||
const UserProps = require('./user_property.js');
|
const UserProps = require('./user_property.js');
|
||||||
|
const SysProps = require('./system_property.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
@ -246,13 +247,13 @@ function initialize(cb) {
|
||||||
|
|
||||||
if(err) {
|
if(err) {
|
||||||
propLoadOpts.names.concat('username').forEach(v => {
|
propLoadOpts.names.concat('username').forEach(v => {
|
||||||
StatLog.setNonPeristentSystemStat(`sysop_${v}`, 'N/A');
|
StatLog.setNonPersistentSystemStat(`sysop_${v}`, 'N/A');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
opProps.username = opUserName;
|
opProps.username = opUserName;
|
||||||
|
|
||||||
_.each(opProps, (v, k) => {
|
_.each(opProps, (v, k) => {
|
||||||
StatLog.setNonPeristentSystemStat(`sysop_${k}`, v);
|
StatLog.setNonPersistentSystemStat(`sysop_${k}`, v);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +266,7 @@ function initialize(cb) {
|
||||||
getAreaStats( (err, stats) => {
|
getAreaStats( (err, stats) => {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
const StatLog = require('./stat_log.js');
|
const StatLog = require('./stat_log.js');
|
||||||
StatLog.setNonPeristentSystemStat('file_base_area_stats', stats);
|
StatLog.setNonPersistentSystemStat(SysProps.FileBaseAreaStats, stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
return callback(null);
|
return callback(null);
|
||||||
|
|
|
@ -969,7 +969,7 @@ function getDefaultConfig() {
|
||||||
|
|
||||||
statLog : {
|
statLog : {
|
||||||
systemEvents : {
|
systemEvents : {
|
||||||
loginHistoryMax: -1 // forever
|
loginHistoryMax: 5000, // set to -1 for forever
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -189,14 +189,6 @@ const DB_INIT_TABLE = {
|
||||||
);`
|
);`
|
||||||
);
|
);
|
||||||
|
|
||||||
dbs.user.run(
|
|
||||||
`CREATE TABLE IF NOT EXISTS user_login_history (
|
|
||||||
user_id INTEGER NOT NULL,
|
|
||||||
user_name VARCHAR NOT NULL,
|
|
||||||
timestamp DATETIME NOT NULL
|
|
||||||
);`
|
|
||||||
);
|
|
||||||
|
|
||||||
return cb(null);
|
return cb(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ const Log = require('./logger.js').log;
|
||||||
const getConnectionByUserId = require('./client_connections.js').getConnectionByUserId;
|
const getConnectionByUserId = require('./client_connections.js').getConnectionByUserId;
|
||||||
const webServerPackageName = require('./servers/content/web.js').moduleInfo.packageName;
|
const webServerPackageName = require('./servers/content/web.js').moduleInfo.packageName;
|
||||||
const Events = require('./events.js');
|
const Events = require('./events.js');
|
||||||
|
const UserProps = require('./user_property.js');
|
||||||
|
const SysProps = require('./system_menu_method.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const hashids = require('hashids');
|
const hashids = require('hashids');
|
||||||
|
@ -470,10 +472,11 @@ class FileAreaWebAccess {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function updateStats(user, callback) {
|
function updateStats(user, callback) {
|
||||||
StatLog.incrementUserStat(user, 'dl_total_count', 1);
|
StatLog.incrementUserStat(user, UserProps.FileDlTotalCount, 1);
|
||||||
StatLog.incrementUserStat(user, 'dl_total_bytes', dlBytes);
|
StatLog.incrementUserStat(user, UserProps.FileDlTotalBytes, dlBytes);
|
||||||
StatLog.incrementSystemStat('dl_total_count', 1);
|
|
||||||
StatLog.incrementSystemStat('dl_total_bytes', dlBytes);
|
StatLog.incrementSystemStat(SysProps.FileDlTotalCount, 1);
|
||||||
|
StatLog.incrementSystemStat(SysProps.FileDlTotalBytes, dlBytes);
|
||||||
|
|
||||||
return callback(null, user);
|
return callback(null, user);
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,6 +15,7 @@ const stringFormat = require('./string_format.js');
|
||||||
const wordWrapText = require('./word_wrap.js').wordWrapText;
|
const wordWrapText = require('./word_wrap.js').wordWrapText;
|
||||||
const StatLog = require('./stat_log.js');
|
const StatLog = require('./stat_log.js');
|
||||||
const UserProps = require('./user_property.js');
|
const UserProps = require('./user_property.js');
|
||||||
|
const SysProps = require('./system_property.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
@ -1012,7 +1013,7 @@ function getAreaStats(cb) {
|
||||||
function updateAreaStatsScheduledEvent(args, cb) {
|
function updateAreaStatsScheduledEvent(args, cb) {
|
||||||
getAreaStats( (err, stats) => {
|
getAreaStats( (err, stats) => {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
StatLog.setNonPeristentSystemStat('file_base_area_stats', stats);
|
StatLog.setNonPersistentSystemStat(SysProps.FileBaseAreaStats, stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cb(err);
|
return cb(err);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
const MenuModule = require('./menu_module.js').MenuModule;
|
const MenuModule = require('./menu_module.js').MenuModule;
|
||||||
const { getSortedAvailableFileAreas } = require('./file_base_area.js');
|
const { getSortedAvailableFileAreas } = require('./file_base_area.js');
|
||||||
const StatLog = require('./stat_log.js');
|
const StatLog = require('./stat_log.js');
|
||||||
|
const SysProps = require('./system_property.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
@ -52,7 +53,7 @@ exports.getModule = class FileAreaSelectModule extends MenuModule {
|
||||||
async.waterfall(
|
async.waterfall(
|
||||||
[
|
[
|
||||||
function mergeAreaStats(callback) {
|
function mergeAreaStats(callback) {
|
||||||
const areaStats = StatLog.getSystemStat('file_base_area_stats') || { areas : {} };
|
const areaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats) || { areas : {} };
|
||||||
|
|
||||||
// we could use 'sort' alone, but area/conf sorting has some special properties; user can still override
|
// we could use 'sort' alone, but area/conf sorting has some special properties; user can still override
|
||||||
const availAreas = getSortedAvailableFileAreas(self.client);
|
const availAreas = getSortedAvailableFileAreas(self.client);
|
||||||
|
|
|
@ -11,6 +11,8 @@ const StatLog = require('./stat_log.js');
|
||||||
const FileEntry = require('./file_entry.js');
|
const FileEntry = require('./file_entry.js');
|
||||||
const Log = require('./logger.js').log;
|
const Log = require('./logger.js').log;
|
||||||
const Events = require('./events.js');
|
const Events = require('./events.js');
|
||||||
|
const UserProps = require('./user_property.js');
|
||||||
|
const SysProps = require('./system_property.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
@ -479,10 +481,11 @@ exports.getModule = class TransferFileModule extends MenuModule {
|
||||||
});
|
});
|
||||||
}, () => {
|
}, () => {
|
||||||
// All stats/meta currently updated via fire & forget - if this is ever a issue, we can wait for callbacks
|
// All stats/meta currently updated via fire & forget - if this is ever a issue, we can wait for callbacks
|
||||||
StatLog.incrementUserStat(this.client.user, 'dl_total_count', downloadCount);
|
StatLog.incrementUserStat(this.client.user, UserProps.FileDlTotalCount, downloadCount);
|
||||||
StatLog.incrementUserStat(this.client.user, 'dl_total_bytes', downloadBytes);
|
StatLog.incrementUserStat(this.client.user, UserProps.FileDlTotalBytes, downloadBytes);
|
||||||
StatLog.incrementSystemStat('dl_total_count', downloadCount);
|
|
||||||
StatLog.incrementSystemStat('dl_total_bytes', downloadBytes);
|
StatLog.incrementSystemStat(SysProps.FileDlTotalCount, downloadCount);
|
||||||
|
StatLog.incrementSystemStat(SysProps.FileDlTotalBytes, downloadBytes);
|
||||||
|
|
||||||
fileIds.forEach(fileId => {
|
fileIds.forEach(fileId => {
|
||||||
FileEntry.incrementAndPersistMetaValue(fileId, 'dl_count', 1);
|
FileEntry.incrementAndPersistMetaValue(fileId, 'dl_count', 1);
|
||||||
|
@ -509,10 +512,11 @@ exports.getModule = class TransferFileModule extends MenuModule {
|
||||||
return next(null);
|
return next(null);
|
||||||
});
|
});
|
||||||
}, () => {
|
}, () => {
|
||||||
StatLog.incrementUserStat(this.client.user, 'ul_total_count', uploadCount);
|
StatLog.incrementUserStat(this.client.user, UserProps.FileUlTotalCount, uploadCount);
|
||||||
StatLog.incrementUserStat(this.client.user, 'ul_total_bytes', uploadBytes);
|
StatLog.incrementUserStat(this.client.user, UserProps.FileUlTotalBytes, uploadBytes);
|
||||||
StatLog.incrementSystemStat('ul_total_count', uploadCount);
|
|
||||||
StatLog.incrementSystemStat('ul_total_bytes', uploadBytes);
|
StatLog.incrementSystemStat(SysProps.FileUlTotalCount, uploadCount);
|
||||||
|
StatLog.incrementSystemStat(SysProps.FileUlTotalBytes, uploadBytes);
|
||||||
|
|
||||||
return cb(null);
|
return cb(null);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,7 @@ const User = require('./user.js');
|
||||||
const sysDb = require('./database.js').dbs.system;
|
const sysDb = require('./database.js').dbs.system;
|
||||||
const { Errors } = require('./enig_error.js');
|
const { Errors } = require('./enig_error.js');
|
||||||
const UserProps = require('./user_property.js');
|
const UserProps = require('./user_property.js');
|
||||||
|
const SysLogKeys = require('./system_log.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
@ -91,7 +92,7 @@ exports.getModule = class LastCallersModule extends MenuModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
StatLog.getSystemLogEntries(
|
StatLog.getSystemLogEntries(
|
||||||
'user_login_history',
|
SysLogKeys.UserLoginHistory,
|
||||||
StatLog.Order.TimestampDesc,
|
StatLog.Order.TimestampDesc,
|
||||||
200, // max items to fetch - we need more than max displayed for filtering/etc.
|
200, // max items to fetch - we need more than max displayed for filtering/etc.
|
||||||
(err, loginHistory) => {
|
(err, loginHistory) => {
|
||||||
|
|
|
@ -14,6 +14,7 @@ const FileBaseFilters = require('./file_base_filter.js');
|
||||||
const { formatByteSize } = require('./string_util.js');
|
const { formatByteSize } = require('./string_util.js');
|
||||||
const ANSI = require('./ansi_term.js');
|
const ANSI = require('./ansi_term.js');
|
||||||
const UserProps = require('./user_property.js');
|
const UserProps = require('./user_property.js');
|
||||||
|
const SysProps = require('./system_property.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const packageJson = require('../package.json');
|
const packageJson = require('../package.json');
|
||||||
|
@ -34,7 +35,7 @@ function setNextRandomRumor(cb) {
|
||||||
entry = entry[0];
|
entry = entry[0];
|
||||||
}
|
}
|
||||||
const randRumor = entry && entry.log_value ? entry.log_value : '';
|
const randRumor = entry && entry.log_value ? entry.log_value : '';
|
||||||
StatLog.setNonPeristentSystemStat('random_rumor', randRumor);
|
StatLog.setNonPersistentSystemStat(SysProps.NextRandomRumor, randRumor);
|
||||||
if(cb) {
|
if(cb) {
|
||||||
return cb(null);
|
return cb(null);
|
||||||
}
|
}
|
||||||
|
@ -67,12 +68,12 @@ const PREDEFINED_MCI_GENERATORS = {
|
||||||
VN : function version() { return packageJson.version; },
|
VN : function version() { return packageJson.version; },
|
||||||
|
|
||||||
// +op info
|
// +op info
|
||||||
SN : function opUserName() { return StatLog.getSystemStat('sysop_username'); },
|
SN : function opUserName() { return StatLog.getSystemStat(SysProps.SysOpUsername); },
|
||||||
SR : function opRealName() { return StatLog.getSystemStat('sysop_real_name'); },
|
SR : function opRealName() { return StatLog.getSystemStat(SysProps.SysOpRealName); },
|
||||||
SL : function opLocation() { return StatLog.getSystemStat('sysop_location'); },
|
SL : function opLocation() { return StatLog.getSystemStat(SysProps.SysOpLocation); },
|
||||||
SA : function opAffils() { return StatLog.getSystemStat('sysop_affiliation'); },
|
SA : function opAffils() { return StatLog.getSystemStat(SysProps.SysOpAffiliations); },
|
||||||
SS : function opSex() { return StatLog.getSystemStat('sysop_sex'); },
|
SS : function opSex() { return StatLog.getSystemStat(SysProps.SysOpSex); },
|
||||||
SE : function opEmail() { return StatLog.getSystemStat('sysop_email_address'); },
|
SE : function opEmail() { return StatLog.getSystemStat(SysProps.SysOpEmailAddress); },
|
||||||
// :TODO: op age, web, ?????
|
// :TODO: op age, web, ?????
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -189,7 +190,7 @@ const PREDEFINED_MCI_GENERATORS = {
|
||||||
|
|
||||||
AN : function activeNodes() { return clientConnections.getActiveConnections().length.toString(); },
|
AN : function activeNodes() { return clientConnections.getActiveConnections().length.toString(); },
|
||||||
|
|
||||||
TC : function totalCalls() { return StatLog.getSystemStat('login_count').toLocaleString(); },
|
TC : function totalCalls() { return StatLog.getSystemStat(SysProps.LoginCount).toLocaleString(); },
|
||||||
|
|
||||||
RR : function randomRumor() {
|
RR : function randomRumor() {
|
||||||
// start the process of picking another random one
|
// start the process of picking another random one
|
||||||
|
@ -203,22 +204,22 @@ const PREDEFINED_MCI_GENERATORS = {
|
||||||
//
|
//
|
||||||
// :TODO: DD - Today's # of downloads (iNiQUiTY)
|
// :TODO: DD - Today's # of downloads (iNiQUiTY)
|
||||||
//
|
//
|
||||||
SD : function systemNumDownloads() { return sysStatAsString('dl_total_count', 0); },
|
SD : function systemNumDownloads() { return sysStatAsString(SysProps.FileDlTotalCount, 0); },
|
||||||
SO : function systemByteDownload() {
|
SO : function systemByteDownload() {
|
||||||
const byteSize = StatLog.getSystemStatNum('dl_total_bytes');
|
const byteSize = StatLog.getSystemStatNum(SysProps.FileDlTotalBytes);
|
||||||
return formatByteSize(byteSize, true); // true=withAbbr
|
return formatByteSize(byteSize, true); // true=withAbbr
|
||||||
},
|
},
|
||||||
SU : function systemNumUploads() { return sysStatAsString('ul_total_count', 0); },
|
SU : function systemNumUploads() { return sysStatAsString(SysProps.FileUlTotalCount, 0); },
|
||||||
SP : function systemByteUpload() {
|
SP : function systemByteUpload() {
|
||||||
const byteSize = StatLog.getSystemStatNum('ul_total_bytes');
|
const byteSize = StatLog.getSystemStatNum(SysProps.FileUlTotalBytes);
|
||||||
return formatByteSize(byteSize, true); // true=withAbbr
|
return formatByteSize(byteSize, true); // true=withAbbr
|
||||||
},
|
},
|
||||||
TF : function totalFilesOnSystem() {
|
TF : function totalFilesOnSystem() {
|
||||||
const areaStats = StatLog.getSystemStat('file_base_area_stats');
|
const areaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats);
|
||||||
return _.get(areaStats, 'totalFiles', 0).toLocaleString();
|
return _.get(areaStats, 'totalFiles', 0).toLocaleString();
|
||||||
},
|
},
|
||||||
TB : function totalBytesOnSystem() {
|
TB : function totalBytesOnSystem() {
|
||||||
const areaStats = StatLog.getSystemStat('file_base_area_stats');
|
const areaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats);
|
||||||
const totalBytes = parseInt(_.get(areaStats, 'totalBytes', 0));
|
const totalBytes = parseInt(_.get(areaStats, 'totalBytes', 0));
|
||||||
return formatByteSize(totalBytes, true); // true=withAbbr
|
return formatByteSize(totalBytes, true); // true=withAbbr
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,6 +8,7 @@ const theme = require('./theme.js');
|
||||||
const resetScreen = require('./ansi_term.js').resetScreen;
|
const resetScreen = require('./ansi_term.js').resetScreen;
|
||||||
const StatLog = require('./stat_log.js');
|
const StatLog = require('./stat_log.js');
|
||||||
const renderStringLength = require('./string_util.js').renderStringLength;
|
const renderStringLength = require('./string_util.js').renderStringLength;
|
||||||
|
const SystemLogKeys = require('./system_log.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
@ -20,8 +21,6 @@ exports.moduleInfo = {
|
||||||
packageName : 'codes.l33t.enigma.rumorz',
|
packageName : 'codes.l33t.enigma.rumorz',
|
||||||
};
|
};
|
||||||
|
|
||||||
const STATLOG_KEY_RUMORZ = 'system_rumorz';
|
|
||||||
|
|
||||||
const FormIds = {
|
const FormIds = {
|
||||||
View : 0,
|
View : 0,
|
||||||
Add : 1,
|
Add : 1,
|
||||||
|
@ -52,10 +51,16 @@ exports.getModule = class RumorzModule extends MenuModule {
|
||||||
if(_.isString(formData.value.rumor) && renderStringLength(formData.value.rumor) > 0) {
|
if(_.isString(formData.value.rumor) && renderStringLength(formData.value.rumor) > 0) {
|
||||||
const rumor = formData.value.rumor.trim(); // remove any trailing ws
|
const rumor = formData.value.rumor.trim(); // remove any trailing ws
|
||||||
|
|
||||||
StatLog.appendSystemLogEntry(STATLOG_KEY_RUMORZ, rumor, StatLog.KeepDays.Forever, StatLog.KeepType.Forever, () => {
|
StatLog.appendSystemLogEntry(
|
||||||
this.clearAddForm();
|
SystemLogKeys.UserAddedRumorz,
|
||||||
return this.displayViewScreen(true, cb); // true=cls
|
rumor,
|
||||||
});
|
StatLog.KeepDays.Forever,
|
||||||
|
StatLog.KeepType.Forever,
|
||||||
|
() => {
|
||||||
|
this.clearAddForm();
|
||||||
|
return this.displayViewScreen(true, cb); // true=cls
|
||||||
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// empty message - treat as if cancel was hit
|
// empty message - treat as if cancel was hit
|
||||||
return this.displayViewScreen(true, cb); // true=cls
|
return this.displayViewScreen(true, cb); // true=cls
|
||||||
|
@ -149,7 +154,7 @@ exports.getModule = class RumorzModule extends MenuModule {
|
||||||
function fetchEntries(callback) {
|
function fetchEntries(callback) {
|
||||||
const entriesView = self.viewControllers.view.getView(MciCodeIds.ViewForm.Entries);
|
const entriesView = self.viewControllers.view.getView(MciCodeIds.ViewForm.Entries);
|
||||||
|
|
||||||
StatLog.getSystemLogEntries(STATLOG_KEY_RUMORZ, StatLog.Order.Timestamp, (err, entries) => {
|
StatLog.getSystemLogEntries(SystemLogKeys.UserAddedRumorz, StatLog.Order.Timestamp, (err, entries) => {
|
||||||
return callback(err, entriesView, entries);
|
return callback(err, entriesView, entries);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -158,7 +163,7 @@ exports.getModule = class RumorzModule extends MenuModule {
|
||||||
return {
|
return {
|
||||||
text : e.log_value, // standard
|
text : e.log_value, // standard
|
||||||
rumor : e.log_value,
|
rumor : e.log_value,
|
||||||
}
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
entriesView.redraw();
|
entriesView.redraw();
|
||||||
|
|
|
@ -70,8 +70,7 @@ class StatLog {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: fix spelling :)
|
setNonPersistentSystemStat(statName, statValue) {
|
||||||
setNonPeristentSystemStat(statName, statValue) {
|
|
||||||
this.systemStats[statName] = statValue;
|
this.systemStats[statName] = statValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* jslint node: true */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
//
|
||||||
|
// Common SYSTEM/global log keys
|
||||||
|
//
|
||||||
|
module.exports = {
|
||||||
|
UserAddedRumorz : 'system_rumorz',
|
||||||
|
UserLoginHistory : 'user_login_history',
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* jslint node: true */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
//
|
||||||
|
// Common SYSTEM/global properties/stats used throughout the system.
|
||||||
|
//
|
||||||
|
// This IS NOT a full list. Custom modules & the like can create
|
||||||
|
// their own!
|
||||||
|
//
|
||||||
|
module.exports = {
|
||||||
|
LoginCount : 'login_count',
|
||||||
|
|
||||||
|
FileBaseAreaStats : 'file_base_area_stats', // object - see file_base_area.js::getAreaStats
|
||||||
|
FileUlTotalCount : 'ul_total_count',
|
||||||
|
FileUlTotalBytes : 'ul_total_bytes',
|
||||||
|
|
||||||
|
SysOpUsername : 'sysop_username',
|
||||||
|
SysOpRealName : 'sysop_real_name',
|
||||||
|
SysOpLocation : 'sysop_location',
|
||||||
|
SysOpAffiliations : 'sysop_affiliation',
|
||||||
|
SysOpSex : 'sysop_sex',
|
||||||
|
SysOpEmailAddress : 'sysop_email_address',
|
||||||
|
|
||||||
|
NextRandomRumor : 'random_rumor',
|
||||||
|
};
|
|
@ -13,6 +13,8 @@ const {
|
||||||
ErrorReasons
|
ErrorReasons
|
||||||
} = require('./enig_error.js');
|
} = require('./enig_error.js');
|
||||||
const UserProps = require('./user_property.js');
|
const UserProps = require('./user_property.js');
|
||||||
|
const SysProps = require('./system_property.js');
|
||||||
|
const SystemLogKeys = require('./system_log.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
@ -86,7 +88,7 @@ function userLogin(client, username, password, cb) {
|
||||||
return callback(null);
|
return callback(null);
|
||||||
},
|
},
|
||||||
function updateSystemLoginCount(callback) {
|
function updateSystemLoginCount(callback) {
|
||||||
return StatLog.incrementSystemStat('login_count', 1, callback); // :TODO: create system_property.js
|
return StatLog.incrementSystemStat(SysProps.LoginCount, 1, callback);
|
||||||
},
|
},
|
||||||
function recordLastLogin(callback) {
|
function recordLastLogin(callback) {
|
||||||
return StatLog.setUserStat(user, UserProps.LastLoginTs, StatLog.now, callback);
|
return StatLog.setUserStat(user, UserProps.LastLoginTs, StatLog.now, callback);
|
||||||
|
@ -102,7 +104,7 @@ function userLogin(client, username, password, cb) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return StatLog.appendSystemLogEntry(
|
return StatLog.appendSystemLogEntry(
|
||||||
'user_login_history',
|
SystemLogKeys.UserLoginHistory,
|
||||||
historyItem,
|
historyItem,
|
||||||
loginHistoryMax,
|
loginHistoryMax,
|
||||||
StatLog.KeepType.Max,
|
StatLog.KeepType.Max,
|
||||||
|
|
Loading…
Reference in New Issue