Merge branch 'msg_network' of ssh://numinibsd/git/base/enigma-bbs into msg_network
This commit is contained in:
@@ -200,7 +200,13 @@ function startListening(cb) {
|
||||
}
|
||||
|
||||
const moduleInst = new module.getModule();
|
||||
const server = moduleInst.createServer();
|
||||
let server;
|
||||
try {
|
||||
server = moduleInst.createServer();
|
||||
} catch(e) {
|
||||
logger.log.warn(e, 'Exception caught creating server!');
|
||||
return;
|
||||
}
|
||||
|
||||
// :TODO: handle maxConnections, e.g. conf.maxConnections
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ function getDefaultConfig() {
|
||||
},
|
||||
ssh : {
|
||||
port : 8889,
|
||||
enabled : true,
|
||||
enabled : false, // defualt to false as PK/pass in config.hjson are required
|
||||
|
||||
//
|
||||
// Private key in PEM format
|
||||
|
||||
@@ -169,8 +169,10 @@ exports.PacketHeader = PacketHeader;
|
||||
// * Writeup on differences between type 2, 2.2, and 2+:
|
||||
// http://walon.org/pub/fidonet/FTSC-nodelists-etc./pkt-types.txt
|
||||
//
|
||||
function Packet() {
|
||||
function Packet(options) {
|
||||
var self = this;
|
||||
|
||||
this.options = options || {};
|
||||
|
||||
this.parsePacketHeader = function(packetBuffer, cb) {
|
||||
assert(Buffer.isBuffer(packetBuffer));
|
||||
@@ -574,6 +576,10 @@ function Packet() {
|
||||
|
||||
if(messageBodyData.tearLine) {
|
||||
msg.meta.FtnProperty.ftn_tear_line = messageBodyData.tearLine;
|
||||
|
||||
if(self.options.keepTearAndOrigin) {
|
||||
msg.message += `\r\n${messageBodyData.tearLine}\r\n`;
|
||||
}
|
||||
}
|
||||
|
||||
if(messageBodyData.seenBy.length > 0) {
|
||||
@@ -586,6 +592,10 @@ function Packet() {
|
||||
|
||||
if(messageBodyData.originLine) {
|
||||
msg.meta.FtnProperty.ftn_origin = messageBodyData.originLine;
|
||||
|
||||
if(self.options.keepTearAndOrigin) {
|
||||
msg.message += `${messageBodyData.originLine}\r\n`;
|
||||
}
|
||||
}
|
||||
|
||||
const nextBuf = packetBuffer.slice(read);
|
||||
|
||||
@@ -69,6 +69,8 @@ function getSortedAvailMessageConferences(client, options) {
|
||||
// Return an *object* of available areas within |confTag|
|
||||
function getAvailableMessageAreasByConfTag(confTag, options) {
|
||||
options = options || {};
|
||||
|
||||
// :TODO: confTag === "" then find default
|
||||
|
||||
if(_.has(Config.messageConferences, [ confTag, 'areas' ])) {
|
||||
const areas = Config.messageConferences[confTag].areas;
|
||||
|
||||
@@ -266,24 +266,21 @@ function MultiLineEditTextView(options) {
|
||||
}
|
||||
return lines;
|
||||
};
|
||||
|
||||
this.getOutputText = function(startIndex, endIndex, includeEol) {
|
||||
var lines = self.getTextLines(startIndex, endIndex);
|
||||
|
||||
//
|
||||
// Convert lines to contiguous string -- all expanded
|
||||
// tabs put back to single '\t' characters.
|
||||
//
|
||||
var text = '';
|
||||
var re = new RegExp('\\t{1,' + (self.tabWidth) + '}', 'g');
|
||||
for(var i = 0; i < lines.length; ++i) {
|
||||
text += lines[i].text.replace(re, '\t');
|
||||
if(includeEol && lines[i].eol) {
|
||||
text += '\n';
|
||||
}
|
||||
}
|
||||
return text;
|
||||
};
|
||||
|
||||
this.getOutputText = function(startIndex, endIndex, eolMarker) {
|
||||
let lines = self.getTextLines(startIndex, endIndex);
|
||||
let text = '';
|
||||
var re = new RegExp('\\t{1,' + (self.tabWidth) + '}', 'g');
|
||||
|
||||
lines.forEach(line => {
|
||||
text += line.text.replace(re, '\t');
|
||||
if(eolMarker && line.eol) {
|
||||
text += eolMarker;
|
||||
}
|
||||
});
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
this.getContiguousText = function(startIndex, endIndex, includeEol) {
|
||||
var lines = self.getTextLines(startIndex, endIndex);
|
||||
@@ -1018,7 +1015,7 @@ MultiLineEditTextView.prototype.addText = function(text) {
|
||||
};
|
||||
|
||||
MultiLineEditTextView.prototype.getData = function() {
|
||||
return this.getOutputText(0, this.textLines.length, true);
|
||||
return this.getOutputText(0, this.textLines.length, '\r\n');
|
||||
};
|
||||
|
||||
MultiLineEditTextView.prototype.setPropertyValue = function(propName, value) {
|
||||
|
||||
@@ -806,7 +806,9 @@ function FTNMessageScanTossModule() {
|
||||
this.importMessagesFromPacketFile = function(packetPath, password, cb) {
|
||||
let packetHeader;
|
||||
|
||||
new ftnMailPacket.Packet().read(packetPath, (entryType, entryData, next) => {
|
||||
const packetOpts = { keepTearAndOrigin : true };
|
||||
|
||||
new ftnMailPacket.Packet(packetOpts).read(packetPath, (entryType, entryData, next) => {
|
||||
if('header' === entryType) {
|
||||
packetHeader = entryData;
|
||||
|
||||
|
||||
@@ -235,7 +235,8 @@ SSHServerModule.prototype.createServer = function() {
|
||||
privateKey : fs.readFileSync(Config.servers.ssh.privateKeyPem),
|
||||
passphrase : Config.servers.ssh.privateKeyPass,
|
||||
ident : 'enigma-bbs-' + enigVersion + '-srv',
|
||||
// Note that sending 'banner' breaks at least EtherTerm!
|
||||
|
||||
// Note that sending 'banner' breaks at least EtherTerm!
|
||||
debug : function debugSsh(dbgLine) {
|
||||
if(true === Config.servers.ssh.traceConnections) {
|
||||
Log.trace('SSH: ' + dbgLine);
|
||||
|
||||
Reference in New Issue
Block a user