* Minor JSON -> HJSON config cleanup
* Some logging in telnet server vs console.log() * Calculate FSE footer position vs hard code it
This commit is contained in:
parent
e661b23eca
commit
05f666cf29
17
core/fse.js
17
core/fse.js
|
@ -184,19 +184,17 @@ function FullScreenEditorModule(options) {
|
||||||
[
|
[
|
||||||
function moveToFooterPosition(callback) {
|
function moveToFooterPosition(callback) {
|
||||||
//
|
//
|
||||||
// Calculate footer staring position
|
// Calculate footer starting position
|
||||||
//
|
//
|
||||||
// row = (header height + body height)
|
// row = (header height + body height)
|
||||||
//
|
//
|
||||||
// Header: mciData.body.height
|
var footerRow = self.header.height + self.body.height;
|
||||||
// Body : We must find this in the config / theme
|
self.client.term.rawWrite(ansi.goto(footerRow, 1));
|
||||||
//
|
|
||||||
// :TODO: don't hard code this -- allow footer height to be part of theme/etc.
|
|
||||||
self.client.term.rawWrite(ansi.goto(24, 1));
|
|
||||||
callback(null);
|
callback(null);
|
||||||
},
|
},
|
||||||
function clearFooterArea(callback) {
|
function clearFooterArea(callback) {
|
||||||
if(options.clear) {
|
if(options.clear) {
|
||||||
|
// footer up to 3 rows in height
|
||||||
self.client.term.rawWrite(ansi.reset() + ansi.deleteLine(3));
|
self.client.term.rawWrite(ansi.reset() + ansi.deleteLine(3));
|
||||||
}
|
}
|
||||||
callback(null);
|
callback(null);
|
||||||
|
@ -316,6 +314,9 @@ function FullScreenEditorModule(options) {
|
||||||
{ font : self.menuConfig.font },
|
{ font : self.menuConfig.font },
|
||||||
function displayed(err, artData) {
|
function displayed(err, artData) {
|
||||||
mciData[n] = artData;
|
mciData[n] = artData;
|
||||||
|
|
||||||
|
self[n] = { height : artData.height };
|
||||||
|
|
||||||
next(err);
|
next(err);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -327,7 +328,7 @@ function FullScreenEditorModule(options) {
|
||||||
self.setInitialFooterMode();
|
self.setInitialFooterMode();
|
||||||
|
|
||||||
var footerName = self.getFooterName();
|
var footerName = self.getFooterName();
|
||||||
console.log(footerName)
|
|
||||||
self.redrawFooter( { footerName : footerName }, function artDisplayed(err, artData) {
|
self.redrawFooter( { footerName : footerName }, function artDisplayed(err, artData) {
|
||||||
mciData[footerName] = artData;
|
mciData[footerName] = artData;
|
||||||
callback(err);
|
callback(err);
|
||||||
|
@ -369,8 +370,6 @@ function FullScreenEditorModule(options) {
|
||||||
menuLoadOpts.formId = self.getFormId('body');
|
menuLoadOpts.formId = self.getFormId('body');
|
||||||
menuLoadOpts.mciMap = mciData.body.mciMap;
|
menuLoadOpts.mciMap = mciData.body.mciMap;
|
||||||
|
|
||||||
console.log('creating body.l..')
|
|
||||||
|
|
||||||
self.addViewController(
|
self.addViewController(
|
||||||
'body',
|
'body',
|
||||||
new ViewController( { client : self.client, formId : menuLoadOpts.formId } )
|
new ViewController( { client : self.client, formId : menuLoadOpts.formId } )
|
||||||
|
|
|
@ -13,6 +13,13 @@ var util = require('util');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var iconv = require('iconv-lite');
|
var iconv = require('iconv-lite');
|
||||||
|
|
||||||
|
/*
|
||||||
|
:TODO: should probably be broken up
|
||||||
|
FTNPacket
|
||||||
|
FTNPacketImport: packet -> message(s)
|
||||||
|
FTNPacketExport: message(s) -> packet
|
||||||
|
*/
|
||||||
|
|
||||||
//
|
//
|
||||||
// References
|
// References
|
||||||
// * http://ftsc.org/docs/fts-0001.016
|
// * http://ftsc.org/docs/fts-0001.016
|
||||||
|
|
|
@ -26,7 +26,14 @@ function MCIViewFactory(client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MCIViewFactory.UserViewCodes = [
|
MCIViewFactory.UserViewCodes = [
|
||||||
'TL', 'ET', 'ME', 'MT', 'PL', 'BT', 'VM', 'HM', 'SM', 'TM'
|
'TL', 'ET', 'ME', 'MT', 'PL', 'BT', 'VM', 'HM', 'SM', 'TM',
|
||||||
|
|
||||||
|
//
|
||||||
|
// XY is a special MCI code that allows finding positions
|
||||||
|
// and counts for key lookup, but does not explicitly
|
||||||
|
// represent a visible View on it's own
|
||||||
|
//
|
||||||
|
'XY',
|
||||||
];
|
];
|
||||||
|
|
||||||
MCIViewFactory.prototype.createFromMCI = function(mci) {
|
MCIViewFactory.prototype.createFromMCI = function(mci) {
|
||||||
|
@ -189,8 +196,6 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
|
||||||
setOption(2, 'justify');
|
setOption(2, 'justify');
|
||||||
|
|
||||||
view = new TextView(options);
|
view = new TextView(options);
|
||||||
} else {
|
|
||||||
// :TODO: log this
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,13 +154,19 @@ function MenuModule(options) {
|
||||||
|
|
||||||
this.nextMenu = function() {
|
this.nextMenu = function() {
|
||||||
if(!_.isObject(self.menuConfig.form) && !_.isString(self.menuConfig.prompt) &&
|
if(!_.isObject(self.menuConfig.form) && !_.isString(self.menuConfig.prompt) &&
|
||||||
(_.isString(self.menuConfig.next) || _.isObject(self.menuConfig.next)))
|
!_.isUndefined(self.menuConfig.next))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
next : "spec"
|
'next' may be a simple asset, or a object with next.asset and
|
||||||
|
extrArgs
|
||||||
|
|
||||||
|
next: assetSpec
|
||||||
|
|
||||||
|
-or-
|
||||||
|
|
||||||
next: {
|
next: {
|
||||||
"asset" : "spec",
|
asset: assetSpec
|
||||||
"extraArgs" : ...
|
extraArgs: ...
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if(self.hasNextTimeout()) {
|
if(self.hasNextTimeout()) {
|
||||||
|
|
|
@ -326,7 +326,8 @@ OPTION_IMPLS[OPTIONS.NEW_ENVIRONMENT] = function(bufs, i, event) {
|
||||||
event.type = vars.isOrInfo;
|
event.type = vars.isOrInfo;
|
||||||
|
|
||||||
if(vars.newEnv === OPTIONS.NEW_ENVIRONMENT_DEP) {
|
if(vars.newEnv === OPTIONS.NEW_ENVIRONMENT_DEP) {
|
||||||
Log.warn('Handling deprecated RFC 1408 NEW-ENVIRON');
|
// :TODO: bring all this into Telnet class
|
||||||
|
Log.log.warn('Handling deprecated RFC 1408 NEW-ENVIRON');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -488,7 +489,7 @@ function TelnetClient(input, output) {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.input.on('error', function sockError(err) {
|
this.input.on('error', function sockError(err) {
|
||||||
Log.debug(err); // :TODO: probably something better...
|
self.log.debug(err); // :TODO: probably something better...
|
||||||
self.emit('end');
|
self.emit('end');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -524,12 +525,12 @@ TelnetClient.prototype.handleWillCommand = function(evt) {
|
||||||
this.requestNewEnvironment();
|
this.requestNewEnvironment();
|
||||||
} else {
|
} else {
|
||||||
// :TODO: temporary:
|
// :TODO: temporary:
|
||||||
console.log('unhandled will ' + JSON.stringify(evt));
|
this.log.trace(evt, 'WILL');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TelnetClient.prototype.handleWontCommand = function(evt) {
|
TelnetClient.prototype.handleWontCommand = function(evt) {
|
||||||
console.log('wont ' + JSON.stringify(evt));
|
this.log.trace(evt, 'WONT');
|
||||||
};
|
};
|
||||||
|
|
||||||
TelnetClient.prototype.handleDoCommand = function(evt) {
|
TelnetClient.prototype.handleDoCommand = function(evt) {
|
||||||
|
@ -547,19 +548,19 @@ TelnetClient.prototype.handleDoCommand = function(evt) {
|
||||||
this.wont.encrypt();
|
this.wont.encrypt();
|
||||||
} else {
|
} else {
|
||||||
// :TODO: temporary:
|
// :TODO: temporary:
|
||||||
console.log('do ' + JSON.stringify(evt));
|
this.log.trace(evt, 'DO');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TelnetClient.prototype.handleDontCommand = function(evt) {
|
TelnetClient.prototype.handleDontCommand = function(evt) {
|
||||||
console.log('dont ' + JSON.stringify(evt));
|
this.log.trace(evt, 'dont');
|
||||||
};
|
};
|
||||||
|
|
||||||
TelnetClient.prototype.setTermType = function(ttype) {
|
TelnetClient.prototype.setTermType = function(ttype) {
|
||||||
this.term.env.TERM = ttype;
|
this.term.env.TERM = ttype;
|
||||||
this.term.termType = ttype;
|
this.term.termType = ttype;
|
||||||
|
|
||||||
Log.debug( { termType : ttype }, 'Set terminal type');
|
this.log.debug( { termType : ttype }, 'Set terminal type');
|
||||||
};
|
};
|
||||||
|
|
||||||
TelnetClient.prototype.handleSbCommand = function(evt) {
|
TelnetClient.prototype.handleSbCommand = function(evt) {
|
||||||
|
@ -592,22 +593,22 @@ TelnetClient.prototype.handleSbCommand = function(evt) {
|
||||||
self.setTermType(evt.envVars[name]);
|
self.setTermType(evt.envVars[name]);
|
||||||
} else if('COLUMNS' === name && 0 === self.term.termWidth) {
|
} else if('COLUMNS' === name && 0 === self.term.termWidth) {
|
||||||
self.term.termWidth = parseInt(evt.envVars[name]);
|
self.term.termWidth = parseInt(evt.envVars[name]);
|
||||||
Log.debug({ termWidth : self.term.termWidth, source : 'NEW-ENVIRON'}, 'Window width updated');
|
self.log.debug({ termWidth : self.term.termWidth, source : 'NEW-ENVIRON'}, 'Window width updated');
|
||||||
} else if('ROWS' === name && 0 === self.term.termHeight) {
|
} else if('ROWS' === name && 0 === self.term.termHeight) {
|
||||||
self.term.termHeight = parseInt(evt.envVars[name]);
|
self.term.termHeight = parseInt(evt.envVars[name]);
|
||||||
Log.debug({ termHeight : self.term.termHeight, source : 'NEW-ENVIRON'}, 'Window height updated');
|
self.log.debug({ termHeight : self.term.termHeight, source : 'NEW-ENVIRON'}, 'Window height updated');
|
||||||
} else {
|
} else {
|
||||||
if(name in self.term.env) {
|
if(name in self.term.env) {
|
||||||
assert(
|
assert(
|
||||||
SB_COMMANDS.INFO === evt.type || SB_COMMANDS.IS === evt.type,
|
SB_COMMANDS.INFO === evt.type || SB_COMMANDS.IS === evt.type,
|
||||||
'Unexpected type: ' + evt.type);
|
'Unexpected type: ' + evt.type);
|
||||||
|
|
||||||
Log.warn(
|
self.log.warn(
|
||||||
{ varName : name, value : evt.envVars[name], existingValue : self.term.env[name] },
|
{ varName : name, value : evt.envVars[name], existingValue : self.term.env[name] },
|
||||||
'Environment variable already exists');
|
'Environment variable already exists');
|
||||||
} else {
|
} else {
|
||||||
self.term.env[name] = evt.envVars[name];
|
self.term.env[name] = evt.envVars[name];
|
||||||
Log.debug(
|
self.log.debug(
|
||||||
{ varName : name, value : evt.envVars[name] }, 'New environment variable');
|
{ varName : name, value : evt.envVars[name] }, 'New environment variable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -629,9 +630,9 @@ TelnetClient.prototype.handleSbCommand = function(evt) {
|
||||||
self.term.env.ROWS = evt.height;
|
self.term.env.ROWS = evt.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.debug({ termWidth : evt.width , termHeight : evt.height, source : 'NAWS' }, 'Window size updated');
|
self.log.debug({ termWidth : evt.width , termHeight : evt.height, source : 'NAWS' }, 'Window size updated');
|
||||||
} else {
|
} else {
|
||||||
console.log('unhandled SB: ' + JSON.stringify(evt));
|
self.log(evt, 'SB');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -650,15 +651,17 @@ TelnetClient.prototype.handleMiscCommand = function(evt) {
|
||||||
//
|
//
|
||||||
if('ip' === evt.command) {
|
if('ip' === evt.command) {
|
||||||
// Interrupt Process (IP)
|
// Interrupt Process (IP)
|
||||||
Log.debug('Interrupt Process (IP) - Ending');
|
this.log.debug('Interrupt Process (IP) - Ending');
|
||||||
|
|
||||||
this.input.end();
|
this.input.end();
|
||||||
} else if('ayt' === evt.command) {
|
} else if('ayt' === evt.command) {
|
||||||
this.output.write('\b');
|
this.output.write('\b');
|
||||||
Log.debug('Are You There (AYT) - Replied "\\b"');
|
|
||||||
|
this.log.debug('Are You There (AYT) - Replied "\\b"');
|
||||||
} else if(IGNORED_COMMANDS.indexOf(evt.commandCode)) {
|
} else if(IGNORED_COMMANDS.indexOf(evt.commandCode)) {
|
||||||
Log.debug({ evt : evt }, 'Ignoring command');
|
this.log.debug({ evt : evt }, 'Ignoring command');
|
||||||
} else {
|
} else {
|
||||||
Log.warn({ evt : evt }, 'Unknown command');
|
this.log.warn({ evt : evt }, 'Unknown command');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -683,7 +686,7 @@ var WANTED_ENVIRONMENT_VAR_BUFS = [
|
||||||
TelnetClient.prototype.requestNewEnvironment = function() {
|
TelnetClient.prototype.requestNewEnvironment = function() {
|
||||||
|
|
||||||
if(this.subNegotiationState.newEnvironRequested) {
|
if(this.subNegotiationState.newEnvironRequested) {
|
||||||
Log.debug('New environment already requested');
|
this.log.debug('New environment already requested');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,47 +50,50 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
"menus" : {
|
menus: {
|
||||||
"connected" : {
|
connected: {
|
||||||
"art" : "CONNECT",
|
art: CONNECT
|
||||||
"next" : "matrix",
|
next: matrix
|
||||||
"options" : {
|
options: {
|
||||||
"nextTimeout" : 1500
|
nextTimeout: 1500
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"matrix" : {
|
|
||||||
"art" : "matrix",
|
matrix: {
|
||||||
"form" : {
|
art: matrix
|
||||||
"0" : { // :TODO: Make form "0" the default if missing (e.g. optional)... not sure how with current structure though
|
form: {
|
||||||
"VM" : {
|
0: { // :TODO: Make form "0" the default if missing (e.g. optional)... not sure how with current structure though
|
||||||
"mci" : {
|
VM: {
|
||||||
"VM1" : {
|
mci: {
|
||||||
"submit" : true,
|
VM1: {
|
||||||
"focus" : true,
|
submit: true
|
||||||
|
focus: true
|
||||||
// :TODO: need a good way to localize these ... Standard Orig->Lookup seems good.
|
// :TODO: need a good way to localize these ... Standard Orig->Lookup seems good.
|
||||||
"items" : [ "Login", "Apply", "Log Off" ]//,
|
items: [ "Login", "Apply", "Log Off" ]
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"submit" : {
|
|
||||||
"*" : [
|
submit: {
|
||||||
|
*: [
|
||||||
{
|
{
|
||||||
"value" : { "1" : 0 },
|
value: { 1: 0 }
|
||||||
"action" : "@menu:login2"
|
action: @menu:login2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"value" : { "1" : 1 },
|
value: { 1: 1 },
|
||||||
"action" : "@menu:apply"
|
action: @menu:apply
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"value" : { "1" : 2 },
|
value: { 1: 2 },
|
||||||
"action" : "@menu:logoff"
|
action: @menu:logoff
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
"login" : {
|
"login" : {
|
||||||
"prompt" : "userLoginCredentials",
|
"prompt" : "userLoginCredentials",
|
||||||
"fallback" : "matrix",
|
"fallback" : "matrix",
|
||||||
|
@ -110,7 +113,8 @@
|
||||||
"login2" : {
|
"login2" : {
|
||||||
"art" : "USRCRED",
|
"art" : "USRCRED",
|
||||||
"fallback" : "matrix",
|
"fallback" : "matrix",
|
||||||
"next" : "fullLoginSequenceLoginArt",
|
next: messageArea
|
||||||
|
//"next" : "fullLoginSequenceLoginArt",
|
||||||
"form" : {
|
"form" : {
|
||||||
"0" : {
|
"0" : {
|
||||||
"mci" : {
|
"mci" : {
|
||||||
|
@ -431,7 +435,7 @@
|
||||||
art: {
|
art: {
|
||||||
header: MSGVHDR
|
header: MSGVHDR
|
||||||
// :TODO: fix these!!
|
// :TODO: fix these!!
|
||||||
body: demo_fse_netmail_body.ans
|
body: MSGBODY
|
||||||
footerEdit: demo_fse_netmail_footer_edit.ans
|
footerEdit: demo_fse_netmail_footer_edit.ans
|
||||||
footerEditMenu: demo_fse_netmail_footer_edit_menu.ans
|
footerEditMenu: demo_fse_netmail_footer_edit_menu.ans
|
||||||
footerView: MSGVFTR
|
footerView: MSGVFTR
|
||||||
|
@ -464,7 +468,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"1" : {
|
"1" : {
|
||||||
"MT" : {
|
|
||||||
"mci" : {
|
"mci" : {
|
||||||
"MT1" : {
|
"MT1" : {
|
||||||
"width" : 79,
|
"width" : 79,
|
||||||
|
@ -486,7 +489,6 @@
|
||||||
"viewId" : 1
|
"viewId" : 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"2" : {
|
"2" : {
|
||||||
"TLTL" : {
|
"TLTL" : {
|
||||||
|
@ -559,7 +561,7 @@
|
||||||
config: {
|
config: {
|
||||||
art: {
|
art: {
|
||||||
header: MSGEHDR
|
header: MSGEHDR
|
||||||
body: demo_fse_netmail_body.ans
|
body: MSGBODY
|
||||||
footerEditor: MSGEFTR
|
footerEditor: MSGEFTR
|
||||||
footerEditorMenu: MSGEMFT
|
footerEditorMenu: MSGEMFT
|
||||||
footerView: demo_fse_netmail_footer_view.ans
|
footerView: demo_fse_netmail_footer_view.ans
|
||||||
|
@ -601,21 +603,17 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"1" : {
|
"1" : {
|
||||||
"MT" : {
|
|
||||||
"mci" : {
|
"mci" : {
|
||||||
"MT1" : {
|
MT1: {
|
||||||
"width" : 79,
|
width: 79
|
||||||
"height" : 17,
|
height: 12
|
||||||
"argName" : "message"
|
argName: message
|
||||||
|
mode: edit
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"submit" : {
|
|
||||||
"*" : [
|
|
||||||
{
|
|
||||||
"value" : "message",
|
|
||||||
"action" : "@method:editModeEscPressed"
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
submit: {
|
||||||
|
*: [ { "value": "message", "action": "@method:editModeEscPressed" } ]
|
||||||
},
|
},
|
||||||
"actionKeys" : [
|
"actionKeys" : [
|
||||||
{
|
{
|
||||||
|
@ -623,7 +621,6 @@
|
||||||
"viewId" : 1
|
"viewId" : 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"2" : {
|
"2" : {
|
||||||
"TLTL" : {
|
"TLTL" : {
|
||||||
|
@ -718,9 +715,9 @@
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Mods
|
// Mods
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
"idleLogoff" : {
|
idleLogoff: {
|
||||||
"art" : "IDLELOG",
|
art: IDLELOG
|
||||||
"action" : "@systemMethod:logoff"
|
next: @systemMethod:logoff
|
||||||
},
|
},
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Mods
|
// Mods
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue