mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-23 03:06:04 +02:00
Pardon the noise. More tab to space conversion!
This commit is contained in:
parent
c3635bb26b
commit
1d8be6b014
128 changed files with 8017 additions and 8017 deletions
|
@ -1,62 +1,62 @@
|
|||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
const MenuModule = require('./menu_module.js').MenuModule;
|
||||
const DropFile = require('./dropfile.js').DropFile;
|
||||
const door = require('./door.js');
|
||||
const theme = require('./theme.js');
|
||||
const ansi = require('./ansi_term.js');
|
||||
const MenuModule = require('./menu_module.js').MenuModule;
|
||||
const DropFile = require('./dropfile.js').DropFile;
|
||||
const door = require('./door.js');
|
||||
const theme = require('./theme.js');
|
||||
const ansi = require('./ansi_term.js');
|
||||
|
||||
const async = require('async');
|
||||
const assert = require('assert');
|
||||
const paths = require('path');
|
||||
const _ = require('lodash');
|
||||
const mkdirs = require('fs-extra').mkdirs;
|
||||
const async = require('async');
|
||||
const assert = require('assert');
|
||||
const paths = require('path');
|
||||
const _ = require('lodash');
|
||||
const mkdirs = require('fs-extra').mkdirs;
|
||||
|
||||
// :TODO: This should really be a system module... needs a little work to allow for such
|
||||
// :TODO: This should really be a system module... needs a little work to allow for such
|
||||
|
||||
const activeDoorNodeInstances = {};
|
||||
|
||||
exports.moduleInfo = {
|
||||
name : 'Abracadabra',
|
||||
desc : 'External BBS Door Module',
|
||||
author : 'NuSkooler',
|
||||
name : 'Abracadabra',
|
||||
desc : 'External BBS Door Module',
|
||||
author : 'NuSkooler',
|
||||
};
|
||||
|
||||
/*
|
||||
Example configuration for LORD under DOSEMU:
|
||||
Example configuration for LORD under DOSEMU:
|
||||
|
||||
{
|
||||
config: {
|
||||
name: PimpWars
|
||||
dropFileType: DORINFO
|
||||
cmd: qemu-system-i386
|
||||
args: [
|
||||
"-localtime",
|
||||
"freedos.img",
|
||||
"-chardev",
|
||||
"socket,port={srvPort},nowait,host=localhost,id=s0",
|
||||
"-device",
|
||||
"isa-serial,chardev=s0"
|
||||
]
|
||||
io: socket
|
||||
}
|
||||
}
|
||||
{
|
||||
config: {
|
||||
name: PimpWars
|
||||
dropFileType: DORINFO
|
||||
cmd: qemu-system-i386
|
||||
args: [
|
||||
"-localtime",
|
||||
"freedos.img",
|
||||
"-chardev",
|
||||
"socket,port={srvPort},nowait,host=localhost,id=s0",
|
||||
"-device",
|
||||
"isa-serial,chardev=s0"
|
||||
]
|
||||
io: socket
|
||||
}
|
||||
}
|
||||
|
||||
listen: socket | stdio
|
||||
listen: socket | stdio
|
||||
|
||||
{
|
||||
"config" : {
|
||||
"name" : "LORD",
|
||||
"dropFileType" : "DOOR",
|
||||
"cmd" : "/usr/bin/dosemu",
|
||||
"args" : [ "-quiet", "-f", "/etc/dosemu/dosemu.conf", "X:\\PW\\START.BAT {dropfile} {node}" ] ],
|
||||
"nodeMax" : 32,
|
||||
"tooManyArt" : "toomany-lord.ans"
|
||||
}
|
||||
}
|
||||
{
|
||||
"config" : {
|
||||
"name" : "LORD",
|
||||
"dropFileType" : "DOOR",
|
||||
"cmd" : "/usr/bin/dosemu",
|
||||
"args" : [ "-quiet", "-f", "/etc/dosemu/dosemu.conf", "X:\\PW\\START.BAT {dropfile} {node}" ] ],
|
||||
"nodeMax" : 32,
|
||||
"tooManyArt" : "toomany-lord.ans"
|
||||
}
|
||||
}
|
||||
|
||||
:TODO: See Mystic & others for other arg options that we may need to support
|
||||
:TODO: See Mystic & others for other arg options that we may need to support
|
||||
*/
|
||||
|
||||
exports.getModule = class AbracadabraModule extends MenuModule {
|
||||
|
@ -64,21 +64,21 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
|||
super(options);
|
||||
|
||||
this.config = options.menuConfig.config;
|
||||
// :TODO: MenuModule.validateConfig(cb) -- validate config section gracefully instead of asserts! -- { key : type, key2 : type2, ... }
|
||||
assert(_.isString(this.config.name, 'Config \'name\' is required'));
|
||||
assert(_.isString(this.config.dropFileType, 'Config \'dropFileType\' is required'));
|
||||
assert(_.isString(this.config.cmd, 'Config \'cmd\' is required'));
|
||||
// :TODO: MenuModule.validateConfig(cb) -- validate config section gracefully instead of asserts! -- { key : type, key2 : type2, ... }
|
||||
assert(_.isString(this.config.name, 'Config \'name\' is required'));
|
||||
assert(_.isString(this.config.dropFileType, 'Config \'dropFileType\' is required'));
|
||||
assert(_.isString(this.config.cmd, 'Config \'cmd\' is required'));
|
||||
|
||||
this.config.nodeMax = this.config.nodeMax || 0;
|
||||
this.config.args = this.config.args || [];
|
||||
this.config.nodeMax = this.config.nodeMax || 0;
|
||||
this.config.args = this.config.args || [];
|
||||
}
|
||||
|
||||
/*
|
||||
:TODO:
|
||||
* disconnecting wile door is open leaves dosemu
|
||||
* http://bbslink.net/sysop.php support
|
||||
* Font support ala all other menus... or does this just work?
|
||||
*/
|
||||
:TODO:
|
||||
* disconnecting wile door is open leaves dosemu
|
||||
* http://bbslink.net/sysop.php support
|
||||
* Font support ala all other menus... or does this just work?
|
||||
*/
|
||||
|
||||
initSequence() {
|
||||
const self = this;
|
||||
|
@ -87,12 +87,12 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
|||
[
|
||||
function validateNodeCount(callback) {
|
||||
if(self.config.nodeMax > 0 &&
|
||||
_.isNumber(activeDoorNodeInstances[self.config.name]) &&
|
||||
activeDoorNodeInstances[self.config.name] + 1 > self.config.nodeMax)
|
||||
_.isNumber(activeDoorNodeInstances[self.config.name]) &&
|
||||
activeDoorNodeInstances[self.config.name] + 1 > self.config.nodeMax)
|
||||
{
|
||||
self.client.log.info(
|
||||
{
|
||||
name : self.config.name,
|
||||
name : self.config.name,
|
||||
activeCount : activeDoorNodeInstances[self.config.name]
|
||||
},
|
||||
'Too many active instances');
|
||||
|
@ -106,13 +106,13 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
|||
} else {
|
||||
self.client.term.write('\nToo many active instances. Try again later.\n');
|
||||
|
||||
// :TODO: Use MenuModule.pausePrompt()
|
||||
// :TODO: Use MenuModule.pausePrompt()
|
||||
self.pausePrompt( () => {
|
||||
callback(new Error('Too many active instances'));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// :TODO: JS elegant way to do this?
|
||||
// :TODO: JS elegant way to do this?
|
||||
if(activeDoorNodeInstances[self.config.name]) {
|
||||
activeDoorNodeInstances[self.config.name] += 1;
|
||||
} else {
|
||||
|
@ -123,8 +123,8 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
|||
}
|
||||
},
|
||||
function generateDropfile(callback) {
|
||||
self.dropFile = new DropFile(self.client, self.config.dropFileType);
|
||||
var fullPath = self.dropFile.fullPath;
|
||||
self.dropFile = new DropFile(self.client, self.config.dropFileType);
|
||||
var fullPath = self.dropFile.fullPath;
|
||||
|
||||
mkdirs(paths.dirname(fullPath), function dirCreated(err) {
|
||||
if(err) {
|
||||
|
@ -152,28 +152,28 @@ exports.getModule = class AbracadabraModule extends MenuModule {
|
|||
runDoor() {
|
||||
|
||||
const exeInfo = {
|
||||
cmd : this.config.cmd,
|
||||
args : this.config.args,
|
||||
io : this.config.io || 'stdio',
|
||||
encoding : this.config.encoding || this.client.term.outputEncoding,
|
||||
dropFile : this.dropFile.fileName,
|
||||
node : this.client.node,
|
||||
//inhSocket : this.client.output._handle.fd,
|
||||
cmd : this.config.cmd,
|
||||
args : this.config.args,
|
||||
io : this.config.io || 'stdio',
|
||||
encoding : this.config.encoding || this.client.term.outputEncoding,
|
||||
dropFile : this.dropFile.fileName,
|
||||
node : this.client.node,
|
||||
//inhSocket : this.client.output._handle.fd,
|
||||
};
|
||||
|
||||
const doorInstance = new door.Door(this.client, exeInfo);
|
||||
|
||||
doorInstance.once('finished', () => {
|
||||
//
|
||||
// Try to clean up various settings such as scroll regions that may
|
||||
// have been set within the door
|
||||
// Try to clean up various settings such as scroll regions that may
|
||||
// have been set within the door
|
||||
//
|
||||
this.client.term.rawWrite(
|
||||
ansi.normal() +
|
||||
ansi.goto(this.client.term.termHeight, this.client.term.termWidth) +
|
||||
ansi.setScrollRegion() +
|
||||
ansi.goto(this.client.term.termHeight, 0) +
|
||||
'\r\n\r\n'
|
||||
ansi.goto(this.client.term.termHeight, this.client.term.termWidth) +
|
||||
ansi.setScrollRegion() +
|
||||
ansi.goto(this.client.term.termHeight, 0) +
|
||||
'\r\n\r\n'
|
||||
);
|
||||
|
||||
this.prevMenu();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue