sysStat for +op username vs old config value
This commit is contained in:
parent
8d9a686629
commit
b12d9aad04
|
@ -3,6 +3,7 @@
|
|||
|
||||
// ENiGMA½
|
||||
const Config = require('./config.js').config;
|
||||
const StatLog = require('./stat_log.js');
|
||||
|
||||
// deps
|
||||
const _ = require('lodash');
|
||||
|
@ -13,6 +14,7 @@ exports.getAssetWithShorthand = getAssetWithShorthand;
|
|||
exports.getArtAsset = getArtAsset;
|
||||
exports.getModuleAsset = getModuleAsset;
|
||||
exports.resolveConfigAsset = resolveConfigAsset;
|
||||
exports.resolveSystemStatAsset = resolveSystemStatAsset;
|
||||
exports.getViewPropertyAsset = getViewPropertyAsset;
|
||||
|
||||
const ALL_ASSETS = [
|
||||
|
@ -24,6 +26,7 @@ const ALL_ASSETS = [
|
|||
'systemModule',
|
||||
'prompt',
|
||||
'config',
|
||||
'sysStat',
|
||||
];
|
||||
|
||||
const ASSET_RE = new RegExp('\\@(' + ALL_ASSETS.join('|') + ')\\:([\\w\\d\\.]*)(?:\\/([\\w\\d\\_]+))*');
|
||||
|
@ -104,6 +107,17 @@ function resolveConfigAsset(spec) {
|
|||
}
|
||||
}
|
||||
|
||||
function resolveSystemStatAsset(spec) {
|
||||
const asset = parseAsset(spec);
|
||||
if(!asset) {
|
||||
return spec;
|
||||
}
|
||||
|
||||
assert('sysStat' === asset.type);
|
||||
|
||||
return StatLog.getSystemStat(asset.asset) || spec;
|
||||
}
|
||||
|
||||
function getViewPropertyAsset(src) {
|
||||
if(!_.isString(src) || '@' !== src.charAt(0)) {
|
||||
return null;
|
||||
|
|
|
@ -181,6 +181,10 @@ function ViewController(options) {
|
|||
propValue = asset.resolveConfigAsset(conf[propName]);
|
||||
break;
|
||||
|
||||
case 'sysStat' :
|
||||
propValue = asset.resolveSystemStatAsset(conf[propName]);
|
||||
break;
|
||||
|
||||
// :TODO: handle @art (e.g. text : @art ...)
|
||||
|
||||
case 'method' :
|
||||
|
|
|
@ -405,7 +405,7 @@
|
|||
ET2: {
|
||||
argName: to
|
||||
focus: true
|
||||
text: @config:general.sysOp.username
|
||||
text: @sysStat:sysop_username
|
||||
// :TODO: readOnly: true
|
||||
}
|
||||
ET3: {
|
||||
|
@ -927,7 +927,7 @@
|
|||
ET2: {
|
||||
argName: to
|
||||
focus: true
|
||||
text: @config:general.sysOp.username
|
||||
text: @sysStat:sysop_username
|
||||
// :TODO: readOnly: true
|
||||
}
|
||||
ET3: {
|
||||
|
|
Loading…
Reference in New Issue