mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
closes #3646
This commit is contained in:
@@ -26,22 +26,6 @@
|
|||||||
configureSlidemenu();
|
configureSlidemenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.emit('admin.config.get', function(err, config) {
|
|
||||||
if(err) {
|
|
||||||
return app.alert({
|
|
||||||
alert_id: 'config_status',
|
|
||||||
timeout: 2500,
|
|
||||||
title: 'Error',
|
|
||||||
message: 'NodeBB encountered a problem getting config: ' + err.message,
|
|
||||||
type: 'danger'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// move this to admin.config
|
|
||||||
app.config = config;
|
|
||||||
$(window).trigger('action:config.loaded');
|
|
||||||
});
|
|
||||||
|
|
||||||
function setupKeybindings() {
|
function setupKeybindings() {
|
||||||
Mousetrap.bind('ctrl+shift+a r', function() {
|
Mousetrap.bind('ctrl+shift+a r', function() {
|
||||||
require(['admin/modules/instance'], function(instance) {
|
require(['admin/modules/instance'], function(instance) {
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ middleware.renderHeader = function(req, res, data, next) {
|
|||||||
},
|
},
|
||||||
config: function(next) {
|
config: function(next) {
|
||||||
controllers.api.getConfig(req, res, next);
|
controllers.api.getConfig(req, res, next);
|
||||||
|
},
|
||||||
|
configs: function(next) {
|
||||||
|
meta.configs.list(next);
|
||||||
}
|
}
|
||||||
}, function(err, results) {
|
}, function(err, results) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -96,6 +99,7 @@ middleware.renderHeader = function(req, res, data, next) {
|
|||||||
config: results.config,
|
config: results.config,
|
||||||
configJSON: JSON.stringify(results.config),
|
configJSON: JSON.stringify(results.config),
|
||||||
relative_path: results.config.relative_path,
|
relative_path: results.config.relative_path,
|
||||||
|
adminConfigJSON: encodeURIComponent(JSON.stringify(results.configs)),
|
||||||
user: userData,
|
user: userData,
|
||||||
userJSON: JSON.stringify(userData).replace(/'/g, "\\'"),
|
userJSON: JSON.stringify(userData).replace(/'/g, "\\'"),
|
||||||
plugins: results.custom_header.plugins,
|
plugins: results.custom_header.plugins,
|
||||||
|
|||||||
@@ -134,10 +134,6 @@ SocketAdmin.widgets.set = function(socket, data, callback) {
|
|||||||
widgets.setArea(data, callback);
|
widgets.setArea(data, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
SocketAdmin.config.get = function(socket, data, callback) {
|
|
||||||
meta.configs.list(callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
SocketAdmin.config.set = function(socket, data, callback) {
|
SocketAdmin.config.set = function(socket, data, callback) {
|
||||||
if(!data) {
|
if(!data) {
|
||||||
return callback(new Error('[[error:invalid-data]]'));
|
return callback(new Error('[[error:invalid-data]]'));
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
var config = JSON.parse('{{configJSON}}');
|
var config = JSON.parse('{{configJSON}}');
|
||||||
var app = {
|
var app = {
|
||||||
template: "{template.name}",
|
template: "{template.name}",
|
||||||
user: JSON.parse('{{userJSON}}')
|
user: JSON.parse('{{userJSON}}'),
|
||||||
|
config: JSON.parse(decodeURIComponent('{{adminConfigJSON}}'))
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user