mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 22:15:48 +01:00
closes #3646
This commit is contained in:
@@ -26,22 +26,6 @@
|
||||
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() {
|
||||
Mousetrap.bind('ctrl+shift+a r', function() {
|
||||
require(['admin/modules/instance'], function(instance) {
|
||||
|
||||
@@ -85,6 +85,9 @@ middleware.renderHeader = function(req, res, data, next) {
|
||||
},
|
||||
config: function(next) {
|
||||
controllers.api.getConfig(req, res, next);
|
||||
},
|
||||
configs: function(next) {
|
||||
meta.configs.list(next);
|
||||
}
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
@@ -96,6 +99,7 @@ middleware.renderHeader = function(req, res, data, next) {
|
||||
config: results.config,
|
||||
configJSON: JSON.stringify(results.config),
|
||||
relative_path: results.config.relative_path,
|
||||
adminConfigJSON: encodeURIComponent(JSON.stringify(results.configs)),
|
||||
user: userData,
|
||||
userJSON: JSON.stringify(userData).replace(/'/g, "\\'"),
|
||||
plugins: results.custom_header.plugins,
|
||||
|
||||
@@ -134,10 +134,6 @@ SocketAdmin.widgets.set = function(socket, data, callback) {
|
||||
widgets.setArea(data, callback);
|
||||
};
|
||||
|
||||
SocketAdmin.config.get = function(socket, data, callback) {
|
||||
meta.configs.list(callback);
|
||||
};
|
||||
|
||||
SocketAdmin.config.set = function(socket, data, callback) {
|
||||
if(!data) {
|
||||
return callback(new Error('[[error:invalid-data]]'));
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
var config = JSON.parse('{{configJSON}}');
|
||||
var app = {
|
||||
template: "{template.name}",
|
||||
user: JSON.parse('{{userJSON}}')
|
||||
user: JSON.parse('{{userJSON}}'),
|
||||
config: JSON.parse(decodeURIComponent('{{adminConfigJSON}}'))
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user