Merge
This commit is contained in:
parent
73d3cf85ce
commit
e7483569e7
|
@ -41,12 +41,15 @@ function getActiveConnectionList(authUsersOnly) {
|
||||||
authenticated : ac.user.isAuthenticated(),
|
authenticated : ac.user.isAuthenticated(),
|
||||||
userId : ac.user.userId,
|
userId : ac.user.userId,
|
||||||
action : _.get(ac, 'currentMenuModule.menuConfig.desc', 'Unknown'),
|
action : _.get(ac, 'currentMenuModule.menuConfig.desc', 'Unknown'),
|
||||||
|
serverName : ac.session.serverName,
|
||||||
|
isSecure : ac.session.isSecure,
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// There may be a connection, but not a logged in user as of yet
|
// There may be a connection, but not a logged in user as of yet
|
||||||
//
|
//
|
||||||
if(ac.user.isAuthenticated()) {
|
if(ac.user.isAuthenticated()) {
|
||||||
|
entry.text = ac.user.username;
|
||||||
entry.userName = ac.user.username;
|
entry.userName = ac.user.username;
|
||||||
entry.realName = ac.user.properties[UserProps.RealName];
|
entry.realName = ac.user.properties[UserProps.RealName];
|
||||||
entry.location = ac.user.properties[UserProps.Location];
|
entry.location = ac.user.properties[UserProps.Location];
|
||||||
|
|
|
@ -109,6 +109,10 @@ class StatLog {
|
||||||
|
|
||||||
getSystemStat(statName) { return this.systemStats[statName]; }
|
getSystemStat(statName) { return this.systemStats[statName]; }
|
||||||
|
|
||||||
|
getFriendlySystemStat(statName, defaultValue) {
|
||||||
|
return (this.getSystemStat(statName) || defaultValue).toLocaleString();
|
||||||
|
}
|
||||||
|
|
||||||
getSystemStatNum(statName) {
|
getSystemStatNum(statName) {
|
||||||
return parseInt(this.getSystemStat(statName)) || 0;
|
return parseInt(this.getSystemStat(statName)) || 0;
|
||||||
}
|
}
|
||||||
|
|
67
core/wfc.js
67
core/wfc.js
|
@ -1,6 +1,13 @@
|
||||||
// ENiGMA½
|
// ENiGMA½
|
||||||
const { MenuModule } = require('./menu_module');
|
const { MenuModule } = require('./menu_module');
|
||||||
|
|
||||||
|
const { getActiveConnectionList } = require('./client_connections');
|
||||||
|
const StatLog = require('./stat_log');
|
||||||
|
const SysProps = require('./system_property');
|
||||||
|
const {
|
||||||
|
formatByteSize, formatByteSizeAbbr,
|
||||||
|
} = require('./string_util');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
@ -17,8 +24,8 @@ const FormIds = {
|
||||||
|
|
||||||
const MciViewIds = {
|
const MciViewIds = {
|
||||||
main : {
|
main : {
|
||||||
nodeStatus : 0,
|
nodeStatus : 1,
|
||||||
quickLogView : 1,
|
quickLogView : 2,
|
||||||
|
|
||||||
customRangeStart : 10,
|
customRangeStart : 10,
|
||||||
}
|
}
|
||||||
|
@ -35,7 +42,7 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
||||||
|
|
||||||
this.config.acs = this.config.acs || DefaultACS;
|
this.config.acs = this.config.acs || DefaultACS;
|
||||||
if (!this.config.acs.includes('SC')) {
|
if (!this.config.acs.includes('SC')) {
|
||||||
this.config.acs = 'SC' + this.config.acs; // secure connection at the very, very least
|
this.config.acs = 'SC' + this.config.acs; // secure connection at the very least
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +63,9 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
||||||
// return this.validateMCIByViewIds('main', requiredCodes, callback);
|
// return this.validateMCIByViewIds('main', requiredCodes, callback);
|
||||||
return callback(null);
|
return callback(null);
|
||||||
},
|
},
|
||||||
|
(callback) => {
|
||||||
|
return this._refreshNodeStatus(callback);
|
||||||
|
}
|
||||||
],
|
],
|
||||||
err => {
|
err => {
|
||||||
return cb(err);
|
return cb(err);
|
||||||
|
@ -63,5 +73,56 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_refreshStats(cb) {
|
||||||
|
const fileAreaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats);
|
||||||
|
const totalFiles = fileAreaStats.totalFiles || 0;
|
||||||
|
const totalFileBytes = fileAreaStats.totalBytes || 0;
|
||||||
|
|
||||||
|
this.stats = {
|
||||||
|
// Totals
|
||||||
|
totalCalls : StatLog.getFriendlySystemStat(SysProps.LoginCount, 0),
|
||||||
|
totalPosts : StatLog.getFriendlySystemStat(SysProps.MessageTotalCount, 0),
|
||||||
|
//totalUsers :
|
||||||
|
totalFiles : totalFiles.toLocaleString(),
|
||||||
|
totalFileBytes : formatByteSize(totalFileBytes, false),
|
||||||
|
totalFileBytesAbbr : formatByteSizeAbbr(totalFileBytes),
|
||||||
|
// :TODO: date, time - formatted as per config.dateTimeFormat and such
|
||||||
|
// :TODO: Most/All current user status should be predefined MCI
|
||||||
|
// :TODO: lastCaller
|
||||||
|
// :TODO: totalMemoryBytes, freeMemoryBytes
|
||||||
|
// :TODO: CPU info/averages/load
|
||||||
|
// :TODO: processUptime
|
||||||
|
// :TODO: 24 HOUR stats -
|
||||||
|
// calls24Hour, posts24Hour, uploadBytes24Hour, downloadBytes24Hour, ...
|
||||||
|
// :TODO: totals - most avail from MCI
|
||||||
|
};
|
||||||
|
|
||||||
|
return cb(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
_refreshNodeStatus(cb) {
|
||||||
|
const nodeStatusView = this.getView('main', MciViewIds.main.nodeStatus);
|
||||||
|
if (!nodeStatusView) {
|
||||||
|
return cb(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
const nodeStatusItems = getActiveConnectionList(false).slice(0, nodeStatusView.height).map(ac => {
|
||||||
|
// Handle pre-authenticated
|
||||||
|
if (!ac.authenticated) {
|
||||||
|
ac.text = ac.username = 'Pre Auth';
|
||||||
|
ac.action = 'Logging In';
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.assign(ac, {
|
||||||
|
timeOn : _.upperFirst(ac.timeOn.humanize()), // make friendly
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
nodeStatusView.setItems(nodeStatusItems);
|
||||||
|
nodeStatusView.redraw();
|
||||||
|
|
||||||
|
return cb(null);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,18 +10,19 @@ By default the web server is not enabled. To enable it, you will need to at a mi
|
||||||
|
|
||||||
```hjson
|
```hjson
|
||||||
contentServers: {
|
contentServers: {
|
||||||
web: {
|
web: {
|
||||||
domain: bbs.yourdomain.com
|
domain: bbs.yourdomain.com
|
||||||
|
|
||||||
http: {
|
http: {
|
||||||
enabled: true
|
enabled: true
|
||||||
port: 8080
|
port: 8080
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The following is a table of all configuration keys available under `contentServers.web`:
|
The following is a table of all configuration keys available under `contentServers.web`:
|
||||||
|
|
||||||
| Key | Required | Description |
|
| Key | Required | Description |
|
||||||
|------|----------|-------------|
|
|------|----------|-------------|
|
||||||
| `domain` | :+1: | Sets the domain, e.g. `bbs.yourdomain.com`. |
|
| `domain` | :+1: | Sets the domain, e.g. `bbs.yourdomain.com`. |
|
||||||
|
@ -52,9 +53,9 @@ Entries available under `contentServers.web.https`:
|
||||||
|
|
||||||
#### Certificates
|
#### Certificates
|
||||||
|
|
||||||
If you don't have a TLS certificate for your domain, a good source for a certificate can be [LetsEncrypt](https://letsencrypt.org/) who supplies free and trusted TLS certificates.
|
If you don't have a TLS certificate for your domain, a good source for a certificate can be [Let's Encrypt](https://letsencrypt.org/) who supplies free and trusted TLS certificates. A common strategy is to place another web server such as [Caddy](https://caddyserver.com/) in front of ENiGMA½ acting as a transparent proxy and TLS termination point.
|
||||||
|
|
||||||
Keep in mind that the SSL certificate provided by Let's Encrypt's Certbot is by default stored in a privileged location; if your ENIGMA instance is not running as root (which it should not be!), you'll need to copy the SSL certificate somewhere else in order for ENIGMA to use it.
|
:information_source: Keep in mind that the SSL certificate provided by Let's Encrypt's Certbot is by default stored in a privileged location; if your ENIGMA instance is not running as root (which it should not be!), you'll need to copy the SSL certificate somewhere else in order for ENIGMA to use it.
|
||||||
|
|
||||||
## Static Routes
|
## Static Routes
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue