mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
remove more from config
This commit is contained in:
@@ -28,6 +28,6 @@
|
||||
"maximumCoverImageSize": 2048,
|
||||
"profileImageDimension": 128,
|
||||
"requireEmailConfirmation": 0,
|
||||
"profile:allowProfileImageUploads": 1,
|
||||
"allowProfileImageUploads": 1,
|
||||
"teaserPost": "last"
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
}
|
||||
templates.parse('partials/modals/change_picture_modal', {
|
||||
pictures: pictures,
|
||||
uploaded: !!ajaxify.data.uploadedpicture
|
||||
uploaded: !!ajaxify.data.uploadedpicture,
|
||||
allowProfileImageUploads: ajaxify.data.allowProfileImageUploads
|
||||
}, function(html) {
|
||||
translator.translate(html, function(html) {
|
||||
var modal = bootbox.dialog({
|
||||
@@ -201,7 +202,7 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
|
||||
|
||||
modal.find('[data-action="upload"]').on('click', function() {
|
||||
modal.modal('hide');
|
||||
uploader.open(config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadpicture', {}, config.maximumProfileImageSize, function(imageUrlOnServer) {
|
||||
uploader.open(config.relative_path + '/api/user/' + ajaxify.data.userslug + '/uploadpicture', {}, ajaxify.data.maximumProfileImageSize, function(imageUrlOnServer) {
|
||||
onUploadComplete(imageUrlOnServer);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
/* globals define, ajaxify, socket, app, config, utils */
|
||||
/* globals define, ajaxify, socket, app, utils */
|
||||
|
||||
define('forum/account/edit/password', ['forum/account/header', 'translator'], function(header, translator) {
|
||||
var AccountEditPassword = {};
|
||||
@@ -21,7 +21,7 @@ define('forum/account/edit/password', ['forum/account/header', 'translator'], fu
|
||||
var passwordsmatch = false;
|
||||
|
||||
function onPasswordChanged() {
|
||||
if (password.val().length < config.minimumPasswordLength) {
|
||||
if (password.val().length < ajaxify.data.minimumPasswordLength) {
|
||||
showError(password_notify, '[[user:change_password_error_length]]');
|
||||
passwordvalid = false;
|
||||
} else if (!utils.isPasswordValid(password.val())) {
|
||||
|
||||
@@ -426,10 +426,10 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
|
||||
};
|
||||
|
||||
Chats.sendMessage = function(roomId, inputEl) {
|
||||
var msg = inputEl.val(),
|
||||
mid = inputEl.attr('data-mid');
|
||||
var msg = inputEl.val();
|
||||
var mid = inputEl.attr('data-mid');
|
||||
|
||||
if (msg.length > config.maximumChatMessageLength) {
|
||||
if (msg.length > ajaxify.data.maximumChatMessageLength) {
|
||||
return app.alertError('[[error:chat-message-too-long]]');
|
||||
}
|
||||
|
||||
|
||||
@@ -150,9 +150,9 @@ define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
||||
|
||||
var username_notify = $('#username-notify');
|
||||
|
||||
if (username.length < config.minimumUsernameLength) {
|
||||
if (username.length < ajaxify.data.minimumUsernameLength) {
|
||||
showError(username_notify, '[[error:username-too-short]]');
|
||||
} else if (username.length > config.maximumUsernameLength) {
|
||||
} else if (username.length > ajaxify.data.maximumUsernameLength) {
|
||||
showError(username_notify, '[[error:username-too-long]]');
|
||||
} else if (!utils.isUserNameValid(username) || !utils.slugify(username)) {
|
||||
showError(username_notify, '[[error:invalid-username]]');
|
||||
@@ -179,7 +179,7 @@ define('forum/register', ['csrf', 'translator'], function(csrf, translator) {
|
||||
var password_notify = $('#password-notify'),
|
||||
password_confirm_notify = $('#password-confirm-notify');
|
||||
|
||||
if (password.length < config.minimumPasswordLength) {
|
||||
if (password.length < ajaxify.data.minimumPasswordLength) {
|
||||
showError(password_notify, '[[user:change_password_error_length]]');
|
||||
} else if (!utils.isPasswordValid(password)) {
|
||||
showError(password_notify, '[[user:change_password_error]]');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
/*globals define, app, ajaxify, socket, RELATIVE_PATH*/
|
||||
/*globals define, app, ajaxify, socket, config*/
|
||||
|
||||
define('forum/reset_code', function() {
|
||||
var ResetCode = {};
|
||||
@@ -7,13 +7,12 @@ define('forum/reset_code', function() {
|
||||
ResetCode.init = function() {
|
||||
var reset_code = ajaxify.data.code;
|
||||
|
||||
var resetEl = $('#reset'),
|
||||
password = $('#password'),
|
||||
repeat = $('#repeat'),
|
||||
noticeEl = $('#notice');
|
||||
var resetEl = $('#reset');
|
||||
var password = $('#password');
|
||||
var repeat = $('#repeat');
|
||||
|
||||
resetEl.on('click', function() {
|
||||
if (password.val().length < config.minimumPasswordLength) {
|
||||
if (password.val().length < ajaxify.data.minimumPasswordLength) {
|
||||
app.alertError('[[reset_password:password_too_short]]');
|
||||
} else if (password.val() !== repeat.val()) {
|
||||
app.alertError('[[reset_password:passwords_do_not_match]]');
|
||||
@@ -28,7 +27,7 @@ define('forum/reset_code', function() {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
|
||||
window.location.href = RELATIVE_PATH + '/login';
|
||||
window.location.href = config.relative_path + '/login';
|
||||
});
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (item.route.match('/users') && data.config.privateUserInfo && !data.config.loggedIn) {
|
||||
if (item.route.match('/users') && data.privateUserInfo && !data.config.loggedIn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.route.match('/tags') && data.config.privateTagListing && !data.config.loggedIn) {
|
||||
if (item.route.match('/tags') && data.privateTagListing && !data.config.loggedIn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ chatsController.get = function(req, res, callback) {
|
||||
room.title = room.roomName;
|
||||
room.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[pages:chats]]', url: '/chats'}, {text: room.roomName}]);
|
||||
room.maximumUsersInChatRoom = parseInt(meta.config.maximumUsersInChatRoom, 10) || 0;
|
||||
room.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10) || 1000;
|
||||
room.showUserInput = !room.maximumUsersInChatRoom || room.maximumUsersInChatRoom > 2;
|
||||
|
||||
res.render('chats', room);
|
||||
|
||||
@@ -21,6 +21,9 @@ editController.get = function(req, res, callback) {
|
||||
|
||||
userData.maximumSignatureLength = parseInt(meta.config.maximumSignatureLength, 10) || 255;
|
||||
userData.maximumAboutMeLength = parseInt(meta.config.maximumAboutMeLength, 10) || 1000;
|
||||
userData.maximumProfileImageSize = parseInt(meta.config.maximumProfileImageSize, 10);
|
||||
userData.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads) === 1;
|
||||
userData.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1;
|
||||
|
||||
userData.title = '[[pages:account/edit, ' + userData.username + ']]';
|
||||
userData.breadcrumbs = helpers.buildBreadcrumbs([{text: userData.username, url: '/user/' + userData.userslug}, {text: '[[user:edit]]'}]);
|
||||
@@ -50,6 +53,10 @@ function renderRoute(name, req, res, next) {
|
||||
return next();
|
||||
}
|
||||
|
||||
if (name === 'password') {
|
||||
userData.minimumPasswordLength = parseInt(meta.config.minimumPasswordLength, 10);
|
||||
}
|
||||
|
||||
userData.title = '[[pages:account/edit/' + name + ', ' + userData.username + ']]';
|
||||
userData.breadcrumbs = helpers.buildBreadcrumbs([
|
||||
{text: userData.username, url: '/user/' + userData.userslug},
|
||||
|
||||
@@ -28,9 +28,8 @@ apiController.getConfig = function(req, res, next) {
|
||||
}
|
||||
|
||||
var config = {};
|
||||
config.environment = process.env.NODE_ENV;
|
||||
config.relative_path = nconf.get('relative_path');
|
||||
config.socketioTransports = nconf.get('socket.io:transports') || ['polling', 'websocket'];
|
||||
config.websocketAddress = nconf.get('socket.io:address') || '';
|
||||
config.version = nconf.get('version');
|
||||
config.siteTitle = validator.escape(meta.config.title || meta.config.browserTitle || 'NodeBB');
|
||||
config.browserTitle = validator.escape(meta.config.browserTitle || meta.config.title || 'NodeBB');
|
||||
@@ -40,33 +39,24 @@ apiController.getConfig = function(req, res, next) {
|
||||
config.maximumTitleLength = meta.config.maximumTitleLength;
|
||||
config.minimumPostLength = meta.config.minimumPostLength;
|
||||
config.maximumPostLength = meta.config.maximumPostLength;
|
||||
|
||||
config.minimumTagsPerTopic = meta.config.minimumTagsPerTopic || 0;
|
||||
config.maximumTagsPerTopic = meta.config.maximumTagsPerTopic || 5;
|
||||
config.minimumTagLength = meta.config.minimumTagLength || 3;
|
||||
config.maximumTagLength = meta.config.maximumTagLength || 15;
|
||||
config.hasImageUploadPlugin = plugins.hasListeners('filter:uploadImage');
|
||||
config.maximumProfileImageSize = meta.config.maximumProfileImageSize;
|
||||
config.minimumUsernameLength = meta.config.minimumUsernameLength;
|
||||
config.maximumUsernameLength = meta.config.maximumUsernameLength;
|
||||
config.minimumPasswordLength = meta.config.minimumPasswordLength;
|
||||
config.useOutgoingLinksPage = parseInt(meta.config.useOutgoingLinksPage, 10) === 1;
|
||||
config.allowGuestSearching = parseInt(meta.config.allowGuestSearching, 10) === 1;
|
||||
config.allowGuestUserSearching = parseInt(meta.config.allowGuestUserSearching, 10) === 1;
|
||||
config.allowGuestHandles = parseInt(meta.config.allowGuestHandles, 10) === 1;
|
||||
config.allowFileUploads = parseInt(meta.config.allowFileUploads, 10) === 1;
|
||||
config.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads) === 1;
|
||||
config.allowTopicsThumbnail = parseInt(meta.config.allowTopicsThumbnail, 10) === 1;
|
||||
config.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1;
|
||||
config.allowUserHomePage = parseInt(meta.config.allowUserHomePage, 10) === 1;
|
||||
config.privateUserInfo = parseInt(meta.config.privateUserInfo, 10) === 1;
|
||||
config.privateTagListing = parseInt(meta.config.privateTagListing, 10) === 1;
|
||||
config.usePagination = parseInt(meta.config.usePagination, 10) === 1;
|
||||
config.disableSocialButtons = parseInt(meta.config.disableSocialButtons, 10) === 1;
|
||||
config.disableChat = parseInt(meta.config.disableChat, 10) === 1;
|
||||
config.maximumChatMessageLength = parseInt(meta.config.maximumChatMessageLength, 10) || 1000;
|
||||
config.socketioTransports = nconf.get('socket.io:transports') || ['polling', 'websocket'];
|
||||
config.websocketAddress = nconf.get('socket.io:address') || '';
|
||||
config.maxReconnectionAttempts = meta.config.maxReconnectionAttempts || 5;
|
||||
config.reconnectionDelay = meta.config.reconnectionDelay || 1500;
|
||||
config.minimumTagsPerTopic = meta.config.minimumTagsPerTopic || 0;
|
||||
config.maximumTagsPerTopic = meta.config.maximumTagsPerTopic || 5;
|
||||
config.minimumTagLength = meta.config.minimumTagLength || 3;
|
||||
config.maximumTagLength = meta.config.maximumTagLength || 15;
|
||||
config.topicsPerPage = meta.config.topicsPerPage || 20;
|
||||
config.postsPerPage = meta.config.postsPerPage || 20;
|
||||
config.maximumFileSize = meta.config.maximumFileSize;
|
||||
@@ -74,7 +64,6 @@ apiController.getConfig = function(req, res, next) {
|
||||
config['theme:src'] = meta.config['theme:src'];
|
||||
config.defaultLang = meta.config.defaultLang || 'en_GB';
|
||||
config.userLang = req.query.lang || config.defaultLang;
|
||||
config.environment = process.env.NODE_ENV;
|
||||
config.loggedIn = !!req.user;
|
||||
config['cache-buster'] = meta.config['cache-buster'] || '';
|
||||
config.requireEmailConfirmation = parseInt(meta.config.requireEmailConfirmation, 10) === 1;
|
||||
|
||||
@@ -77,6 +77,7 @@ Controllers.reset = function(req, res, next) {
|
||||
valid: valid,
|
||||
displayExpiryNotice: req.session.passwordExpired,
|
||||
code: req.params.code ? req.params.code : null,
|
||||
minimumPasswordLength: parseInt(meta.config.minimumPasswordLength, 10),
|
||||
breadcrumbs: helpers.buildBreadcrumbs([{text: '[[reset_password:reset_password]]', url: '/reset'}, {text: '[[reset_password:update_password]]'}]),
|
||||
title: '[[pages:reset]]'
|
||||
});
|
||||
@@ -137,9 +138,9 @@ Controllers.register = function(req, res, next) {
|
||||
|
||||
data.authentication = loginStrategies;
|
||||
|
||||
data.minimumUsernameLength = meta.config.minimumUsernameLength;
|
||||
data.maximumUsernameLength = meta.config.maximumUsernameLength;
|
||||
data.minimumPasswordLength = meta.config.minimumPasswordLength;
|
||||
data.minimumUsernameLength = parseInt(meta.config.minimumUsernameLength, 10);
|
||||
data.maximumUsernameLength = parseInt(meta.config.maximumUsernameLength, 10);
|
||||
data.minimumPasswordLength = parseInt(meta.config.minimumPasswordLength, 10);
|
||||
data.termsOfUse = tos.postData.content;
|
||||
data.breadcrumbs = helpers.buildBreadcrumbs([{text: '[[register:register]]'}]);
|
||||
data.regFormEntry = [];
|
||||
|
||||
@@ -130,6 +130,8 @@ module.exports = function(app, middleware) {
|
||||
templateValues.customJS = templateValues.useCustomJS ? meta.config.customJS : '';
|
||||
templateValues.maintenanceHeader = parseInt(meta.config.maintenanceMode, 10) === 1 && !results.isAdmin;
|
||||
templateValues.defaultLang = meta.config.defaultLang || 'en_GB';
|
||||
templateValues.privateUserInfo = parseInt(meta.config.privateUserInfo, 10) === 1;
|
||||
templateValues.privateTagListing = parseInt(meta.config.privateTagListing, 10) === 1;
|
||||
|
||||
templateValues.template = {name: res.locals.template};
|
||||
templateValues.template[res.locals.template] = true;
|
||||
|
||||
Reference in New Issue
Block a user