Fix config

This commit is contained in:
Bryan Ashby 2018-07-17 21:06:27 -06:00
parent 118cb97487
commit 58254ee27b
1 changed files with 8 additions and 12 deletions

View File

@ -24,8 +24,8 @@ exports.getModule = class ArchaicNETModule extends MenuModule {
// establish defaults // establish defaults
this.config = options.menuConfig.config; this.config = options.menuConfig.config;
this.config.host = this.config.host || 'bbs.archaicbinary.net'; this.config.host = this.config.host || 'bbs.archaicbinary.net';
this.config.sshPort = this.config.sshPort || 8513; this.config.sshPort = this.config.sshPort || 2222;
this.config.rloginPort = this.config.rloginPort || 2222; this.config.rloginPort = this.config.rloginPort || 8513;
} }
initSequence() { initSequence() {
@ -49,15 +49,12 @@ exports.getModule = class ArchaicNETModule extends MenuModule {
const sshClient = new SSHClient(); const sshClient = new SSHClient();
let pipeRestored = false; let needRestore = false;
let pipedStream; //let pipedStream;
const restorePipe = function() { const restorePipe = function() {
if(!pipeRestored) { if(needRestore && !clientTerminated) {
if(pipedStream && !clientTerminated) {
self.client.term.output.unpipe(pipedStream);
self.client.term.output.resume();
}
self.client.restoreDataHandler(); self.client.restoreDataHandler();
needRestore = false;
} }
}; };
@ -82,14 +79,12 @@ exports.getModule = class ArchaicNETModule extends MenuModule {
const rlogin = `\x00${self.client.user.username}\x00[${self.config.bbsTag}]${self.client.user.username}\x00${self.client.term.termType}\x00`; const rlogin = `\x00${self.client.user.username}\x00[${self.config.bbsTag}]${self.client.user.username}\x00${self.client.term.termType}\x00`;
stream.write(rlogin); stream.write(rlogin);
pipedStream = stream;
self.client.term.output.pipe(stream);
// we need to filter I/O for escape/de-escaping zmodem and the like // we need to filter I/O for escape/de-escaping zmodem and the like
self.client.setTemporaryDirectDataHandler(data => { self.client.setTemporaryDirectDataHandler(data => {
const tmp = data.toString('binary').replace(/\xff{2}/g, '\xff'); // de-escape const tmp = data.toString('binary').replace(/\xff{2}/g, '\xff'); // de-escape
stream.write(Buffer.from(tmp, 'binary')); stream.write(Buffer.from(tmp, 'binary'));
}); });
needRestore = true;
stream.on('data', data => { stream.on('data', data => {
const tmp = data.toString('binary').replace(/\xff/g, '\xff\xff'); // escape const tmp = data.toString('binary').replace(/\xff/g, '\xff\xff'); // escape
@ -115,6 +110,7 @@ exports.getModule = class ArchaicNETModule extends MenuModule {
return callback(null); return callback(null);
}); });
self.client.log.trace( { host : self.config.host, port : self.config.sshPort }, 'Connecting to ArchaicNET');
sshClient.connect( { sshClient.connect( {
host : self.config.host, host : self.config.host,
port : self.config.sshPort, port : self.config.sshPort,