mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-23 19:20:41 +02:00
* Work on themes. Ability to use ANSI to detect screen size if NAWS/etc. fail
This commit is contained in:
parent
1ef9a4a1ce
commit
14a321de2f
6 changed files with 107 additions and 50 deletions
53
core/bbs.js
53
core/bbs.js
|
@ -10,8 +10,11 @@ var database = require('./database.js');
|
|||
|
||||
var iconv = require('iconv-lite');
|
||||
var paths = require('path');
|
||||
var async = require('async');
|
||||
|
||||
exports.bbsMain = function() {
|
||||
exports.bbsMain = bbsMain;
|
||||
|
||||
function bbsMain() {
|
||||
var mainArgs = parseArgs();
|
||||
|
||||
var configPathSupplied = false;
|
||||
|
@ -74,6 +77,41 @@ function parseArgs() {
|
|||
return args;
|
||||
}
|
||||
|
||||
function initialize(cb) {
|
||||
async.series(
|
||||
[
|
||||
function basicInit(callback) {
|
||||
logger.init();
|
||||
|
||||
process.on('SIGINT', function onSigInt() {
|
||||
// :TODO: for any client in |clientConnections|, if 'ready', send a "Server Disconnecting" + semi-gracefull hangup
|
||||
// e.g. client.disconnectNow()
|
||||
|
||||
logger.log.info('Process interrupted, shutting down');
|
||||
process.exit();
|
||||
});
|
||||
|
||||
callback(null);
|
||||
},
|
||||
function initDatabases(callback) {
|
||||
database.initializeDatabases();
|
||||
callback(null);
|
||||
},
|
||||
function initThemes(callback) {
|
||||
// Have to pull in here so it's after Config init
|
||||
var theme = require('./theme.js');
|
||||
theme.initAvailableThemes(function onThemesInit(err, themeCount) {
|
||||
logger.log.info({ themeCount : themeCount }, 'Themes initialized');
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
],
|
||||
function onComplete(err) {
|
||||
cb(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function preServingInit() {
|
||||
iconv.extendNodeEncodings();
|
||||
}
|
||||
|
@ -164,16 +202,11 @@ function prepareClient(client, cb) {
|
|||
if('*' === conf.config.preLoginTheme) {
|
||||
var theme = require('./theme.js');
|
||||
theme.getRandomTheme(function onRandTheme(err, themeId) {
|
||||
if(err) {
|
||||
// :TODO: how to propertly set default/fallback?
|
||||
client.user.properties.art_theme_name = '';
|
||||
} else {
|
||||
client.user.properties.art_theme_name = themeId;
|
||||
}
|
||||
cb();
|
||||
client.user.properties.art_theme_id = themeId || '';
|
||||
cb(null);
|
||||
});
|
||||
} else {
|
||||
client.user.properties.art_theme_name = conf.config.preLoginTheme;
|
||||
cb();
|
||||
client.user.properties.art_theme_id = conf.config.preLoginTheme;
|
||||
cb(null);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue