Initial support for non-blind aka non-batch uploads

This commit is contained in:
Bryan Ashby 2017-01-31 23:10:17 -07:00
parent f65ef7b79e
commit 8261881e3e
5 changed files with 123 additions and 60 deletions

View file

@ -36,8 +36,6 @@ exports.getModule = class FileTransferProtocolSelectModule extends MenuModule {
this.config.direction = this.config.direction || 'send';
this.loadAvailProtocols();
this.extraArgs = options.extraArgs;
if(_.has(options, 'lastMenuResult.sentFileIds')) {
@ -50,6 +48,8 @@ exports.getModule = class FileTransferProtocolSelectModule extends MenuModule {
this.fallbackOnly = options.lastMenuResult ? true : false;
this.loadAvailProtocols();
this.menuMethods = {
selectProtocol : (formData, extraArgs, cb) => {
const protocol = this.protocols[formData.value.protocol];
@ -130,12 +130,21 @@ exports.getModule = class FileTransferProtocolSelectModule extends MenuModule {
loadAvailProtocols() {
this.protocols = _.map(Config.fileTransferProtocols, (protInfo, protocol) => {
return {
return {
protocol : protocol,
name : protInfo.name,
hasBatch : _.has(protInfo, 'external.recvArgs'),
hasNonBatch : _.has(protInfo, 'external.recvArgsNonBatch'),
};
});
// Filter out batch vs non-batch only protocols
if(this.extraArgs.recvFileName) { // non-batch aka non-blind
this.protocols = this.protocols.filter( prot => prot.hasNonBatch );
} else {
this.protocols = this.protocols.filter( prot => prot.hasBatch );
}
this.protocols.sort( (a, b) => a.name.localeCompare(b.name) );
}
};