Changes to config: defaults -> theme, preLoginTheme -> theme.preLogin, etc.
This commit is contained in:
parent
8182146574
commit
7d74556868
|
@ -60,6 +60,7 @@ webSocket: {
|
||||||
* The module export `registerEvents` has been deprecated. If you have a module that depends on this, use the new more generic `moduleInitialize` export instead.
|
* The module export `registerEvents` has been deprecated. If you have a module that depends on this, use the new more generic `moduleInitialize` export instead.
|
||||||
* The `system.db` `user_event_log` table has been updated to include a unique session ID. Previously this table was not used, but you will need to perform a slight maintenance task before it can be properly used. After updating to `0.0.9-alpha`, please run the following: `sqlite3 db/system.db DROP TABLE user_event_log;`. The new table format will be created and used at startup.
|
* The `system.db` `user_event_log` table has been updated to include a unique session ID. Previously this table was not used, but you will need to perform a slight maintenance task before it can be properly used. After updating to `0.0.9-alpha`, please run the following: `sqlite3 db/system.db DROP TABLE user_event_log;`. The new table format will be created and used at startup.
|
||||||
* If you have art configured for message conference or area selection via the `art` configuration value, you will need to include a `show_art` menu reference. Defaulted to `changeMessageConfPreArt` for conferences and `changeMessageAreaPreArt` for areas & included in the example `menu.hjson`.
|
* If you have art configured for message conference or area selection via the `art` configuration value, you will need to include a `show_art` menu reference. Defaulted to `changeMessageConfPreArt` for conferences and `changeMessageAreaPreArt` for areas & included in the example `menu.hjson`.
|
||||||
|
* Config `defaults` section was theme related and as such, has been renamed to `theme`. `defaults.theme` is now `theme.default`, and `preLoginTheme` is now `theme.preLogin`. See `config.js` if this isn't clear as mud.
|
||||||
|
|
||||||
|
|
||||||
# 0.0.7-alpha to 0.0.8-alpha
|
# 0.0.7-alpha to 0.0.8-alpha
|
||||||
|
|
|
@ -141,9 +141,6 @@ function getDefaultConfig() {
|
||||||
promptFile : 'prompt.hjson', // Override to use soemthing else, e.g. myprompt.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)
|
||||||
},
|
},
|
||||||
|
|
||||||
// :TODO: see notes below about 'theme' section - move this!
|
|
||||||
preLoginTheme : 'luciano_blocktronics',
|
|
||||||
|
|
||||||
users : {
|
users : {
|
||||||
usernameMin : 2,
|
usernameMin : 2,
|
||||||
usernameMax : 16, // Note that FidoNet wants 36 max
|
usernameMax : 16, // Note that FidoNet wants 36 max
|
||||||
|
@ -172,18 +169,10 @@ function getDefaultConfig() {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
// :TODO: better name for "defaults"... which is redundant here!
|
theme : {
|
||||||
/*
|
default : 'luciano_blocktronics',
|
||||||
Concept
|
preLogin : 'luciano_blocktronics',
|
||||||
"theme" : {
|
|
||||||
"default" : "defaultThemeName", // or "*"
|
|
||||||
"preLogin" : "*",
|
|
||||||
"passwordChar" : "*",
|
|
||||||
...
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
defaults : {
|
|
||||||
theme : 'luciano_blocktronics',
|
|
||||||
passwordChar : '*', // TODO: move to user ?
|
passwordChar : '*', // TODO: move to user ?
|
||||||
dateFormat : {
|
dateFormat : {
|
||||||
short : 'MM/DD/YYYY',
|
short : 'MM/DD/YYYY',
|
||||||
|
@ -202,7 +191,7 @@ function getDefaultConfig() {
|
||||||
cls : true, // Clear screen before each menu by default?
|
cls : true, // Clear screen before each menu by default?
|
||||||
},
|
},
|
||||||
|
|
||||||
paths : {
|
paths : {
|
||||||
config : paths.join(__dirname, './../config/'),
|
config : paths.join(__dirname, './../config/'),
|
||||||
mods : paths.join(__dirname, './../mods/'),
|
mods : paths.join(__dirname, './../mods/'),
|
||||||
loginServers : paths.join(__dirname, './servers/login/'),
|
loginServers : paths.join(__dirname, './servers/login/'),
|
||||||
|
|
|
@ -23,10 +23,11 @@ module.exports = class LoginServerModule extends ServerModule {
|
||||||
//
|
//
|
||||||
// Choose initial theme before we have user context
|
// Choose initial theme before we have user context
|
||||||
//
|
//
|
||||||
if('*' === conf.config.preLoginTheme) {
|
const preLoginTheme = _.get(conf.config, 'theme.preLogin');
|
||||||
|
if('*' === preLoginTheme) {
|
||||||
client.user.properties.theme_id = theme.getRandomTheme() || '';
|
client.user.properties.theme_id = theme.getRandomTheme() || '';
|
||||||
} else {
|
} else {
|
||||||
client.user.properties.theme_id = conf.config.preLoginTheme;
|
client.user.properties.theme_id = preLoginTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
theme.setClientTheme(client, client.user.properties.theme_id);
|
theme.setClientTheme(client, client.user.properties.theme_id);
|
||||||
|
|
|
@ -9,6 +9,9 @@ const login = require('./system_menu_method.js').login;
|
||||||
const Config = require('./config.js').get;
|
const Config = require('./config.js').get;
|
||||||
const messageArea = require('./message_area.js');
|
const messageArea = require('./message_area.js');
|
||||||
|
|
||||||
|
// deps
|
||||||
|
const _ = require('lodash');
|
||||||
|
|
||||||
exports.moduleInfo = {
|
exports.moduleInfo = {
|
||||||
name : 'NUA',
|
name : 'NUA',
|
||||||
desc : 'New User Application',
|
desc : 'New User Application',
|
||||||
|
@ -96,10 +99,11 @@ exports.getModule = class NewUserAppModule extends MenuModule {
|
||||||
// :TODO: should probably have a place to create defaults/etc.
|
// :TODO: should probably have a place to create defaults/etc.
|
||||||
};
|
};
|
||||||
|
|
||||||
if('*' === config.defaults.theme) {
|
const defaultTheme = _.get(config, 'theme.default');
|
||||||
|
if('*' === defaultTheme) {
|
||||||
newUser.properties.theme_id = theme.getRandomTheme();
|
newUser.properties.theme_id = theme.getRandomTheme();
|
||||||
} else {
|
} else {
|
||||||
newUser.properties.theme_id = config.defaults.theme;
|
newUser.properties.theme_id = defaultTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: User.create() should validate email uniqueness!
|
// :TODO: User.create() should validate email uniqueness!
|
||||||
|
|
|
@ -39,7 +39,7 @@ function refreshThemeHelpers(theme) {
|
||||||
let pwChar = _.get(
|
let pwChar = _.get(
|
||||||
theme,
|
theme,
|
||||||
'customization.defaults.general.passwordChar',
|
'customization.defaults.general.passwordChar',
|
||||||
Config().defaults.passwordChar
|
Config().theme.passwordChar
|
||||||
);
|
);
|
||||||
|
|
||||||
if(_.isString(pwChar)) {
|
if(_.isString(pwChar)) {
|
||||||
|
@ -51,15 +51,15 @@ function refreshThemeHelpers(theme) {
|
||||||
return pwChar;
|
return pwChar;
|
||||||
},
|
},
|
||||||
getDateFormat : function(style = 'short') {
|
getDateFormat : function(style = 'short') {
|
||||||
const format = Config().defaults.dateFormat[style] || 'MM/DD/YYYY';
|
const format = Config().theme.dateFormat[style] || 'MM/DD/YYYY';
|
||||||
return _.get(theme, `customization.defaults.dateFormat.${style}`, format);
|
return _.get(theme, `customization.defaults.dateFormat.${style}`, format);
|
||||||
},
|
},
|
||||||
getTimeFormat : function(style = 'short') {
|
getTimeFormat : function(style = 'short') {
|
||||||
const format = Config().defaults.timeFormat[style] || 'h:mm a';
|
const format = Config().theme.timeFormat[style] || 'h:mm a';
|
||||||
return _.get(theme, `customization.defaults.timeFormat.${style}`, format);
|
return _.get(theme, `customization.defaults.timeFormat.${style}`, format);
|
||||||
},
|
},
|
||||||
getDateTimeFormat : function(style = 'short') {
|
getDateTimeFormat : function(style = 'short') {
|
||||||
const format = Config().defaults.dateTimeFormat[style] || 'MM/DD/YYYY h:mm a';
|
const format = Config().theme.dateTimeFormat[style] || 'MM/DD/YYYY h:mm a';
|
||||||
return _.get(theme, `customization.defaults.dateTimeFormat.${style}`, format);
|
return _.get(theme, `customization.defaults.dateTimeFormat.${style}`, format);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -402,9 +402,9 @@ function setClientTheme(client, themeId) {
|
||||||
if(availThemes.has(themeId)) {
|
if(availThemes.has(themeId)) {
|
||||||
msg = 'Set client theme';
|
msg = 'Set client theme';
|
||||||
setThemeId = themeId;
|
setThemeId = themeId;
|
||||||
} else if(availThemes.has(config.defaults.theme)) {
|
} else if(availThemes.has(config.theme.default)) {
|
||||||
msg = 'Failed setting theme by supplied ID; Using default';
|
msg = 'Failed setting theme by supplied ID; Using default';
|
||||||
setThemeId = config.defaults.theme;
|
setThemeId = config.theme.default;
|
||||||
} else {
|
} else {
|
||||||
msg = 'Failed setting theme by system default ID; Using the first one we can find';
|
msg = 'Failed setting theme by system default ID; Using the first one we can find';
|
||||||
setThemeId = availThemes.keys().next().value;
|
setThemeId = availThemes.keys().next().value;
|
||||||
|
@ -430,7 +430,7 @@ function getThemeArt(options, cb) {
|
||||||
if(!options.themeId && _.has(options, 'client.user.properties.theme_id')) {
|
if(!options.themeId && _.has(options, 'client.user.properties.theme_id')) {
|
||||||
options.themeId = options.client.user.properties.theme_id;
|
options.themeId = options.client.user.properties.theme_id;
|
||||||
} else {
|
} else {
|
||||||
options.themeId = config.defaults.theme;
|
options.themeId = config.theme.default;
|
||||||
}
|
}
|
||||||
|
|
||||||
// :TODO: replace asAnsi stuff with something like retrieveAs = 'ansi' | 'pipe' | ...
|
// :TODO: replace asAnsi stuff with something like retrieveAs = 'ansi' | 'pipe' | ...
|
||||||
|
@ -477,11 +477,11 @@ function getThemeArt(options, cb) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function fromDefaultTheme(artInfo, callback) {
|
function fromDefaultTheme(artInfo, callback) {
|
||||||
if(artInfo || config.defaults.theme === options.themeId) {
|
if(artInfo || config.theme.default === options.themeId) {
|
||||||
return callback(null, artInfo);
|
return callback(null, artInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
options.basePath = paths.join(config.paths.themes, config.defaults.theme);
|
options.basePath = paths.join(config.paths.themes, config.theme.default);
|
||||||
art.getArt(options.name, options, (err, artInfo) => {
|
art.getArt(options.name, options, (err, artInfo) => {
|
||||||
return callback(null, artInfo);
|
return callback(null, artInfo);
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,12 +46,10 @@ Below is a **sample** `config.hjson` illustrating various (but certainly not all
|
||||||
menuFile: "your_bbs.hjson" // copy of menu.hjson file (and adapt to your needs)
|
menuFile: "your_bbs.hjson" // copy of menu.hjson file (and adapt to your needs)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaults: {
|
theme: {
|
||||||
theme: "super-fancy-theme" // default-assigned theme (for new users)
|
default: "super-fancy-theme" // default-assigned theme (for new users)
|
||||||
}
|
}
|
||||||
|
|
||||||
preLoginTheme: "luciano_blocktronics" // theme used before a user logs in (matrix, NUA, etc.)
|
|
||||||
|
|
||||||
messageConferences: {
|
messageConferences: {
|
||||||
local_general: {
|
local_general: {
|
||||||
name: Local
|
name: Local
|
||||||
|
|
Loading…
Reference in New Issue