* SEXYZ: XModem & YModem

* Explicit sort avail to protocols
* MenuView.removeItem()
* Natural sort for more things
* Fix some issues with HorizontalMenuView redraw/update
* Sanatize non-blind upload filename (security)
* Validator on non-blind upload filename
This commit is contained in:
Bryan Ashby
2017-02-01 19:42:27 -07:00
parent 8261881e3e
commit ff64a7aed5
10 changed files with 161 additions and 45 deletions

View File

@@ -364,9 +364,48 @@ function getDefaultConfig() {
},
fileTransferProtocols : {
zmodem8kSexyz : {
name : 'ZModem 8k (SEXYZ)',
type : 'external',
sort : 1,
external : {
// :TODO: Look into shipping sexyz binaries or at least hosting them somewhere for common systems
sendCmd : 'sexyz',
sendArgs : [ '-telnet', '-8', 'sz', '@{fileListPath}' ],
recvCmd : 'sexyz',
recvArgs : [ '-telnet', '-8', 'rz', '{uploadDir}' ],
recvArgsNonBatch : [ '-telnet', '-8', 'rz', '{fileName}' ],
}
},
xmodemSexyz : {
name : 'XModem (SEXYZ)',
type : 'external',
sort : 3,
external : {
sendCmd : 'sexyz',
sendArgs : [ '-telnet', 'sX', '@{fileListPath}' ],
recvCmd : 'sexyz',
recvArgsNonBatch : [ '-telnet', 'rC', '{fileName}' ]
}
},
ymodemSexyz : {
name : 'YModem (SEXYZ)',
type : 'external',
sort : 4,
external : {
sendCmd : 'sexyz',
sendArgs : [ '-telnet', 'sY', '@{fileListPath}' ],
recvCmd : 'sexyz',
recvArgs : [ '-telnet', 'ry', '{uploadDir}' ],
}
},
zmodem8kSz : {
name : 'ZModem 8k',
type : 'external',
sort : 2,
external : {
sendCmd : 'sz', // Avail on Debian/Ubuntu based systems as the package "lrzsz"
sendArgs : [
@@ -380,28 +419,7 @@ function getDefaultConfig() {
// :TODO: can we not just use --escape ?
escapeTelnet : true, // set to true to escape Telnet codes such as IAC
}
},
zmodem8kSexyz : {
name : 'ZModem 8k (SEXYZ)',
type : 'external',
external : {
// :TODO: Look into shipping sexyz binaries or at least hosting them somewhere for common systems
sendCmd : 'sexyz',
sendArgs : [
'-telnet', '-8', 'sz', '@{fileListPath}'
],
recvCmd : 'sexyz',
recvArgs : [
'-telnet', '-8', 'rz', '{uploadDir}'
],
recvArgsNonBatch : [
'-telnet', '-8', 'rz', '{fileName}'
],
escapeTelnet : false, // -telnet option does this for us
}
}
},
messageAreaDefaults : {

View File

@@ -77,6 +77,20 @@ MenuView.prototype.setItems = function(items) {
}
};
MenuView.prototype.removeItem = function(index) {
this.items.splice(index, 1);
if(this.focusItems) {
this.focusItems.splice(index, 1);
}
if(this.focusedItemIndex >= index) {
this.focusedItemIndex = Math.max(this.focusedItemIndex - 1, 0);
}
this.positionCacheExpired = true;
};
MenuView.prototype.getCount = function() {
return this.items.length;
};

View File

@@ -79,7 +79,7 @@ exports.getModule = class NewScanModule extends MenuModule {
if('system_internal' === a.confTag) {
return -1;
} else {
return a.conf.name.localeCompare(b.conf.name);
return a.conf.name.localeCompare(b.conf.name, { sensitivity : false, numeric : true } );
}
});

View File

@@ -195,12 +195,14 @@ function getPredefinedMCIValue(client, code) {
// :TODO: System stat log for total ul/dl, total ul/dl bytes
// :TODO: PT - Messages posted *today* (Obv/2)
// -> Include FTN/etc.
// :TODO: NT - New users today (Obv/2)
// :TODO: CT - Calls *today* (Obv/2)
// :TODO: TF - Total files on the system (Obv/2)
// :TODO: FT - Files uploaded/added *today* (Obv/2)
// :TODO: DD - Files downloaded *today* (iNiQUiTY)
// :TODO: TP - total message/posts on the system (Obv/2)
// -> Include FTN/etc.
// :TODO: LC - name of last caller to system (Obv/2)
// :TODO: TZ - Average *system* post/call ratio (iNiQUiTY)

View File

@@ -44,7 +44,7 @@ function VerticalMenuView(options) {
self.viewWindow = {
top : self.focusedItemIndex,
bottom : Math.min(self.focusedItemIndex + self.maxVisibleItems, self.items.length) - 1
bottom : Math.min(self.focusedItemIndex + self.maxVisibleItems, self.items.length) - 1,
};
};
@@ -107,12 +107,14 @@ VerticalMenuView.prototype.redraw = function() {
delete this.oldDimens;
}
let row = this.position.row;
for(let i = this.viewWindow.top; i <= this.viewWindow.bottom; ++i) {
this.items[i].row = row;
row += this.itemSpacing + 1;
this.items[i].focused = this.focusedItemIndex === i;
this.drawItem(i);
if(this.items.length) {
let row = this.position.row;
for(let i = this.viewWindow.top; i <= this.viewWindow.bottom; ++i) {
this.items[i].row = row;
row += this.itemSpacing + 1;
this.items[i].focused = this.focusedItemIndex === i;
this.drawItem(i);
}
}
};
@@ -171,7 +173,7 @@ VerticalMenuView.prototype.getData = function() {
VerticalMenuView.prototype.setItems = function(items) {
// if we have items already, save off their drawing area so we don't leave fragments at redraw
if(this.items && this.items.length) {
this.oldDimens = this.dimens;
this.oldDimens = Object.assign({}, this.dimens);
}
VerticalMenuView.super_.prototype.setItems.call(this, items);
@@ -179,6 +181,14 @@ VerticalMenuView.prototype.setItems = function(items) {
this.positionCacheExpired = true;
};
VerticalMenuView.prototype.removeItem = function(index) {
if(this.items && this.items.length) {
this.oldDimens = Object.assign({}, this.dimens);
}
VerticalMenuView.super_.prototype.removeItem.call(this, index);
};
// :TODO: Apply draw optimizaitons when only two items need drawn vs entire view!
VerticalMenuView.prototype.focusNext = function() {

View File

@@ -454,7 +454,7 @@ ViewController.prototype.resetInitialFocus = function() {
if(this.formInitialFocusId) {
return this.switchFocus(this.formInitialFocusId);
}
}
};
ViewController.prototype.switchFocus = function(id) {
//
@@ -480,15 +480,19 @@ ViewController.prototype.switchFocus = function(id) {
};
ViewController.prototype.nextFocus = function() {
var nextId;
let nextFocusView = this.focusedView ? this.focusedView : this.views[this.firstId];
if(!this.focusedView) {
nextId = this.views[this.firstId].id;
} else {
nextId = this.views[this.focusedView.id].nextId;
// find the next view that accepts focus
while(nextFocusView && nextFocusView.nextId) {
nextFocusView = this.getView(nextFocusView.nextId);
if(!nextFocusView || nextFocusView.acceptsFocus) {
break;
}
}
this.switchFocus(nextId);
if(nextFocusView && this.focusedView !== nextFocusView) {
this.switchFocus(nextFocusView.id);
}
};
ViewController.prototype.setViewOrder = function(order) {
@@ -507,7 +511,6 @@ ViewController.prototype.setViewOrder = function(order) {
}
if(viewIdOrder.length > 0) {
var view;
var count = viewIdOrder.length - 1;
for(var i = 0; i < count; ++i) {
this.views[viewIdOrder[i]].nextId = viewIdOrder[i + 1];