diff --git a/red/api/editor/index.js b/red/api/editor/index.js index d204d9411..10f3c70b7 100644 --- a/red/api/editor/index.js +++ b/red/api/editor/index.js @@ -83,7 +83,7 @@ module.exports = { // Locales var locales = require("./locales"); - locales.init(runtime); + locales.init(runtimeAPI); editorApp.get('/locales/nodes',locales.getAllNodes,apiUtil.errorHandler); editorApp.get(/locales\/(.+)\/?$/,locales.get,apiUtil.errorHandler); @@ -124,6 +124,5 @@ module.exports = { }); }, stop: comms.stop, - publish: comms.publish, - registerLibrary: library.register + publish: comms.publish } diff --git a/red/api/editor/locales.js b/red/api/editor/locales.js index 32bfa5c80..464933d90 100644 --- a/red/api/editor/locales.js +++ b/red/api/editor/locales.js @@ -16,13 +16,14 @@ var fs = require('fs'); var path = require('path'); //var apiUtil = require('../util'); -var i18n; -var redNodes; + +var i18n = require("../../util").i18n; // TODO: separate module + +var runtimeAPI; module.exports = { - init: function(runtime) { - i18n = runtime.i18n; - redNodes = runtime.nodes; + init: function(_runtimeAPI) { + runtimeAPI = _runtimeAPI; }, get: function(req,res) { var namespace = req.params[0]; @@ -40,13 +41,17 @@ module.exports = { }, getAllNodes: function(req,res) { var lngs = req.query.lng; - var nodeList = redNodes.getNodeList(); - var result = {}; - nodeList.forEach(function(n) { - if (n.module !== "node-red") { - result[n.id] = i18n.catalog(n.id,lngs)||{}; - } - }); - res.json(result); + var opts = { + user: req.user + } + runtimeAPI.nodes.getNodeList(opts).then(function(nodeList) { + var result = {}; + nodeList.forEach(function(n) { + if (n.module !== "node-red") { + result[n.id] = i18n.catalog(n.id,lngs)||{}; + } + }); + res.json(result); + }) } }