Merge branch 'master' of ssh://numinibsd/git/base/enigma-bbs
This commit is contained in:
@@ -70,6 +70,7 @@ function AbracadabraModule(options) {
|
||||
|
||||
this.config = options.menuConfig.config;
|
||||
|
||||
// :TODO: MenuModule.validateConfig(cb) -- validate config section gracefully instead of asserts!
|
||||
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'));
|
||||
@@ -140,6 +141,7 @@ function AbracadabraModule(options) {
|
||||
],
|
||||
function complete(err) {
|
||||
if(err) {
|
||||
self.client.log.warn( { error : err.toString() }, 'Could not start door');
|
||||
self.lastError = err;
|
||||
self.prevMenu();
|
||||
} else {
|
||||
@@ -158,7 +160,7 @@ function AbracadabraModule(options) {
|
||||
encoding : self.config.encoding || self.client.term.outputEncoding,
|
||||
dropFile : self.dropFile.fileName,
|
||||
node : self.client.node,
|
||||
inhSocket : self.client.output._handle.fd,
|
||||
//inhSocket : self.client.output._handle.fd,
|
||||
};
|
||||
|
||||
var doorInstance = new door.Door(self.client, exeInfo);
|
||||
|
||||
33
mods/art_pool.js
Normal file
33
mods/art_pool.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
var MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
|
||||
|
||||
exports.getModule = ArtPoolModule;
|
||||
|
||||
exports.moduleInfo = {
|
||||
name : 'Art Pool',
|
||||
desc : 'Display art from a pool of options',
|
||||
author : 'NuSkooler',
|
||||
};
|
||||
|
||||
function ArtPoolModule(options) {
|
||||
MenuModule.call(this, options);
|
||||
|
||||
var config = this.menuConfig.config;
|
||||
|
||||
//
|
||||
// :TODO: General idea
|
||||
// * Break up some of MenuModule initSequence's calls into methods
|
||||
// * initSequence here basically has general "clear", "next", etc. as per normal
|
||||
// * Display art -> ooptinal pause -> display more if requested, etc.
|
||||
// * Finally exit & move on as per normal
|
||||
|
||||
}
|
||||
|
||||
require('util').inherits(ArtPoolModule, MenuModule);
|
||||
|
||||
MessageAreaModule.prototype.mciReady = function(mciData, cb) {
|
||||
this.standardMCIReadyHandler(mciData, cb);
|
||||
};
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
var MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
var Log = require('../core/logger.js').log;
|
||||
var resetScreen = require('../core/ansi_term.js').resetScreen;
|
||||
|
||||
var async = require('async');
|
||||
var _ = require('lodash');
|
||||
@@ -35,6 +36,7 @@ var packageJson = require('../package.json');
|
||||
*/
|
||||
|
||||
// :TODO: BUG: When a client disconnects, it's not handled very well -- the log is spammed with tons of errors
|
||||
// :TODO: ENH: Support nodeMax and tooManyArt
|
||||
|
||||
exports.getModule = BBSLinkModule;
|
||||
|
||||
@@ -132,6 +134,9 @@ function BBSLinkModule(options) {
|
||||
|
||||
var clientTerminated;
|
||||
|
||||
self.client.term.write(ansi.resetScreen());
|
||||
self.client.term.write(' Connecting to BBSLink.net, please wait...\n');
|
||||
|
||||
var bridgeConnection = net.createConnection(connectOpts, function connected() {
|
||||
self.client.log.info(connectOpts, 'BBSLink bridge connection established');
|
||||
|
||||
|
||||
@@ -77,9 +77,7 @@
|
||||
art: USERLOG
|
||||
next: fullLoginSequenceLoginArt
|
||||
config: {
|
||||
tooNode: {
|
||||
art: TOONODE
|
||||
}
|
||||
tooNodeMenu: loginAttemptTooNode
|
||||
}
|
||||
form: {
|
||||
0: {
|
||||
@@ -114,6 +112,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
loginAttemptTooNode: {
|
||||
art: TOONODE
|
||||
options: {
|
||||
cls: true
|
||||
nextTimeout: 2000
|
||||
}
|
||||
}
|
||||
|
||||
logoff: {
|
||||
art: LOGOFF
|
||||
next: @systemMethod:logoff
|
||||
@@ -122,6 +128,7 @@
|
||||
TODO: display PRINT before this (Obv/2) or NEWUSER1 (Mystic)
|
||||
*/
|
||||
newUserApplication: {
|
||||
module: nua
|
||||
art: NUA
|
||||
next: [
|
||||
{
|
||||
@@ -141,6 +148,7 @@
|
||||
focus: true
|
||||
argName: username
|
||||
maxLength: @config:users.usernameMax
|
||||
validate: @systemMethod:validateUserNameAvail
|
||||
}
|
||||
ET2: {
|
||||
argName: realName
|
||||
@@ -149,6 +157,7 @@
|
||||
MET3: {
|
||||
argName: birthdate
|
||||
maskPattern: "####/##/##"
|
||||
validate: @systemMethod:validateBirthdate
|
||||
}
|
||||
ME4: {
|
||||
argName: sex
|
||||
@@ -166,6 +175,7 @@
|
||||
ET7: {
|
||||
argName: email
|
||||
maxLength: 255
|
||||
validate: @systemMethod:validateEmailAvail
|
||||
}
|
||||
ET8: {
|
||||
argName: web
|
||||
@@ -175,11 +185,13 @@
|
||||
argName: password
|
||||
password: true
|
||||
maxLength: @config:users.passwordMax
|
||||
validate: @systemMethod:validatePasswordSpec
|
||||
}
|
||||
ET10: {
|
||||
argName: passwordConfirm
|
||||
password: true
|
||||
maxLength: @config:users.passwordMax
|
||||
validate: @method:validatePassConfirmMatch
|
||||
}
|
||||
TM12: {
|
||||
argName: submission
|
||||
@@ -445,7 +457,14 @@
|
||||
module: last_callers
|
||||
art: LASTCALL
|
||||
options: { pause: true }
|
||||
next: fullLoginSequenceSysStats
|
||||
next: fullLoginSequenceWhosOnline
|
||||
}
|
||||
fullLoginSequenceWhosOnline: {
|
||||
desc: Who's Online
|
||||
module: whos_online
|
||||
art: WHOSON
|
||||
options: { pause: true }
|
||||
next: fullLoginSequenceSysStats
|
||||
}
|
||||
fullLoginSequenceSysStats: {
|
||||
desc: System Stats
|
||||
@@ -613,27 +632,31 @@
|
||||
value: { command: "2" }
|
||||
action: @menu:doorLORD
|
||||
}
|
||||
{
|
||||
value: { command: "4" }
|
||||
action: @menu:doorTradeWars2002BBSLink
|
||||
}
|
||||
]
|
||||
}
|
||||
/*
|
||||
The 'abracadabra' module's config.args accepts the following format objects:
|
||||
{dropFile} - Path to generated dropfile
|
||||
{node} - Node number
|
||||
*/
|
||||
|
||||
doorPimpWars: {
|
||||
desc: Playing PimpWars
|
||||
module: abracadabra
|
||||
config: {
|
||||
name: PimpWars
|
||||
dropFileType: DORINFO
|
||||
cmd: /usr/bin/dosemu
|
||||
cmd: /home/nuskooler/DOS/scripts/pimpwars.sh
|
||||
args: [
|
||||
"-quiet", "-f", "/home/nuskooler/DOS/X/LORD/dosemu.conf", "X:\\PW\\START.BAT {dropFile} {node}"
|
||||
"{node}",
|
||||
"{dropFile}",
|
||||
"{srvPort}",
|
||||
],
|
||||
nodeMax: 1
|
||||
tooManyArt: DOORMANY
|
||||
io: socket
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
doorLORD: {
|
||||
desc: Playing L.O.R.D.
|
||||
module: abracadabra
|
||||
@@ -646,6 +669,22 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TradeWars 2000 example via BBSLink
|
||||
//
|
||||
// You will need to register with BBSLink to obtain sysCode, authCode and schemeCode
|
||||
//
|
||||
doorTradeWars2002BBSLink: {
|
||||
desc: Playing TW 2002 (BBSLink)
|
||||
module: bbs_link
|
||||
config: {
|
||||
sysCode: XXXXXXXX
|
||||
authCode: XXXXXXXX
|
||||
schemeCode: XXXXXXXX
|
||||
door: tw
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Message Area Menu
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
@@ -818,7 +857,7 @@
|
||||
}
|
||||
{
|
||||
value: { 1: 3 }
|
||||
action: @menu:messageArea
|
||||
action: @systemMethod:prevMenu
|
||||
}
|
||||
{
|
||||
value: { 1: 4 }
|
||||
@@ -1034,6 +1073,7 @@
|
||||
argName: subject
|
||||
maxLength: 72
|
||||
submit: true
|
||||
// :TODO: Validate -> close/cancel if empty
|
||||
}
|
||||
}
|
||||
submit: {
|
||||
|
||||
135
mods/nua.js
Normal file
135
mods/nua.js
Normal file
@@ -0,0 +1,135 @@
|
||||
/* jslint node: true */
|
||||
'use strict';
|
||||
var MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
var user = require('../core/user.js');
|
||||
var theme = require('../core/theme.js');
|
||||
var login = require('../core/system_menu_method.js').login;
|
||||
var Config = require('../core/config.js').config;
|
||||
|
||||
var async = require('async');
|
||||
|
||||
exports.getModule = NewUserAppModule;
|
||||
|
||||
exports.moduleInfo = {
|
||||
name : 'NUA',
|
||||
desc : 'New User Application',
|
||||
}
|
||||
|
||||
var MciViewIds = {
|
||||
userName : 1,
|
||||
password : 9,
|
||||
confirm : 10,
|
||||
errMsg : 11,
|
||||
};
|
||||
|
||||
function NewUserAppModule(options) {
|
||||
MenuModule.call(this, options);
|
||||
|
||||
var self = this;
|
||||
|
||||
this.menuMethods = {
|
||||
//
|
||||
// Validation stuff
|
||||
//
|
||||
validatePassConfirmMatch : function(data, cb) {
|
||||
var passwordView = self.viewControllers.menu.getView(MciViewIds.password);
|
||||
cb(passwordView.getData() === data ? null : new Error('Passwords do not match'));
|
||||
},
|
||||
|
||||
viewValidationListener : function(err, cb) {
|
||||
var errMsgView = self.viewControllers.menu.getView(MciViewIds.errMsg);
|
||||
var newFocusId;
|
||||
if(err) {
|
||||
errMsgView.setText(err.message);
|
||||
err.view.clearText();
|
||||
|
||||
if(err.view.getId() === MciViewIds.confirm) {
|
||||
newFocusId = MciViewIds.password;
|
||||
var passwordView = self.viewControllers.menu.getView(MciViewIds.password);
|
||||
passwordView.clearText();
|
||||
}
|
||||
} else {
|
||||
errMsgView.clearText();
|
||||
}
|
||||
|
||||
cb(newFocusId);
|
||||
},
|
||||
|
||||
|
||||
//
|
||||
// Submit handlers
|
||||
//
|
||||
submitApplication : function(formData, extraArgs) {
|
||||
var newUser = new user.User();
|
||||
|
||||
newUser.username = formData.value.username;
|
||||
|
||||
newUser.properties = {
|
||||
real_name : formData.value.realName,
|
||||
birthdate : new Date(Date.parse(formData.value.birthdate)).toISOString(),
|
||||
sex : formData.value.sex,
|
||||
location : formData.value.location,
|
||||
affiliation : formData.value.affils,
|
||||
email_address : formData.value.email,
|
||||
web_address : formData.value.web,
|
||||
account_created : new Date().toISOString(),
|
||||
|
||||
message_area_name : getDefaultMessageArea().name,
|
||||
|
||||
term_height : client.term.termHeight,
|
||||
term_width : client.term.termWidth,
|
||||
|
||||
// :TODO: This is set in User.create() -- proabbly don't need it here:
|
||||
//account_status : Config.users.requireActivation ? user.User.AccountStatus.inactive : user.User.AccountStatus.active,
|
||||
|
||||
// :TODO: Other defaults
|
||||
// :TODO: should probably have a place to create defaults/etc.
|
||||
};
|
||||
|
||||
if('*' === Config.defaults.theme) {
|
||||
newUser.properties.theme_id = theme.getRandomTheme();
|
||||
} else {
|
||||
newUser.properties.theme_id = Config.defaults.theme;
|
||||
}
|
||||
|
||||
// :TODO: .create() should also validate email uniqueness!
|
||||
newUser.create( { password : formData.value.password }, function created(err) {
|
||||
if(err) {
|
||||
self.client.log.info( { error : err, username : formData.value.username }, 'New user creation failed');
|
||||
|
||||
self.gotoMenu(extraArgs.error, function result(err) {
|
||||
if(err) {
|
||||
self.prevMenu();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
self.client.log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created');
|
||||
|
||||
// Cache SysOp information now
|
||||
// :TODO: Similar to bbs.js. DRY
|
||||
if(newUser.isSysOp()) {
|
||||
Config.general.sysOp = {
|
||||
username : formData.value.username,
|
||||
properties : newUser.properties,
|
||||
};
|
||||
}
|
||||
|
||||
if(user.User.AccountStatus.inactive === client.user.properties.account_status) {
|
||||
self.gotoMenu(extraArgs.inactive);
|
||||
} else {
|
||||
//
|
||||
// If active now, we need to call login() to authenticate
|
||||
//
|
||||
login(self, formData, extraArgs);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
require('util').inherits(NewUserAppModule, MenuModule);
|
||||
|
||||
NewUserAppModule.prototype.mciReady = function(mciData, cb) {
|
||||
this.standardMCIReadyHandler(mciData, cb);
|
||||
};
|
||||
@@ -78,7 +78,14 @@ WhosOnlineModule.prototype.mciReady = function(mciData, cb) {
|
||||
userName : oe.user.username,
|
||||
realName : oe.user.properties.real_name,
|
||||
timeOn : _.capitalize(moment.duration(55, 'minutes').humanize()),
|
||||
action : oe.currentMenuModule.menuConfig.desc || 'Unknown',
|
||||
action : function getCurrentAction() {
|
||||
var cmm = oe.currentMenuModule;
|
||||
if(cmm) {
|
||||
return cmm.menuConfig.desc || 'Unknown';
|
||||
}
|
||||
return 'Unknown';
|
||||
//oe.currentMenuModule.menuConfig.desc || 'Unknown',
|
||||
},
|
||||
location : oe.user.properties.location,
|
||||
affils : oe.user.properties.affiliation,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user