Merge branch 'master' of github.com:NuSkooler/enigma-bbs into 216-waiting-for-caller

This commit is contained in:
Bryan Ashby 2020-11-09 19:38:16 -07:00
commit 73d3cf85ce
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
8 changed files with 58 additions and 21 deletions

View File

@ -17,7 +17,7 @@
passwordChar: * passwordChar: *
dateTimeFormat: { dateTimeFormat: {
short: MMM Do h:mm a short: MMM Do hh:mm a
} }
} }
@ -91,7 +91,7 @@
fullLoginSequenceOnelinerz: { fullLoginSequenceOnelinerz: {
config: { config: {
dateTimeFormat: ddd h:mma dateTimeFormat: ddd hh:mma
} }
0: { 0: {
mci: { mci: {
@ -118,7 +118,7 @@
mainMenuUserAchievementsEarned: { mainMenuUserAchievementsEarned: {
config: { config: {
dateTimeFormat: MMM Do h:mma dateTimeFormat: MMM Do hh:mma
achievementsInfoFormat10: "|00|07\"|11{title}|07\"" achievementsInfoFormat10: "|00|07\"|11{title}|07\""
achievementsInfoFormat11: "|00|03{text}" achievementsInfoFormat11: "|00|03{text}"
} }
@ -170,7 +170,7 @@
mainMenuLastCallers: { mainMenuLastCallers: {
config: { config: {
dateTimeFormat: MMM Do h:mma dateTimeFormat: MMM Do hh:mma
} }
mci: { mci: {
VM1: { VM1: {
@ -183,7 +183,7 @@
mainMenuUserList: { mainMenuUserList: {
config: { config: {
dateTimeFormat: MMM Do h:mma dateTimeFormat: MMM Do hh:mma
} }
mci: { mci: {
VM1: { VM1: {
@ -222,7 +222,7 @@
mainMenuOnelinerz: { mainMenuOnelinerz: {
config: { config: {
dateTimeFormat: ddd h:mma dateTimeFormat: ddd hh:mma
} }
0: { 0: {
mci: { mci: {
@ -609,7 +609,7 @@
fullLoginSequenceLastCallers: { fullLoginSequenceLastCallers: {
config: { config: {
dateTimeFormat: MMM Do h:mma dateTimeFormat: MMM Do hh:mma
} }
mci: { mci: {
VM1: { VM1: {

View File

@ -319,7 +319,7 @@ module.exports = class ArchiveUtil {
} }
let output = ''; let output = '';
proc.on('data', data => { proc.onData(data => {
// :TODO: hack for: execvp(3) failed.: No such file or directory // :TODO: hack for: execvp(3) failed.: No such file or directory
output += data; output += data;

View File

@ -3,12 +3,14 @@
const stringFormat = require('./string_format.js'); const stringFormat = require('./string_format.js');
const { Errors } = require('./enig_error.js'); const { Errors } = require('./enig_error.js');
const Events = require('./events');
// deps // deps
const pty = require('node-pty'); const pty = require('node-pty');
const decode = require('iconv-lite').decode; const decode = require('iconv-lite').decode;
const createServer = require('net').createServer; const createServer = require('net').createServer;
const paths = require('path'); const paths = require('path');
const _ = require('lodash');
module.exports = class Door { module.exports = class Door {
constructor(client) { constructor(client) {
@ -87,6 +89,19 @@ module.exports = class Door {
return cb(e); return cb(e);
} }
//
// PID is launched. Make sure it's killed off if the user disconnects.
//
Events.once(Events.getSystemEvents().ClientDisconnected, evt => {
if (this.doorPty && this.client.session.uniqueId === _.get(evt, 'client.session.uniqueId')) {
this.client.log.info(
{ pid : this.doorPty.pid },
'User has disconnected; Killing door process.'
);
this.doorPty.kill();
}
});
this.client.log.debug( this.client.log.debug(
{ processId : this.doorPty.pid }, 'External door process spawned' { processId : this.doorPty.pid }, 'External door process spawned'
); );
@ -96,7 +111,7 @@ module.exports = class Door {
this.client.term.output.pipe(this.doorPty); this.client.term.output.pipe(this.doorPty);
this.doorPty.on('data', this.doorDataHandler.bind(this)); this.doorPty.onData(this.doorDataHandler.bind(this));
this.doorPty.once('close', () => { this.doorPty.once('close', () => {
return this.restoreIo(this.doorPty); return this.restoreIo(this.doorPty);

View File

@ -426,7 +426,7 @@ exports.getModule = class TransferFileModule extends MenuModule {
} }
}); });
externalProc.on('data', data => { externalProc.onData(data => {
updateActivity(); updateActivity();
// needed for things like sz/rz // needed for things like sz/rz

View File

@ -56,7 +56,7 @@ function stringToNullPaddedBuffer(s, bufLen) {
// //
// Convert a FTN style DateTime string to a Date object // Convert a FTN style DateTime string to a Date object
// //
// :TODO: Name the next couple methods better - for FTN *packets* // :TODO: Name the next couple methods better - for FTN *packets* e.g. parsePacketDateTime()
function getDateFromFtnDateTime(dateTime) { function getDateFromFtnDateTime(dateTime) {
// //
// Examples seen in the wild (Working): // Examples seen in the wild (Working):
@ -66,7 +66,6 @@ function getDateFromFtnDateTime(dateTime) {
// //
// :TODO: Use moment.js here // :TODO: Use moment.js here
return moment(Date.parse(dateTime)); // Date.parse() allows funky formats return moment(Date.parse(dateTime)); // Date.parse() allows funky formats
// return (new Date(Date.parse(dateTime))).toISOString();
} }
function getDateTimeString(m) { function getDateTimeString(m) {

View File

@ -41,6 +41,8 @@ The `customization` block in is itself broken up into major parts:
| `prompts` | Similar to `menus`, this section themes `prompts`. | | `prompts` | Similar to `menus`, this section themes `prompts`. |
#### Defaults #### Defaults
Override system defaults.
| Item | Description | | Item | Description |
|-------------|---------------------------------------------------| |-------------|---------------------------------------------------|
| `passwordChar` | Character to display in password fields. Defaults to `*` | | `passwordChar` | Character to display in password fields. Defaults to `*` |

View File

@ -2,5 +2,12 @@
layout: page layout: page
title: Network Setup title: Network Setup
--- ---
:zap: This page is to describe general information on how to set your router to forward traffic to ENiGMA. It ## Hosting an ENIGMA instance from your Home Network
needs fleshing out, please submit a PR if you'd like to help!
If you are hosting your ENGIMA instance from inside your local network, you'll need to open your chosen ports on your router, so people outside your local area network can access the BBS.
Each router has a different way of doing this, but this [comprehensive resource](https://portforward.com/) explains how to port forward on most common brand routers.
Secondly, it is likely that your public facing server IP is a [Dynamic Address](https://support.opendns.com/hc/en-us/articles/227987827-What-is-a-Dynamic-IP-Address-) automatically provisoned to you by your ISP. You can contact your ISP and request a static IP, but in some areas this isn't available to consumers, only businesses.
Using a tool like [Duck DNS](https://www.duckdns.org/) will give you a free subdomain that automatically adjusts its records whenever your IP Address changes.

View File

@ -5,18 +5,19 @@ title: Web Server
ENiGMA½ comes with a built in *content server* for supporting both HTTP and HTTPS. Currently the [File Bases](../modding/file-base-web-download-manager.md) registers routes for file downloads, password reset email links are handled via the server, and static files can also be served for your BBS. Other features will likely come in the future or you can easily write your own! ENiGMA½ comes with a built in *content server* for supporting both HTTP and HTTPS. Currently the [File Bases](../modding/file-base-web-download-manager.md) registers routes for file downloads, password reset email links are handled via the server, and static files can also be served for your BBS. Other features will likely come in the future or you can easily write your own!
# Configuration # Configuration
By default the web server is not enabled. To enable it, you will need to at a minimum configure two keys in the `contentServers.web` section of `config.hjson`: By default the web server is not enabled. To enable it, you will need to at a minimum configure two keys in the `contentServers.web` section of `config.hjson`:
```hjson ```hjson
contentServers: { contentServers: {
web: { web: {
domain: bbs.yourdomain.com domain: bbs.yourdomain.com
http: { http: {
enabled: true enabled: true
port: 8080 port: 8080
} }
} }
} }
``` ```
@ -28,6 +29,7 @@ The following is a table of all configuration keys available under `contentServe
| `overrideUrlPrefix` | :-1: | Instructs the system to be explicit when handing out URLs. Useful if your server is behind a transparent proxy. | | `overrideUrlPrefix` | :-1: | Instructs the system to be explicit when handing out URLs. Useful if your server is behind a transparent proxy. |
### HTTP Configuration ### HTTP Configuration
Entries available under `contentServers.web.http`: Entries available under `contentServers.web.http`:
| Key | Required | Description | | Key | Required | Description |
@ -37,6 +39,7 @@ Entries available under `contentServers.web.http`:
| `address` | :-1: | Sets an explicit bind address. | | `address` | :-1: | Sets an explicit bind address. |
### HTTPS Configuration ### HTTPS Configuration
Entries available under `contentServers.web.https`: Entries available under `contentServers.web.https`:
| Key | Required | Description | | Key | Required | Description |
@ -48,10 +51,21 @@ Entries available under `contentServers.web.https`:
| `keyPem` | :+1: | Overrides the default certificate key path of `/config/https_cert_key.pem`. Key must be in PEM format. See **Certificates** below. | | `keyPem` | :+1: | Overrides the default certificate key path of `/config/https_cert_key.pem`. Key must be in PEM format. See **Certificates** below. |
#### 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 [LetsEncrypt](https://letsencrypt.org/) who supplies free and trusted TLS certificates.
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
Static files live relative to the `contentServers.web.staticRoot` path which defaults to `enigma-bbs/www`. Static files live relative to the `contentServers.web.staticRoot` path which defaults to `enigma-bbs/www`.
`index.html, favicon.ico`, and any error pages like `404.html` are accessible from the route path. Other static assets hosted by the web server must be referenced from `/static/`, for example:
```html
<a href="/static/about.html"> Example Link
```
## Custom Error Pages ## Custom Error Pages
Customized error pages can be created for [HTTP error codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error) by providing a `<error_code>.html` file in the *static routes* area. For example: `404.html`. Customized error pages can be created for [HTTP error codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error) by providing a `<error_code>.html` file in the *static routes* area. For example: `404.html`.