2014-10-17 02:21:06 +00:00
/* jslint node: true */
'use strict' ;
2017-01-28 19:33:06 +00:00
// ENiGMA½
2014-10-17 02:21:06 +00:00
2017-01-28 19:33:06 +00:00
// deps
2017-05-20 03:20:19 +00:00
const fs = require ( 'graceful-fs' ) ;
2017-01-28 19:33:06 +00:00
const paths = require ( 'path' ) ;
const async = require ( 'async' ) ;
const _ = require ( 'lodash' ) ;
const hjson = require ( 'hjson' ) ;
const assert = require ( 'assert' ) ;
2015-04-17 04:29:53 +00:00
2017-01-28 19:33:06 +00:00
exports . init = init ;
exports . getDefaultPath = getDefaultPath ;
2015-04-19 08:13:13 +00:00
2016-02-03 04:35:59 +00:00
function hasMessageConferenceAndArea ( config ) {
2016-09-20 03:28:21 +00:00
assert ( _ . isObject ( config . messageConferences ) ) ; // we create one ourself!
const nonInternalConfs = Object . keys ( config . messageConferences ) . filter ( confTag => {
2018-01-01 00:54:11 +00:00
return 'system_internal' !== confTag ;
2016-09-20 03:28:21 +00:00
} ) ;
if ( 0 === nonInternalConfs . length ) {
return false ;
}
// :TODO: there is likely a better/cleaner way of doing this
let result = false ;
_ . forEach ( nonInternalConfs , confTag => {
if ( _ . has ( config . messageConferences [ confTag ] , 'areas' ) &&
Object . keys ( config . messageConferences [ confTag ] . areas ) > 0 )
2018-01-01 01:45:39 +00:00
{
2016-09-20 03:28:21 +00:00
result = true ;
return false ; // stop iteration
}
} ) ;
return result ;
2016-02-03 04:35:59 +00:00
}
2017-02-20 18:31:24 +00:00
function init ( configPath , options , cb ) {
if ( ! cb && _ . isFunction ( options ) ) {
cb = options ;
options = { } ;
}
2015-04-19 08:13:13 +00:00
async . waterfall (
[
function loadUserConfig ( callback ) {
2017-01-28 19:33:06 +00:00
if ( ! _ . isString ( configPath ) ) {
return callback ( null , { } ) ;
2015-11-21 06:46:48 +00:00
}
2018-01-01 00:54:11 +00:00
2017-01-28 19:33:06 +00:00
fs . readFile ( configPath , { encoding : 'utf8' } , ( err , configData ) => {
if ( err ) {
return callback ( err ) ;
}
2018-01-01 00:54:11 +00:00
2017-01-28 19:33:06 +00:00
let configJson ;
try {
2017-02-20 18:31:24 +00:00
configJson = hjson . parse ( configData , options ) ;
2017-01-28 19:33:06 +00:00
} catch ( e ) {
return callback ( e ) ;
}
return callback ( null , configJson ) ;
2018-01-01 01:45:39 +00:00
} ) ;
2015-04-19 08:13:13 +00:00
} ,
2015-08-06 04:22:17 +00:00
function mergeWithDefaultConfig ( configJson , callback ) {
2018-01-01 00:54:11 +00:00
2017-01-28 19:33:06 +00:00
const mergedConfig = _ . mergeWith (
2018-01-01 01:45:39 +00:00
getDefaultConfig ( ) ,
2017-01-28 19:33:06 +00:00
configJson , ( conf1 , conf2 ) => {
// Arrays should always concat
if ( _ . isArray ( conf1 ) ) {
// :TODO: look for collisions & override dupes
return conf1 . concat ( conf2 ) ;
}
2015-08-20 22:35:04 +00:00
}
2017-01-28 19:33:06 +00:00
) ;
2015-08-20 22:35:04 +00:00
2017-01-28 19:33:06 +00:00
return callback ( null , mergedConfig ) ;
2015-11-21 06:46:48 +00:00
} ,
function validate ( mergedConfig , callback ) {
//
// Various sections must now exist in config
//
2017-01-28 19:33:06 +00:00
// :TODO: Logic is broken here:
2016-09-20 03:28:21 +00:00
if ( hasMessageConferenceAndArea ( mergedConfig ) ) {
var msgAreasErr = new Error ( 'Please create at least one message conference and area!' ) ;
2015-11-21 06:46:48 +00:00
msgAreasErr . code = 'EBADCONFIG' ;
2016-09-20 03:28:21 +00:00
return callback ( msgAreasErr ) ;
} else {
return callback ( null , mergedConfig ) ;
}
2015-04-19 08:13:13 +00:00
}
] ,
function complete ( err , mergedConfig ) {
exports . config = mergedConfig ;
2017-06-12 02:23:12 +00:00
exports . config . get = function ( path ) {
return _ . get ( exports . config , path ) ;
} ;
2016-09-20 03:28:21 +00:00
return cb ( err ) ;
2014-10-17 02:21:06 +00:00
}
2015-04-19 08:13:13 +00:00
) ;
}
2014-10-17 02:21:06 +00:00
2015-04-19 08:13:13 +00:00
function getDefaultPath ( ) {
2017-11-25 22:45:19 +00:00
// e.g. /enigma-bbs-install-path/config/
return './config/' ;
2015-04-19 08:13:13 +00:00
}
2014-10-17 02:21:06 +00:00
2015-04-19 08:13:13 +00:00
function getDefaultConfig ( ) {
return {
general : {
2015-08-03 00:27:05 +00:00
boardName : 'Another Fine ENiGMA½ BBS' ,
2015-10-22 04:51:35 +00:00
2015-10-28 03:12:55 +00:00
closedSystem : false , // is the system closed to new users?
2015-10-22 18:22:03 +00:00
2015-10-22 04:51:35 +00:00
loginAttempts : 3 ,
2015-12-11 20:58:58 +00:00
2017-11-26 09:09:11 +00:00
menuFile : 'menu.hjson' , // Override to use something else, e.g. demo.hjson. Can be a full path (defaults to ./config)
promptFile : 'prompt.hjson' , // Override to use soemthing else, e.g. myprompt.hjson. Can be a full path (defaults to ./config)
2015-04-19 08:13:13 +00:00
} ,
2014-10-17 02:21:06 +00:00
2015-12-11 20:58:58 +00:00
// :TODO: see notes below about 'theme' section - move this!
2015-12-13 23:47:28 +00:00
preLoginTheme : 'luciano_blocktronics' ,
2014-10-17 02:21:06 +00:00
2015-04-19 08:13:13 +00:00
users : {
usernameMin : 2 ,
2015-06-25 04:45:21 +00:00
usernameMax : 16 , // Note that FidoNet wants 36 max
2016-09-02 05:39:49 +00:00
usernamePattern : '^[A-Za-z0-9~!@#$%^&*()\\-\\_+ ]+$' ,
2015-12-24 18:51:49 +00:00
2015-04-19 08:13:13 +00:00
passwordMin : 6 ,
2015-04-27 02:46:16 +00:00
passwordMax : 128 ,
2017-03-15 02:21:23 +00:00
badPassFile : paths . join ( _ _dirname , '../misc/10_million_password_list_top_10000.txt' ) , // https://github.com/danielmiessler/SecLists
2015-12-24 18:51:49 +00:00
realNameMax : 32 ,
locationMax : 32 ,
affilsMax : 32 ,
emailMax : 255 ,
webMax : 255 ,
2016-07-15 03:30:02 +00:00
requireActivation : false , // require SysOp activation? false = auto-activate
2015-08-21 04:29:16 +00:00
groups : [ 'users' , 'sysops' ] , // built in groups
2015-10-22 17:04:50 +00:00
defaultGroups : [ 'users' ] , // default groups new users belong to
newUserNames : [ 'new' , 'apply' ] , // Names reserved for applying
2015-10-28 03:12:55 +00:00
2018-01-01 01:45:39 +00:00
badUserNames : [
2017-09-22 03:23:30 +00:00
'sysop' , 'admin' , 'administrator' , 'root' , 'all' ,
'areamgr' , 'filemgr' , 'filefix' , 'areafix' , 'allfix'
] ,
2015-04-19 08:13:13 +00:00
} ,
2015-04-17 04:29:53 +00:00
2015-09-09 04:08:45 +00:00
// :TODO: better name for "defaults"... which is redundant here!
/ *
Concept
"theme" : {
"default" : "defaultThemeName" , // or "*"
"preLogin" : "*" ,
"passwordChar" : "*" ,
...
}
* /
2015-04-19 08:13:13 +00:00
defaults : {
2015-09-28 04:05:40 +00:00
theme : 'luciano_blocktronics' ,
2015-04-19 08:13:13 +00:00
passwordChar : '*' , // TODO: move to user ?
2015-07-24 04:23:44 +00:00
dateFormat : {
2015-07-23 03:35:35 +00:00
short : 'MM/DD/YYYY' ,
2015-07-24 04:23:44 +00:00
} ,
timeFormat : {
2015-07-25 22:10:12 +00:00
short : 'h:mm a' ,
2015-09-02 04:42:54 +00:00
} ,
dateTimeFormat : {
short : 'MM/DD/YYYY h:mm a' ,
2015-07-23 03:35:35 +00:00
}
2015-04-19 08:13:13 +00:00
} ,
2015-04-15 04:27:07 +00:00
2015-09-09 04:08:45 +00:00
menus : {
cls : true , // Clear screen before each menu by default?
2018-01-01 01:45:39 +00:00
} ,
2015-05-14 04:21:55 +00:00
2015-04-19 08:13:13 +00:00
paths : {
2017-11-22 23:27:33 +00:00
config : paths . join ( _ _dirname , './../config/' ) ,
2017-11-24 23:33:45 +00:00
mods : paths . join ( _ _dirname , './../mods/' ) ,
2016-09-20 03:28:21 +00:00
loginServers : paths . join ( _ _dirname , './servers/login/' ) ,
contentServers : paths . join ( _ _dirname , './servers/content/' ) ,
2016-02-10 05:30:59 +00:00
scannerTossers : paths . join ( _ _dirname , './scanner_tossers/' ) ,
mailers : paths . join ( _ _dirname , './mailers/' ) ,
2017-11-22 23:27:33 +00:00
art : paths . join ( _ _dirname , './../art/general/' ) ,
themes : paths . join ( _ _dirname , './../art/themes/' ) ,
2015-04-19 08:13:13 +00:00
logs : paths . join ( _ _dirname , './../logs/' ) , // :TODO: set up based on system, e.g. /var/logs/enigmabbs or such
db : paths . join ( _ _dirname , './../db/' ) ,
2018-01-01 01:45:39 +00:00
modsDb : paths . join ( _ _dirname , './../db/mods/' ) ,
2015-08-03 00:27:05 +00:00
dropFiles : paths . join ( _ _dirname , './../dropfiles/' ) , // + "/node<x>/
2015-11-07 01:30:08 +00:00
misc : paths . join ( _ _dirname , './../misc/' ) ,
2015-04-19 08:13:13 +00:00
} ,
2018-01-01 01:45:39 +00:00
2016-09-20 03:28:21 +00:00
loginServers : {
2015-04-19 08:13:13 +00:00
telnet : {
port : 8888 ,
enabled : true ,
2015-10-22 16:36:08 +00:00
firstMenu : 'telnetConnected' ,
2014-10-17 02:21:06 +00:00
} ,
2015-04-19 08:13:13 +00:00
ssh : {
2015-10-22 18:22:03 +00:00
port : 8889 ,
2017-11-26 09:09:11 +00:00
enabled : false , // default to false as PK/pass in config.hjson are required
2015-10-28 02:46:30 +00:00
//
// Private key in PEM format
2018-01-01 01:45:39 +00:00
//
2015-10-28 02:46:30 +00:00
// Generating your PK:
2017-11-26 09:09:11 +00:00
// > openssl genrsa -des3 -out ./config/ssh_private_key.pem 2048
2015-10-28 02:46:30 +00:00
//
// Then, set servers.ssh.privateKeyPass to the password you use above
// in your config.hjson
//
2017-11-26 09:09:11 +00:00
privateKeyPem : paths . join ( _ _dirname , './../config/ssh_private_key.pem' ) ,
2015-10-22 18:22:03 +00:00
firstMenu : 'sshConnected' ,
firstMenuNewUser : 'sshConnectedNewUser' ,
2017-05-20 00:41:13 +00:00
} ,
webSocket : {
2017-05-31 03:31:35 +00:00
port : 8810 , // ws://
2017-05-20 00:41:13 +00:00
enabled : false ,
2017-05-31 03:31:35 +00:00
securePort : 8811 , // wss:// - must provide certPem and keyPem
2017-11-26 09:09:11 +00:00
certPem : paths . join ( _ _dirname , './../config/https_cert.pem' ) ,
keyPem : paths . join ( _ _dirname , './../config/https_cert_key.pem' ) ,
2017-05-31 03:31:35 +00:00
} ,
2015-04-19 08:13:13 +00:00
} ,
2015-07-14 06:13:29 +00:00
2016-10-25 03:49:45 +00:00
contentServers : {
web : {
domain : 'another-fine-enigma-bbs.org' ,
2017-02-04 16:20:36 +00:00
staticRoot : paths . join ( _ _dirname , './../www' ) ,
2017-02-27 04:28:05 +00:00
resetPassword : {
//
// The following templates have these variables available to them:
2018-01-01 01:45:39 +00:00
//
2017-02-27 04:28:05 +00:00
// * %BOARDNAME% : Name of BBS
// * %USERNAME% : Username of whom to reset password
// * %TOKEN% : Reset token
// * %RESET_URL% : In case of email, the link to follow for reset. In case of landing page,
// URL to POST submit reset form.
// templates for pw reset *email*
resetPassEmailText : paths . join ( _ _dirname , '../misc/reset_password_email.template.txt' ) , // plain text version
resetPassEmailHtml : paths . join ( _ _dirname , '../misc/reset_password_email.template.html' ) , // HTML version
// tempalte for pw reset *landing page*
//
resetPageTemplate : paths . join ( _ _dirname , './../www/reset_password.template.html' ) ,
} ,
2018-01-01 01:45:39 +00:00
2016-10-25 03:49:45 +00:00
http : {
enabled : false ,
2018-01-01 01:45:39 +00:00
port : 8080 ,
2016-10-25 03:49:45 +00:00
} ,
https : {
enabled : false ,
port : 8443 ,
2017-11-26 09:09:11 +00:00
certPem : paths . join ( _ _dirname , './../config/https_cert.pem' ) ,
keyPem : paths . join ( _ _dirname , './../config/https_cert_key.pem' ) ,
2016-10-25 03:49:45 +00:00
}
}
} ,
2017-05-11 03:21:07 +00:00
2017-05-20 00:41:13 +00:00
infoExtractUtils : {
Exiftool2Desc : {
cmd : ` ${ _ _dirname } /../util/exiftool2desc.js ` , // ensure chmod +x
} ,
Exiftool : {
cmd : 'exiftool' ,
2018-01-01 01:45:39 +00:00
args : [
2017-05-20 00:41:13 +00:00
'-charset' , 'utf8' , '{filePath}' ,
2017-05-21 17:45:50 +00:00
// exclude the following:
2018-01-01 01:45:39 +00:00
'--directory' , '--filepermissions' , '--exiftoolversion' , '--filename' , '--filesize' ,
2017-05-21 17:45:50 +00:00
'--filemodifydate' , '--fileaccessdate' , '--fileinodechangedate' , '--createdate' , '--modifydate' ,
'--metadatadate' , '--xmptoolkit'
2017-05-20 00:41:13 +00:00
]
}
} ,
2017-05-11 03:21:07 +00:00
fileTypes : {
//
// File types explicitly known to the system. Here we can configure
// information extraction, archive treatment, etc.
//
// MIME types can be found in mime-db: https://github.com/jshttp/mime-db
//
// Resources for signature/magic bytes:
// * http://www.garykessler.net/library/file_sigs.html
//
//
// :TODO: text/x-ansi -> SAUCE extraction for .ans uploads
2018-01-01 01:45:39 +00:00
// :TODO: textual : bool -- if text, we can view.
2017-05-14 02:59:42 +00:00
// :TODO: asText : { cmd, args[] } -> viewable text
2017-05-11 03:21:07 +00:00
//
// Audio
//
'audio/mpeg' : {
2017-05-14 02:59:42 +00:00
desc : 'MP3 Audio' ,
2017-05-20 00:41:13 +00:00
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
2017-05-11 03:21:07 +00:00
} ,
2017-05-14 02:59:42 +00:00
'application/pdf' : {
desc : 'Adobe PDF' ,
2017-05-20 00:41:13 +00:00
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
} ,
//
2017-08-27 22:25:32 +00:00
// Video
//
'video/mp4' : {
desc : 'MPEG Video' ,
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
} ,
'video/x-matroska ' : {
desc : 'Matroska Video' ,
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
} ,
'video/x-msvideo' : {
desc : 'Audio Video Interleave' ,
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
} ,
//
2017-05-20 00:41:13 +00:00
// Images
//
'image/jpeg' : {
desc : 'JPEG Image' ,
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
} ,
'image/png' : {
desc : 'Portable Network Graphic Image' ,
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
} ,
'image/gif' : {
desc : 'Graphics Interchange Format Image' ,
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
} ,
'image/webp' : {
desc : 'WebP Image' ,
shortDescUtil : 'Exiftool2Desc' ,
longDescUtil : 'Exiftool' ,
2017-05-14 02:59:42 +00:00
} ,
2017-05-11 03:21:07 +00:00
//
// Archives
//
'application/zip' : {
desc : 'ZIP Archive' ,
sig : '504b0304' ,
offset : 0 ,
archiveHandler : '7Zip' ,
} ,
2017-08-19 21:24:42 +00:00
/ *
'application/x-cbr' : {
desc : 'Comic Book Archive' ,
sig : '504b0304' ,
} ,
* /
2017-05-11 03:21:07 +00:00
'application/x-arj' : {
desc : 'ARJ Archive' ,
sig : '60ea' ,
offset : 0 ,
archiveHandler : 'Arj' ,
} ,
'application/x-rar-compressed' : {
desc : 'RAR Archive' ,
sig : '526172211a0700' ,
offset : 0 ,
archiveHandler : 'Rar' ,
2018-01-01 01:45:39 +00:00
} ,
2017-05-11 03:21:07 +00:00
'application/gzip' : {
desc : 'Gzip Archive' ,
sig : '1f8b' ,
offset : 0 ,
2017-07-10 02:00:36 +00:00
archiveHandler : 'TarGz' ,
2017-05-11 03:21:07 +00:00
} ,
// :TODO: application/x-bzip
'application/x-bzip2' : {
desc : 'BZip2 Archive' ,
sig : '425a68' ,
offset : 0 ,
2018-01-01 01:45:39 +00:00
archiveHandler : '7Zip' ,
2017-05-11 03:21:07 +00:00
} ,
'application/x-lzh-compressed' : {
desc : 'LHArc Archive' ,
sig : '2d6c68' ,
offset : 2 ,
2018-01-01 01:45:39 +00:00
archiveHandler : 'Lha' ,
2017-05-11 03:21:07 +00:00
} ,
'application/x-7z-compressed' : {
desc : '7-Zip Archive' ,
sig : '377abcaf271c' ,
offset : 0 ,
2018-01-01 01:45:39 +00:00
archiveHandler : '7Zip' ,
2017-05-11 03:21:07 +00:00
}
// :TODO: update archives::formats to fall here
// * archive handler -> archiveHandler (consider archive if archiveHandler present)
// * sig, offset, ...
// * mime-db -> exts lookup
2018-01-01 01:45:39 +00:00
// *
2017-05-11 03:21:07 +00:00
} ,
2018-01-01 01:45:39 +00:00
2016-10-06 05:22:59 +00:00
archives : {
archivers : {
2016-10-04 04:03:32 +00:00
'7Zip' : {
compress : {
2016-10-06 05:22:59 +00:00
cmd : '7za' ,
2016-10-04 04:03:32 +00:00
args : [ 'a' , '-tzip' , '{archivePath}' , '{fileList}' ] ,
} ,
decompress : {
2016-10-06 05:22:59 +00:00
cmd : '7za' ,
2017-01-30 05:30:48 +00:00
args : [ 'e' , '-o{extractPath}' , '{archivePath}' ] // :TODO: should be 'x'?
2016-10-04 04:03:32 +00:00
} ,
list : {
2016-10-06 05:22:59 +00:00
cmd : '7za' ,
2016-10-04 04:03:32 +00:00
args : [ 'l' , '{archivePath}' ] ,
entryMatch : '^[0-9]{4}-[0-9]{2}-[0-9]{2}\\s[0-9]{2}:[0-9]{2}:[0-9]{2}\\s[A-Za-z\\.]{5}\\s+([0-9]+)\\s+[0-9]+\\s+([^\\r\\n]+)$' ,
} ,
extract : {
2016-10-06 05:22:59 +00:00
cmd : '7za' ,
args : [ 'e' , '-o{extractPath}' , '{archivePath}' , '{fileList}' ] ,
2016-10-04 04:03:32 +00:00
} ,
2017-01-23 04:30:49 +00:00
} ,
Lha : {
//
// 'lha' command can be obtained from:
// * apt-get: lhasa
//
// (compress not currently supported)
//
decompress : {
cmd : 'lha' ,
args : [ '-ew={extractPath}' , '{archivePath}' ] ,
} ,
list : {
cmd : 'lha' ,
args : [ '-l' , '{archivePath}' ] ,
entryMatch : '^[\\[a-z\\]]+(?:\\s+[0-9]+\\s+[0-9]+|\\s+)([0-9]+)\\s+[0-9]{2}\\.[0-9]\\%\\s+[A-Za-z]{3}\\s+[0-9]{1,2}\\s+[0-9]{4}\\s+([^\\r\\n]+)$' ,
} ,
extract : {
cmd : 'lha' ,
args : [ '-ew={extractPath}' , '{archivePath}' , '{fileList}' ]
}
2017-01-30 05:30:48 +00:00
} ,
Arj : {
//
// 'arj' command can be obtained from:
// * apt-get: arj
//
decompress : {
cmd : 'arj' ,
args : [ 'x' , '{archivePath}' , '{extractPath}' ] ,
} ,
list : {
cmd : 'arj' ,
args : [ 'l' , '{archivePath}' ] ,
entryMatch : '^([^\\s]+)\\s+([0-9]+)\\s+[0-9]+\\s[0-9\\.]+\\s+[0-9]{2}\\-[0-9]{2}\\-[0-9]{2}\\s[0-9]{2}\\:[0-9]{2}\\:[0-9]{2}\\s+(?:[^\\r\\n]+)$' ,
entryGroupOrder : { // defaults to { byteSize : 1, fileName : 2 }
fileName : 1 ,
byteSize : 2 ,
}
} ,
extract : {
cmd : 'arj' ,
args : [ 'e' , '{archivePath}' , '{extractPath}' , '{fileList}' ] ,
}
2017-02-18 04:56:28 +00:00
} ,
Rar : {
decompress : {
cmd : 'unrar' ,
args : [ 'x' , '{archivePath}' , '{extractPath}' ] ,
} ,
list : {
cmd : 'unrar' ,
args : [ 'l' , '{archivePath}' ] ,
entryMatch : '^\\s+[\\.A-Z]+\\s+([\\d]+)\\s{2}[0-9]{2}\\-[0-9]{2}\\-[0-9]{2}\\s[0-9]{2}\\:[0-9]{2}\\s{2}([^\\r\\n]+)$' ,
} ,
extract : {
cmd : 'unrar' ,
args : [ 'e' , '{archivePath}' , '{extractPath}' , '{fileList}' ] ,
}
2017-07-10 02:00:36 +00:00
} ,
TarGz : {
decompress : {
cmd : 'tar' ,
args : [ '-xf' , '{archivePath}' , '-C' , '{extractPath}' , '--strip-components=1' ] ,
} ,
list : {
cmd : 'tar' ,
args : [ '-tvf' , '{archivePath}' ] ,
2018-01-01 01:45:39 +00:00
entryMatch : '^[drwx\\-]{10}\\s[A-Za-z0-9\\/]+\\s+([0-9]+)\\s[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}\\s[0-9]{2}\\:[0-9]{2}\\s([^\\r\\n]+)$' ,
2017-07-10 02:00:36 +00:00
} ,
extract : {
cmd : 'tar' ,
args : [ '-xvf' , '{archivePath}' , '-C' , '{extractPath}' , '{fileList}' ] ,
}
2016-10-04 04:03:32 +00:00
}
} ,
2016-02-24 04:56:22 +00:00
} ,
2018-01-01 01:45:39 +00:00
2016-09-29 03:54:25 +00:00
fileTransferProtocols : {
2017-02-04 16:20:36 +00:00
//
// See http://www.synchro.net/docs/sexyz.txt for information on SEXYZ
//
2017-02-02 02:42:27 +00:00
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}' ] ,
2018-01-01 01:45:39 +00:00
}
2017-02-02 02:42:27 +00:00
} ,
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}' ] ,
}
} ,
2016-09-29 03:54:25 +00:00
zmodem8kSz : {
name : 'ZModem 8k' ,
type : 'external' ,
2017-02-02 02:42:27 +00:00
sort : 2 ,
2018-01-01 01:45:39 +00:00
external : {
2016-09-29 03:54:25 +00:00
sendCmd : 'sz' , // Avail on Debian/Ubuntu based systems as the package "lrzsz"
sendArgs : [
2017-01-12 05:47:00 +00:00
// :TODO: try -q
'--zmodem' , '--try-8k' , '--binary' , '--restricted' , '{filePaths}'
] ,
recvCmd : 'rz' , // Avail on Debian/Ubuntu based systems as the package "lrzsz"
recvArgs : [
2017-01-22 05:09:29 +00:00
'--zmodem' , '--binary' , '--restricted' , '--keep-uppercase' , // dumps to CWD which is set to {uploadDir}
2016-09-29 03:54:25 +00:00
] ,
2017-01-12 05:47:00 +00:00
// :TODO: can we not just use --escape ?
2018-01-01 01:45:39 +00:00
escapeTelnet : true , // set to true to escape Telnet codes such as IAC
}
2016-09-29 03:54:25 +00:00
}
} ,
2018-01-01 01:45:39 +00:00
2016-06-20 03:09:45 +00:00
messageAreaDefaults : {
//
// The following can be override per-area as well
//
maxMessages : 1024 , // 0 = unlimited
maxAgeDays : 0 , // 0 = unlimited
} ,
2016-02-24 04:56:22 +00:00
2018-01-01 01:45:39 +00:00
messageConferences : {
2016-02-03 04:35:59 +00:00
system _internal : {
name : 'System Internal' ,
desc : 'Built in conference for private messages, bulletins, etc.' ,
2018-01-01 01:45:39 +00:00
2016-02-03 04:35:59 +00:00
areas : {
private _mail : {
name : 'Private Mail' ,
desc : 'Private user to user mail/email' ,
} ,
local _bulletin : {
name : 'System Bulletins' ,
desc : 'Bulletin messages for all users' ,
}
}
}
} ,
2018-01-01 01:45:39 +00:00
2016-02-17 05:11:55 +00:00
scannerTossers : {
ftn _bso : {
paths : {
2018-01-01 00:54:11 +00:00
outbound : paths . join ( _ _dirname , './../mail/ftn_out/' ) ,
inbound : paths . join ( _ _dirname , './../mail/ftn_in/' ) ,
secInbound : paths . join ( _ _dirname , './../mail/ftn_secin/' ) ,
reject : paths . join ( _ _dirname , './../mail/reject/' ) , // bad pkt, bundles, TIC attachments that fail any check, etc.
2018-01-01 01:45:39 +00:00
//outboundNetMail : paths.join(__dirname, './../mail/ftn_netmail_out/'),
2017-03-09 05:37:02 +00:00
// set 'retain' to a valid path to keep good pkt files
2016-02-17 05:11:55 +00:00
} ,
2016-02-29 05:04:03 +00:00
//
// Packet and (ArcMail) bundle target sizes are just that: targets.
// Actual sizes may be slightly larger when we must place a full
// PKT contents *somewhere*
//
2017-08-21 02:37:10 +00:00
packetTargetByteSize : 512000 , // 512k, before placing messages in a new pkt
bundleTargetByteSize : 2048000 , // 2M, before creating another archive
packetMsgEncoding : 'utf8' , // default packet encoding. Override per node if desired.
packetAnsiMsgEncoding : 'cp437' , // packet encoding for *ANSI ART* messages
2017-03-09 05:37:02 +00:00
tic : {
secureInOnly : true , // only bring in from secure inbound (|secInbound| path, password protected)
uploadBy : 'ENiGMA TIC' , // default upload by username (override @ network)
allowReplace : false , // use "Replaces" TIC field
2017-10-01 17:07:49 +00:00
descPriority : 'diz' , // May be diz=.DIZ/etc., or tic=from TIC Ldesc
2017-03-09 05:37:02 +00:00
}
2016-02-17 05:11:55 +00:00
}
} ,
2016-09-20 03:28:21 +00:00
fileBase : {
2018-01-01 01:45:39 +00:00
// areas with an explicit |storageDir| will be stored relative to |areaStoragePrefix|:
2016-09-20 03:28:21 +00:00
areaStoragePrefix : paths . join ( _ _dirname , './../file_base/' ) ,
2017-01-30 05:30:48 +00:00
maxDescFileByteSize : 471859 , // ~1/4 MB
maxDescLongFileByteSize : 524288 , // 1/2 MB
2016-09-20 03:28:21 +00:00
fileNamePatterns : {
2016-10-13 04:07:22 +00:00
// These are NOT case sensitive
2016-12-07 01:58:56 +00:00
// FILE_ID.DIZ - https://en.wikipedia.org/wiki/FILE_ID.DIZ
2017-09-24 17:35:12 +00:00
// Some groups include a FILE_ID.ANS. We try to use that over FILE_ID.DIZ if available.
2018-01-01 01:45:39 +00:00
desc : [
2017-09-24 17:35:12 +00:00
'^[^/\]*FILE_ID\.ANS$' , '^[^/\]*FILE_ID\.DIZ$' , '^[^/\]*DESC\.SDI$' , '^[^/\]*DESCRIPT\.ION$' , '^[^/\]*FILE\.DES$' , '^[^/\]*FILE\.SDI$' , '^[^/\]*DISK\.ID$'
2016-10-13 04:07:22 +00:00
] ,
2016-12-07 01:58:56 +00:00
// common README filename - https://en.wikipedia.org/wiki/README
2018-01-01 01:45:39 +00:00
descLong : [
2017-02-18 04:56:28 +00:00
'^[^/\]*\.NFO$' , '^[^/\]*README\.1ST$' , '^[^/\]*README\.NOW$' , '^[^/\]*README\.TXT$' , '^[^/\]*READ\.ME$' , '^[^/\]*README$' , '^[^/\]*README\.md$'
2016-12-07 01:58:56 +00:00
] ,
2016-09-20 03:28:21 +00:00
} ,
2016-10-06 05:22:59 +00:00
yearEstPatterns : [
//
2016-12-07 01:58:56 +00:00
// Patterns should produce the year in the first submatch.
// The extracted year may be YY or YYYY
2016-10-06 05:22:59 +00:00
//
2017-11-18 21:09:17 +00:00
'\\b((?:[1-2][0-9][0-9]{2}))[\\-\\/\\.][0-3]?[0-9][\\-\\/\\.][0-3]?[0-9]\\b' , // yyyy-mm-dd, yyyy/mm/dd, ...
'\\b[0-3]?[0-9][\\-\\/\\.][0-3]?[0-9][\\-\\/\\.]((?:[1-2][0-9][0-9]{2}))\\b' , // mm/dd/yyyy, mm.dd.yyyy, ...
'\\b((?:[1789][0-9]))[\\-\\/\\.][0-3]?[0-9][\\-\\/\\.][0-3]?[0-9]\\b' , // yy-mm-dd, yy-mm-dd, ...
'\\b[0-3]?[0-9][\\-\\/\\.][0-3]?[0-9][\\-\\/\\.]((?:[1789][0-9]))\\b' , // mm-dd-yy, mm/dd/yy, ...
//'\\b((?:[1-2][0-9][0-9]{2}))[\\-\\/\\.][0-3]?[0-9][\\-\\/\\.][0-3]?[0-9]|[0-3]?[0-9][\\-\\/\\.][0-3]?[0-9][\\-\\/\\.]((?:[0-9]{2})?[0-9]{2})\\b', // yyyy-mm-dd, m/d/yyyy, mm-dd-yyyy, etc.
//"\\b('[1789][0-9])\\b", // eslint-disable-line quotes
2018-01-01 01:45:39 +00:00
'\\b[0-3]?[0-9][\\-\\/\\.](?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|january|february|march|april|may|june|july|august|september|october|november|december)[\\-\\/\\.]((?:[0-9]{2})?[0-9]{2})\\b' ,
2017-01-31 07:16:28 +00:00
'\\b(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|january|february|march|april|may|june|july|august|september|october|november|december),?\\s[0-9]+(?:st|nd|rd|th)?,?\\s((?:[0-9]{2})?[0-9]{2})\\b' , // November 29th, 1997
2017-11-18 21:09:17 +00:00
'\\(((?:19|20)[0-9]{2})\\)' , // (19xx) or (20xx) -- with parens -- do this before 19xx 20xx such that this has priority
2017-05-20 00:41:13 +00:00
'\\b((?:19|20)[0-9]{2})\\b' , // simple 19xx or 20xx with word boundaries
2017-11-18 21:09:17 +00:00
'\\b\'([17-9][0-9])\\b' , // '95, '17, ...
2016-10-06 05:22:59 +00:00
// :TODO: DD/MMM/YY, DD/MMMM/YY, DD/MMM/YYYY, etc.
] ,
2016-10-25 03:49:45 +00:00
web : {
path : '/f/' ,
routePath : '/f/[a-zA-Z0-9]+$' ,
expireMinutes : 1440 , // 1 day
} ,
2016-12-07 01:58:56 +00:00
//
// File area storage location tag/value pairs.
// Non-absolute paths are relative to |areaStoragePrefix|.
2018-01-01 01:45:39 +00:00
//
2016-12-07 01:58:56 +00:00
storageTags : {
2017-09-26 16:39:07 +00:00
sys _msg _attach : 'sys_msg_attach' ,
sys _temp _download : 'sys_temp_download' ,
2016-12-07 01:58:56 +00:00
} ,
2016-09-20 03:28:21 +00:00
areas : {
2017-01-02 04:53:04 +00:00
system _message _attachment : {
2017-09-26 16:39:07 +00:00
name : 'System Message Attachments' ,
2016-12-07 01:58:56 +00:00
desc : 'File attachments to messages' ,
2017-09-26 16:39:07 +00:00
storageTags : [ 'sys_msg_attach' ] ,
} ,
system _temporary _download : {
name : 'System Temporary Downloads' ,
desc : 'Temporary downloadables' ,
storageTags : [ 'sys_temp_download' ] ,
2016-09-20 03:28:21 +00:00
}
}
} ,
2018-01-01 01:45:39 +00:00
2016-06-20 03:09:45 +00:00
eventScheduler : {
2018-01-01 01:45:39 +00:00
2016-06-20 03:09:45 +00:00
events : {
trimMessageAreas : {
// may optionally use [or ]@watch:/path/to/file
2016-06-22 03:37:47 +00:00
schedule : 'every 24 hours' ,
2018-01-01 01:45:39 +00:00
2016-06-20 03:09:45 +00:00
// action:
// - @method:path/to/module.js:theMethodName
// (path is relative to engima base dir)
//
2018-01-01 01:45:39 +00:00
// - @execute:/path/to/something/executable.sh
//
2016-06-22 03:37:47 +00:00
action : '@method:core/message_area.js:trimMessageAreasScheduledEvent' ,
2017-02-27 04:28:05 +00:00
} ,
2017-09-09 17:48:43 +00:00
updateFileAreaStats : {
schedule : 'every 1 hours' ,
action : '@method:core/file_base_area.js:updateAreaStatsScheduledEvent' ,
} ,
2017-02-27 04:28:05 +00:00
forgotPasswordMaintenance : {
schedule : 'every 24 hours' ,
action : '@method:core/web_password_reset.js:performMaintenanceTask' ,
args : [ '24 hours' ] // items older than this will be removed
2016-06-20 03:09:45 +00:00
}
2018-01-01 01:45:39 +00:00
}
2016-06-20 03:09:45 +00:00
} ,
2015-07-21 04:56:48 +00:00
2015-08-05 04:35:59 +00:00
misc : {
2016-08-22 01:59:21 +00:00
preAuthIdleLogoutSeconds : 60 * 3 , // 2m
idleLogoutSeconds : 60 * 6 , // 6m
2015-08-05 04:35:59 +00:00
} ,
2015-07-21 04:56:48 +00:00
logging : {
2016-09-04 23:46:28 +00:00
level : 'debug' ,
rotatingFile : { // set to 'disabled' or false to disable
type : 'rotating-file' ,
fileName : 'enigma-bbs.log' ,
period : '1d' ,
count : 3 ,
level : 'debug' ,
}
// :TODO: syslog - https://github.com/mcavage/node-bunyan-syslog
2016-08-22 01:59:21 +00:00
} ,
debug : {
assertsEnabled : false ,
2015-07-21 04:56:48 +00:00
}
2015-04-19 08:13:13 +00:00
} ;
}