|
|
@ -1,40 +1,41 @@
|
|
|
|
'use strict';
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var async = require('async');
|
|
|
|
var nconf = require('nconf');
|
|
|
|
var nconf = require('nconf');
|
|
|
|
|
|
|
|
|
|
|
|
var admin = require('./admin');
|
|
|
|
var admin = require('./admin');
|
|
|
|
var translator = require('../translator');
|
|
|
|
var translator = require('../translator');
|
|
|
|
|
|
|
|
|
|
|
|
var navigation = {};
|
|
|
|
var navigation = module.exports;
|
|
|
|
|
|
|
|
|
|
|
|
navigation.get = function (callback) {
|
|
|
|
navigation.get = function (callback) {
|
|
|
|
if (admin.cache) {
|
|
|
|
if (admin.cache) {
|
|
|
|
return callback(null, admin.cache);
|
|
|
|
return callback(null, admin.cache);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
admin.get(function (err, data) {
|
|
|
|
async.waterfall([
|
|
|
|
if (err) {
|
|
|
|
admin.get,
|
|
|
|
return callback(err);
|
|
|
|
function (data, next) {
|
|
|
|
}
|
|
|
|
data = data.filter(function (item) {
|
|
|
|
|
|
|
|
return item && item.enabled;
|
|
|
|
data = data.filter(function (item) {
|
|
|
|
}).map(function (item) {
|
|
|
|
return item && item.enabled;
|
|
|
|
if (!item.route.startsWith('http')) {
|
|
|
|
}).map(function (item) {
|
|
|
|
item.route = nconf.get('relative_path') + item.route;
|
|
|
|
if (!item.route.startsWith('http')) {
|
|
|
|
}
|
|
|
|
item.route = nconf.get('relative_path') + item.route;
|
|
|
|
|
|
|
|
}
|
|
|
|
for (var i in item) {
|
|
|
|
|
|
|
|
if (item.hasOwnProperty(i)) {
|
|
|
|
for (var i in item) {
|
|
|
|
item[i] = translator.unescape(item[i]);
|
|
|
|
if (item.hasOwnProperty(i)) {
|
|
|
|
}
|
|
|
|
item[i] = translator.unescape(item[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return item;
|
|
|
|
return item;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
admin.cache = data;
|
|
|
|
admin.cache = data;
|
|
|
|
|
|
|
|
|
|
|
|
callback(null, data);
|
|
|
|
next(null, data);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
], callback);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|