mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
Refactor skins to be built on server-side (#6849)
* WIP * using bootswatch from npm instead of bootswatch CDN url * feat: on-demand client css building for skins * added ability for client-side to select a skin * updated loading and saving logic of bootstrapSkin on client side user settings * fix: broken test for #6849
This commit is contained in:
@@ -58,8 +58,7 @@ apiController.loadConfig = function (req, callback) {
|
||||
config.categoryTopicSort = meta.config.categoryTopicSort || 'newest_to_oldest';
|
||||
config.csrf_token = req.csrfToken && req.csrfToken();
|
||||
config.searchEnabled = plugins.hasListeners('filter:search.query');
|
||||
config.bootswatchSkin = meta.config.bootswatchSkin || 'noskin';
|
||||
config.defaultBootswatchSkin = meta.config.bootswatchSkin || 'noskin';
|
||||
config.bootswatchSkin = meta.config.bootswatchSkin || '';
|
||||
config.enablePostHistory = (meta.config.enablePostHistory || 1) === 1;
|
||||
config.notificationAlertTimeout = meta.config.notificationAlertTimeout || 5000;
|
||||
|
||||
@@ -85,6 +84,10 @@ apiController.loadConfig = function (req, callback) {
|
||||
user.getSettings(req.uid, next);
|
||||
},
|
||||
function (settings, next) {
|
||||
// Handle old skin configs
|
||||
const oldSkins = ['noskin', 'default'];
|
||||
settings.bootswatchSkin = oldSkins.includes(settings.bootswatchSkin) ? '' : settings.bootswatchSkin;
|
||||
|
||||
config.usePagination = settings.usePagination;
|
||||
config.topicsPerPage = settings.topicsPerPage;
|
||||
config.postsPerPage = settings.postsPerPage;
|
||||
@@ -95,7 +98,7 @@ apiController.loadConfig = function (req, callback) {
|
||||
config.categoryTopicSort = settings.categoryTopicSort || config.categoryTopicSort;
|
||||
config.topicSearchEnabled = settings.topicSearchEnabled || false;
|
||||
config.delayImageLoading = settings.delayImageLoading !== undefined ? settings.delayImageLoading : true;
|
||||
config.bootswatchSkin = (meta.config.disableCustomUserSkins !== 1 && settings.bootswatchSkin && settings.bootswatchSkin !== 'default') ? settings.bootswatchSkin : config.bootswatchSkin;
|
||||
config.bootswatchSkin = (meta.config.disableCustomUserSkins !== 1 && settings.bootswatchSkin && settings.bootswatchSkin !== '') ? settings.bootswatchSkin : '';
|
||||
plugins.fireHook('filter:config.get', config, next);
|
||||
},
|
||||
], callback);
|
||||
|
||||
Reference in New Issue
Block a user