Merge pull request #235 from davestephens/0.0.10-alpha

Bring in MRC to 0.0.10 alpha!
This commit is contained in:
Bryan Ashby 2019-06-05 22:41:20 -06:00 committed by GitHub
commit 6e855884ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 5145 additions and 7 deletions

Binary file not shown.

View File

@ -1078,12 +1078,65 @@
} }
} }
mrc: {
//////////////////////////////// ERC ///////////////////////////////
ercClient: {
config: { config: {
//chatEntryFormat: "|00|08[|03{bbsTag}|08] |10{userName}|08: |02{message}" messageFormat: "|00|10<|02{fromUserName}|10>|00 |03{message}|00"
privateMessageFormat: "|00|10<|02{fromUserName}|15->{toUserName}|10>|00 |03{message}|00"
}
0: {
mci: {
MT1: {
width: 72
height: 19
}
ET2: {
width: 69 // fnarr!
maxLength: 140
}
TL3: {
width: 20
}
TL4: {
width: 20
}
TL5: {
width: 2
}
TL6: {
width: 2
}
}
}
}
irc: {
config: {
messageFormat: "|00|10<|02{fromUserName}|10>|00 |03{message}|00"
privateMessageFormat: "|00|10<|02{fromUserName}|15->{toUserName}|10>|00 |03{message}|00"
}
0: {
mci: {
MT1: {
width: 72
height: 17
}
ET2: {
width: 69 // fnarr!
maxLength: 140
}
TL3: {
width: 20
}
TL4: {
width: 20
}
TL5: {
width: 2
}
TL6: {
width: 2
}
}
} }
} }
} }

4237
config/menu.hjson Normal file

File diff suppressed because it is too large Load Diff

View File

@ -169,6 +169,11 @@ function getDefaultConfig() {
return { return {
general : { general : {
boardName : 'Another Fine ENiGMA½ BBS', boardName : 'Another Fine ENiGMA½ BBS',
prettyBoardName : '|08A|07nother |07F|08ine |07E|08NiGMA|07½ B|08BS',
telnetHostname : '',
sshHostname : '',
website : 'https://enigma-bbs.github.io',
description : 'An ENiGMA½ BBS',
// :TODO: closedSystem prob belongs under users{}? // :TODO: closedSystem prob belongs under users{}?
closedSystem : false, // is the system closed to new users? closedSystem : false, // is the system closed to new users?
@ -212,7 +217,8 @@ function getDefaultConfig() {
badUserNames : [ badUserNames : [
'sysop', 'admin', 'administrator', 'root', 'all', 'sysop', 'admin', 'administrator', 'root', 'all',
'areamgr', 'filemgr', 'filefix', 'areafix', 'allfix' 'areamgr', 'filemgr', 'filefix', 'areafix', 'allfix',
'server', 'client', 'notme'
], ],
preAuthIdleLogoutSeconds : 60 * 3, // 3m preAuthIdleLogoutSeconds : 60 * 3, // 3m
@ -253,6 +259,7 @@ function getDefaultConfig() {
mods : paths.join(__dirname, './../mods/'), mods : paths.join(__dirname, './../mods/'),
loginServers : paths.join(__dirname, './servers/login/'), loginServers : paths.join(__dirname, './servers/login/'),
contentServers : paths.join(__dirname, './servers/content/'), contentServers : paths.join(__dirname, './servers/content/'),
chatServers : paths.join(__dirname, './servers/chat/'),
scannerTossers : paths.join(__dirname, './scanner_tossers/'), scannerTossers : paths.join(__dirname, './scanner_tossers/'),
mailers : paths.join(__dirname, './mailers/') , mailers : paths.join(__dirname, './mailers/') ,
@ -447,6 +454,16 @@ function getDefaultConfig() {
} }
}, },
chatServers : {
mrc: {
enabled : false,
serverHostname : 'mrc.bottomlessabyss.net',
serverPort : 5000,
retryDelay : 10000,
multiplexerPort : 5000,
}
},
infoExtractUtils : { infoExtractUtils : {
Exiftool2Desc : { Exiftool2Desc : {
cmd : `${__dirname}/../util/exiftool2desc.js`, // ensure chmod +x cmd : `${__dirname}/../util/exiftool2desc.js`, // ensure chmod +x

View File

@ -28,7 +28,7 @@ function getServer(packageName) {
function startListening(cb) { function startListening(cb) {
const moduleUtil = require('./module_util.js'); // late load so we get Config const moduleUtil = require('./module_util.js'); // late load so we get Config
async.each( [ 'login', 'content' ], (category, next) => { async.each( [ 'login', 'content', 'chat' ], (category, next) => {
moduleUtil.loadModulesForCategory(`${category}Servers`, (module, nextModule) => { moduleUtil.loadModulesForCategory(`${category}Servers`, (module, nextModule) => {
const moduleInst = new module.getModule(); const moduleInst = new module.getModule();
try { try {

View File

@ -117,6 +117,7 @@ function getModulePaths() {
config.paths.mods, config.paths.mods,
config.paths.loginServers, config.paths.loginServers,
config.paths.contentServers, config.paths.contentServers,
config.paths.chatServers,
config.paths.scannerTossers, config.paths.scannerTossers,
]; ];
} }

439
core/mrc.js Normal file
View File

@ -0,0 +1,439 @@
/* jslint node: true */
'use strict';
// ENiGMA½
const Log = require('./logger.js').log;
const { MenuModule } = require('./menu_module.js');
const {
pipeToAnsi,
stripMciColorCodes
} = require('./color_codes.js');
const stringFormat = require('./string_format.js');
const StringUtil = require('./string_util.js');
// deps
const _ = require('lodash');
const async = require('async');
const net = require('net');
const moment = require('moment');
exports.moduleInfo = {
name : 'MRC Client',
desc : 'Connects to an MRC chat server',
author : 'RiPuk',
packageName : 'codes.l33t.enigma.mrc.client',
// Whilst this module was put together by me (RiPuk), it should be noted that a lot of the ideas (and even some code snippets) were
// borrowed from the Synchronet implementation of MRC by echicken. So...thanks, your code was very helpful in putting this together.
// Source at http://cvs.synchro.net/cgi-bin/viewcvs.cgi/xtrn/mrc/.
};
const FormIds = {
mrcChat : 0,
};
var MciViewIds = {
mrcChat : {
chatLog : 1,
inputArea : 2,
roomName : 3,
roomTopic : 4,
mrcUsers : 5,
mrcBbses : 6,
customRangeStart : 10, // 10+ = customs
}
};
// TODO: this is a bit shit, could maybe do it with an ansi instead
const helpText = `
General Chat:
/rooms & /join <ro - List all or join a room
/pm <user> <message> - Send a private message
----
/whoon - Who's on what BBS
/chatters - Who's in what room
/topic <message> - Set the room topic
/bbses & /info <id> - Info about BBS's connected
/meetups - Info about MRC MeetUps
---
/l33t <your message> - l337 5p34k
/kewl <your message> - BBS KeWL SPeaK
/rainbow <your message> - Crazy rainbow text
`;
exports.getModule = class mrcModule extends MenuModule {
constructor(options) {
super(options);
this.log = Log.child( { module : 'MRC' } );
this.config = Object.assign({}, _.get(options, 'menuConfig.config'), { extraArgs : options.extraArgs });
this.state = {
socket: '',
alias: this.client.user.username,
room: '',
room_topic: '',
nicks: [],
last_ping: 0
};
this.menuMethods = {
sendChatMessage : (formData, extraArgs, cb) => {
const inputAreaView = this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.inputArea);
const inputData = inputAreaView.getData();
this.processOutgoingMessage(inputData);
inputAreaView.clearText();
return cb(null);
},
movementKeyPressed : (formData, extraArgs, cb) => {
const bodyView = this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.chatLog); // :TODO: use const here vs magic #
switch(formData.key.name) {
case 'down arrow' : bodyView.scrollDocumentUp(); break;
case 'up arrow' : bodyView.scrollDocumentDown(); break;
case 'page up' : bodyView.keyPressPageUp(); break;
case 'page down' : bodyView.keyPressPageDown(); break;
}
this.viewControllers.mrcChat.switchFocus(MciViewIds.mrcChat.inputArea);
return cb(null);
},
quit : (formData, extraArgs, cb) => {
this.sendServerMessage('LOGOFF');
clearInterval(this.heartbeat);
this.state.socket.destroy();
return this.prevMenu(cb);
}
};
}
mciReady(mciData, cb) {
super.mciReady(mciData, err => {
if(err) {
return cb(err);
}
async.series(
[
(callback) => {
return this.prepViewController('mrcChat', FormIds.mrcChat, mciData.menu, callback);
},
(callback) => {
return this.validateMCIByViewIds('mrcChat', [ MciViewIds.mrcChat.chatLog, MciViewIds.mrcChat.inputArea ], callback);
},
(callback) => {
const connectOpts = {
port : 5000,
host : 'localhost',
};
// connect to multiplexer
this.state.socket = net.createConnection(connectOpts, () => {
const self = this;
// handshake with multiplexer
self.state.socket.write(`--DUDE-ITS--|${self.state.alias}\n`);
self.clientConnect();
// send register to central MRC and get stats every 60s
self.heartbeat = setInterval(function () {
self.sendHeartbeat();
self.sendServerMessage('STATS');
}, 60000);
});
// when we get data, process it
this.state.socket.on('data', data => {
data = data.toString();
this.processReceivedMessage(data);
});
return(callback);
}
],
err => {
return cb(err);
}
);
});
}
/**
* Adds a message to the chat log on screen
*/
addMessageToChatLog(message) {
const chatLogView = this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.chatLog);
const messageLength = stripMciColorCodes(message).length;
const chatWidth = chatLogView.dimens.width;
let padAmount = 0;
let spaces = 2;
if (messageLength > chatWidth) {
padAmount = chatWidth - (messageLength % chatWidth) - spaces;
} else {
padAmount = chatWidth - messageLength - spaces ;
}
if (padAmount < 0) padAmount = 0;
const padding = ' |00' + ' '.repeat(padAmount);
chatLogView.addText(pipeToAnsi(message + padding));
}
/**
* Processes data received from the MRC multiplexer
*/
processReceivedMessage(blob) {
blob.split('\n').forEach( message => {
try {
message = JSON.parse(message);
} catch (e) {
return;
}
if (message.from_user == 'SERVER') {
const params = message.body.split(':');
switch (params[0]) {
case 'BANNER':
this.addMessageToChatLog(params[1].replace(/^\s+/, ''));
break;
case 'ROOMTOPIC':
this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.roomName).setText(`#${params[1]}`);
this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.roomTopic).setText(pipeToAnsi(params[2]));
this.state.room = params[1];
break;
case 'USERLIST':
this.state.nicks = params[1].split(',');
break;
case 'STATS': {
const stats = params[1].split(' ');
this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.mrcUsers).setText(stats[2]);
this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.mrcBbses).setText(stats[0]);
this.state.last_ping = stats[1];
break;
}
default:
this.addMessageToChatLog(message.body);
break;
}
} else {
if (message.to_room == this.state.room) {
// if we're here then we want to show it to the user
const currentTime = moment().format(this.client.currentTheme.helpers.getTimeFormat());
this.addMessageToChatLog('|08' + currentTime + '|00 ' + message.body + '|00');
}
}
this.viewControllers.mrcChat.switchFocus(MciViewIds.mrcChat.inputArea);
});
}
/**
* Receives the message input from the user and does something with it based on what it is
*/
processOutgoingMessage(message, to_user) {
if (message.startsWith('/')) {
this.processSlashCommand(message);
} else {
if (message == '') {
// don't do anything if message is blank, just update stats
this.sendServerMessage('STATS');
return;
}
// else just format and send
const textFormatObj = {
fromUserName : this.state.alias,
toUserName : to_user,
message : message
};
const messageFormat =
this.config.messageFormat ||
'|00|10<|02{fromUserName}|10>|00 |03{message}|00';
const privateMessageFormat =
this.config.outgoingPrivateMessageFormat ||
'|00|10<|02{fromUserName}|10|14->|02{toUserName}>|00 |03{message}|00';
let formattedMessage = '';
if (to_user == undefined) {
// normal message
formattedMessage = stringFormat(messageFormat, textFormatObj);
} else {
// pm
formattedMessage = stringFormat(privateMessageFormat, textFormatObj);
}
try {
this.sendMessageToMultiplexer(to_user || '', '', this.state.room, formattedMessage);
} catch(e) {
this.client.log.warn( { error : e.message }, 'MRC error');
}
}
}
/**
* Processes a message that begins with a slash
*/
processSlashCommand(message) {
// get the chat log view in case we need it
const chatLogView = this.viewControllers.mrcChat.getView(MciViewIds.mrcChat.chatLog);
const cmd = message.split(' ');
cmd[0] = cmd[0].substr(1).toLowerCase();
switch (cmd[0]) {
case 'pm':
this.processOutgoingMessage(cmd[2], cmd[1]);
break;
case 'rainbow': {
// this is brutal, but i love it
const line = message.replace(/^\/rainbow\s/, '').split(' ').reduce(function (a, c) {
const cc = Math.floor((Math.random() * 31) + 1).toString().padStart(2, '0');
a += `|${cc}${c}|00 `;
return a;
}, '').substr(0, 140).replace(/\\s\|\d*$/, '');
this.processOutgoingMessage(line);
break;
}
case 'l33t':
this.processOutgoingMessage(StringUtil.stylizeString(message.substr(6), 'l33t'));
break;
case 'kewl': {
const text_modes = Array('f','v','V','i','M');
const mode = text_modes[Math.floor(Math.random() * text_modes.length)];
this.processOutgoingMessage(StringUtil.stylizeString(message.substr(6), mode));
break;
}
case 'whoon':
this.sendServerMessage('WHOON');
break;
case 'motd':
this.sendServerMessage('MOTD');
break;
case 'meetups':
this.sendServerMessage('MEETUPS');
break;
case 'bbses':
this.sendServerMessage('CONNECTED');
break;
case 'topic':
this.sendServerMessage(`NEWTOPIC:${this.state.room}:${message.substr(7)}`);
break;
case 'info':
this.sendServerMessage(`INFO ${cmd[1]}`);
break;
case 'join':
this.joinRoom(cmd[1]);
break;
case 'chatters':
this.sendServerMessage('CHATTERS');
break;
case 'rooms':
this.sendServerMessage('LIST');
break;
case 'clear':
chatLogView.setText('');
break;
case '?':
this.addMessageToChatLog(helpText);
break;
default:
break;
}
// just do something to get the cursor back to the right place ¯\_(ツ)_/¯
this.sendServerMessage('STATS');
}
/**
* Creates a json object, stringifies it and sends it to the MRC multiplexer
*/
sendMessageToMultiplexer(to_user, to_site, to_room, body) {
const message = {
from_user: this.state.alias,
from_room: this.state.room,
to_user: to_user,
to_site: to_site,
to_room: to_room,
body: body
};
// TODO: check socket still exists here
this.state.socket.write(JSON.stringify(message) + '\n');
}
/**
* Sends an MRC 'server' message
*/
sendServerMessage(command, to_site) {
Log.debug({ module: 'mrc', command: command }, 'Sending server command');
this.sendMessageToMultiplexer('SERVER', to_site || '', this.state.room, command);
}
/**
* Sends a heartbeat to the MRC server
*/
sendHeartbeat() {
this.sendServerMessage('IAMHERE');
}
/**
* Joins a room, unsurprisingly
*/
joinRoom(room) {
// room names are displayed with a # but referred to without. confusing.
room = room.replace(/^#/, '');
this.state.room = room;
this.sendServerMessage(`NEWROOM:${this.state.room}:${room}`);
this.sendServerMessage('USERLIST');
}
/**
* Things that happen when a local user connects to the MRC multiplexer
*/
clientConnect() {
this.sendServerMessage('MOTD');
this.joinRoom('lobby');
this.sendServerMessage('STATS');
this.sendHeartbeat();
}
};

View File

@ -0,0 +1,320 @@
/* jslint node: true */
'use strict';
// ENiGMA½
const Log = require('../../logger.js').log;
const { ServerModule } = require('../../server_module.js');
const Config = require('../../config.js').get;
const { Errors } = require('../../enig_error.js');
const SysProps = require('../../system_property.js');
const StatLog = require('../../stat_log.js');
// deps
const net = require('net');
const _ = require('lodash');
const os = require('os');
// MRC
const protocolVersion = '1.2.9';
const lineDelimiter = new RegExp('\r\n|\r|\n');
const ModuleInfo = exports.moduleInfo = {
name : 'MRC',
desc : 'An MRC Chat Multiplexer',
author : 'RiPuk',
packageName : 'codes.l33t.enigma.mrc.server',
notes : 'https://bbswiki.bottomlessabyss.net/index.php?title=MRC_Chat_platform',
};
const connectedSockets = new Set();
exports.getModule = class MrcModule extends ServerModule {
constructor() {
super();
this.log = Log.child( { server : 'MRC' } );
const config = Config();
this.mrcConnectOpts = {
host : config.chatServers.mrc.serverHostname || 'mrc.bottomlessabyss.net',
port : config.chatServers.mrc.serverPort || 5000,
retryDelay : config.chatServers.mrc.retryDelay || 10000
};
}
_connectionHandler() {
const config = Config();
const boardName = config.general.prettyBoardName || config.general.boardName;
const enigmaVersion = 'ENiGMA½-BBS_' + require('../../../package.json').version;
const handshake = `${boardName}~${enigmaVersion}/${os.platform()}.${os.arch()}/${protocolVersion}`;
this.log.debug({ handshake : handshake }, 'Handshaking with MRC server');
this.sendRaw(handshake);
this.log.info(this.mrcConnectOpts, 'Connected to MRC server');
}
createServer(cb) {
if (!this.enabled) {
return cb(null);
}
this.connectToMrc();
this.createLocalListener();
return cb(null);
}
listen(cb) {
if (!this.enabled) {
return cb(null);
}
const config = Config();
const port = parseInt(config.chatServers.mrc.multiplexerPort);
if(isNaN(port)) {
this.log.warn( { port : config.chatServers.mrc.multiplexerPort, server : ModuleInfo.name }, 'Invalid port' );
return cb(Errors.Invalid(`Invalid port: ${config.chatServers.mrc.multiplexerPort}`));
}
Log.info( { server : ModuleInfo.name, port : config.chatServers.mrc.multiplexerPort }, 'MRC multiplexer starting up');
return this.server.listen(port, cb);
}
/**
* Handles connecting to to the MRC server
*/
connectToMrc() {
const self = this;
// create connection to MRC server
this.mrcClient = net.createConnection(this.mrcConnectOpts, self._connectionHandler.bind(self));
this.mrcClient.requestedDisconnect = false;
// do things when we get data from MRC central
let buffer = new Buffer.from('');
function handleData(chunk) {
if(_.isString(chunk)) {
buffer += chunk;
} else {
buffer = Buffer.concat([buffer, chunk]);
}
var lines = buffer.toString().split(lineDelimiter);
if (lines.pop()) {
// if buffer is not ended with \r\n, there's more chunks.
return;
} else {
// else, initialize the buffer.
buffer = new Buffer.from('');
}
lines.forEach( line => {
if (line.length) {
let message = self.parseMessage(line);
if (message) {
self.receiveFromMRC(message);
}
}
});
}
this.mrcClient.on('data', (data) => {
handleData(data);
});
this.mrcClient.on('end', () => {
this.log.info(this.mrcConnectOpts, 'Disconnected from MRC server');
});
this.mrcClient.on('close', () => {
if (this.mrcClient && this.mrcClient.requestedDisconnect)
return;
this.log.info(this.mrcConnectOpts, 'Disconnected from MRC server, reconnecting');
this.log.debug('Waiting ' + this.mrcConnectOpts.retryDelay + 'ms before retrying');
setTimeout(function() {
self.connectToMrc();
}, this.mrcConnectOpts.retryDelay);
});
this.mrcClient.on('error', err => {
this.log.info( { error : err.message }, 'MRC server error');
});
}
createLocalListener() {
// start a local server for clients to connect to
this.server = net.createServer( socket => {
socket.setEncoding('ascii');
socket.on('data', data => {
// split on \n to deal with getting messages in batches
data.toString().split(lineDelimiter).forEach( item => {
if (item == '') return;
// save username with socket
if(item.startsWith('--DUDE-ITS--')) {
connectedSockets.add(socket);
socket.username = item.split('|')[1];
Log.debug( { server : 'MRC', user: socket.username } , 'User connected');
} else {
this.receiveFromClient(socket.username, item);
}
});
});
socket.on('end', function() {
connectedSockets.delete(socket);
});
socket.on('error', err => {
if('ECONNRESET' !== err.code) { // normal
this.log.error( { error: err.message }, 'MRC error' );
}
});
});
}
get enabled() {
return _.get(Config(), 'chatServers.mrc.enabled', false) && this.isConfigured();
}
isConfigured() {
const config = Config();
return _.isNumber(_.get(config, 'chatServers.mrc.multiplexerPort'));
}
/**
* Sends received messages to local clients
*/
sendToClient(message) {
connectedSockets.forEach( (client) => {
if (message.to_user == '' || message.to_user == client.username || message.to_user == 'CLIENT' || message.from_user == client.username || message.to_user == 'NOTME' ) {
// this.log.debug({ server : 'MRC', username : client.username, message : message }, 'Forwarding message to connected user');
client.write(JSON.stringify(message) + '\n');
}
});
}
/**
* Processes messages received from the central MRC server
*/
receiveFromMRC(message) {
const config = Config();
const siteName = slugify(config.general.boardName);
if (message.from_user == 'SERVER' && message.body == 'HELLO') {
// reply with extra bbs info
this.sendToMrcServer('CLIENT', '', 'SERVER', 'ALL', '', `INFOSYS:${StatLog.getSystemStat(SysProps.SysOpUsername)}`);
this.sendToMrcServer('CLIENT', '', 'SERVER', 'ALL', '', `INFOWEB:${config.general.website}`);
this.sendToMrcServer('CLIENT', '', 'SERVER', 'ALL', '', `INFOTEL:${config.general.telnetHostname}`);
this.sendToMrcServer('CLIENT', '', 'SERVER', 'ALL', '', `INFOSSH:${config.general.sshHostname}`);
this.sendToMrcServer('CLIENT', '', 'SERVER', 'ALL', '', `INFODSC:${config.general.description}`);
} else if (message.from_user == 'SERVER' && message.body.toUpperCase() == 'PING') {
// reply to heartbeat
this.sendToMrcServer('CLIENT', '', 'SERVER', 'ALL', '', `IMALIVE:${siteName}`);
} else {
// if not a heartbeat, and we have clients then we need to send something to them
this.sendToClient(message);
}
}
/**
* Takes an MRC message and parses it into something usable
*/
parseMessage(line) {
const [from_user, from_site, from_room, to_user, to_site, to_room, body ] = line.split('~');
// const msg = line.split('~');
// if (msg.length < 7) {
// return;
// }
return { from_user, from_site, from_room, to_user, to_site, to_room, body };
}
/**
* Receives a message from a local client and sanity checks before sending on to the central MRC server
*/
receiveFromClient(username, message) {
try {
message = JSON.parse(message);
} catch (e) {
Log.debug({ server : 'MRC', user : username, message : message }, 'Dodgy message received from client');
}
this.sendToMrcServer(message.from_user, message.from_room, message.to_user, message.to_site, message.to_room, message.body);
}
/**
* Converts a message back into the MRC format and sends it to the central MRC server
*/
sendToMrcServer(fromUser, fromRoom, toUser, toSite, toRoom, messageBody) {
const config = Config();
const siteName = slugify(config.general.boardName);
const line = [
fromUser,
siteName,
sanitiseRoomName(fromRoom),
sanitiseName(toUser || ''),
sanitiseName(toSite || ''),
sanitiseRoomName(toRoom || ''),
sanitiseMessage(messageBody)
].join('~') + '~';
// Log.debug({ server : 'MRC', data : line }, 'Sending data');
this.sendRaw(line);
}
sendRaw(message) {
// optionally log messages here
this.mrcClient.write(message + '\n');
}
};
/**
* User / site name must be ASCII 33-125, no MCI, 30 chars max, underscores
*/
function sanitiseName(str) {
return str.replace(
/\s/g, '_'
).replace(
/[^\x21-\x7D]|(\|\w\w)/g, '' // Non-printable & MCI
).substr(
0, 30
);
}
function sanitiseRoomName(message) {
return message.replace(/[^\x21-\x7D]|(\|\w\w)/g, '').substr(0, 30);
}
function sanitiseMessage(message) {
return message.replace(/[^\x20-\x7D]/g, '');
}
/**
* SLugifies the BBS name for use as an MRC "site name"
*/
function slugify(text) {
return text.toString()
.replace(/\s+/g, '_') // Replace spaces with _
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '_') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}

View File

@ -50,6 +50,21 @@
general: { general: {
// Your BBS Name! // Your BBS Name!
boardName: XXXXX boardName: XXXXX
// Your BBS name, with pipe codes for styling
prettyBoardName : '|08XXXXX'
// Telnet hostname and port for your board
telnetHostname : 'xibalba.l33t.codes:44510'
// SSH hostname and port for your board
sshHostname : 'xibalba.l33t.codes:44511'
// Your board's website
website : 'https://enigma-bbs.github.io'
// Short board description
description : 'Yet another awesome ENiGMA½ BBS'
} }
paths: { paths: {
@ -274,6 +289,16 @@
} }
} }
chatServers: {
// multi relay chat settings. No need to sign up, just enable it.
// More info: https://bbswiki.bottomlessabyss.net/index.php?title=MRC_Chat_platform
mrc: {
enabled : false
serverHostname : 'mrc.bottomlessabyss.net'
serverPort : 5000
}
}
// //
// Currently, ENiGMA½ can use external email to mail // Currently, ENiGMA½ can use external email to mail
// users for password resets. Additional functionality will // users for password resets. Additional functionality will

View File

@ -1066,6 +1066,10 @@
value: { command: "UA" } value: { command: "UA" }
action: @menu:mainMenuUserAchievementsEarned action: @menu:mainMenuUserAchievementsEarned
} }
{
value: { command: "MRC" }
action: @menu:mrc
}
{ {
value: 1 value: 1
action: @menu:mainMenu action: @menu:mainMenu
@ -1094,6 +1098,48 @@
} }
} }
mrc: {
desc: MRC Chat
module: mrc
art: MRC
config: {
cls: true
}
form: {
0: {
mci: {
MT1: {
mode: preview
autoScroll: true
}
ET2: {
argName: inputArea
submit: true
focus: true
}
}
actionKeys: [
{
keys: [ "escape" ]
action: @systemMethod:prevMenu
}
{
keys: [ "down arrow", "up arrow", "page up", "page down" ]
action: @method:movementKeyPressed
}
]
submit: {
*: [
{
value: { inputArea: null }
action: @method:sendChatMessage
}
]
}
}
}
}
nodeMessage: { nodeMessage: {
desc: Node Messaging desc: Node Messaging
module: node_msg module: node_msg