1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure RED._ is defined before initialising settings

- remove permissions requirement from locales files so the
   login dialog can be nls'd
This commit is contained in:
Nick O'Leary 2015-07-08 17:07:14 +01:00
parent d0af4aac4d
commit f70e9ea076
2 changed files with 11 additions and 13 deletions

View File

@ -16,10 +16,6 @@
var RED = (function() { var RED = (function() {
function loadLocales() {
RED.i18n.init(loadEditor);
}
function loadNodeList() { function loadNodeList() {
$.ajax({ $.ajax({
headers: { headers: {
@ -225,7 +221,9 @@ var RED = (function() {
ace.require("ace/ext/language_tools"); ace.require("ace/ext/language_tools");
RED.settings.init(loadLocales); RED.i18n.init(function() {
RED.settings.init(loadEditor);
})
}); });

View File

@ -38,9 +38,9 @@ var errorHandler = function(err,req,res,next) {
}; };
function init(adminApp,storage) { function init(adminApp,storage) {
auth.init(settings,storage); auth.init(settings,storage);
// Editor // Editor
if (!settings.disableEditor) { if (!settings.disableEditor) {
ui.init(settings); ui.init(settings);
@ -58,7 +58,7 @@ function init(adminApp,storage) {
adminApp.use(express.urlencoded()); adminApp.use(express.urlencoded());
adminApp.get("/auth/login",auth.login); adminApp.get("/auth/login",auth.login);
if (settings.adminAuth) { if (settings.adminAuth) {
//TODO: all passport references ought to be in ./auth //TODO: all passport references ought to be in ./auth
adminApp.use(passport.initialize()); adminApp.use(passport.initialize());
@ -74,7 +74,7 @@ function init(adminApp,storage) {
// Flows // Flows
adminApp.get("/flows",needsPermission("flows.read"),flows.get); adminApp.get("/flows",needsPermission("flows.read"),flows.get);
adminApp.post("/flows",needsPermission("flows.write"),flows.post); adminApp.post("/flows",needsPermission("flows.write"),flows.post);
// Nodes // Nodes
adminApp.get("/nodes",needsPermission("nodes.read"),nodes.getAll); adminApp.get("/nodes",needsPermission("nodes.read"),nodes.getAll);
adminApp.post("/nodes",needsPermission("nodes.write"),nodes.post); adminApp.post("/nodes",needsPermission("nodes.write"),nodes.post);
@ -82,21 +82,21 @@ function init(adminApp,storage) {
adminApp.get("/nodes/:mod",needsPermission("nodes.read"),nodes.getModule); adminApp.get("/nodes/:mod",needsPermission("nodes.read"),nodes.getModule);
adminApp.put("/nodes/:mod",needsPermission("nodes.write"),nodes.putModule); adminApp.put("/nodes/:mod",needsPermission("nodes.write"),nodes.putModule);
adminApp.delete("/nodes/:mod",needsPermission("nodes.write"),nodes.delete); adminApp.delete("/nodes/:mod",needsPermission("nodes.write"),nodes.delete);
adminApp.get("/nodes/:mod/:set",needsPermission("nodes.read"),nodes.getSet); adminApp.get("/nodes/:mod/:set",needsPermission("nodes.read"),nodes.getSet);
adminApp.put("/nodes/:mod/:set",needsPermission("nodes.write"),nodes.putSet); adminApp.put("/nodes/:mod/:set",needsPermission("nodes.write"),nodes.putSet);
adminApp.get(/locales\/(.+)\/?$/,needsPermission("nodes.read"),locales.get); adminApp.get(/locales\/(.+)\/?$/,locales.get);
// Library // Library
library.init(adminApp); library.init(adminApp);
adminApp.post(new RegExp("/library/flows\/(.*)"),needsPermission("library.write"),library.post); adminApp.post(new RegExp("/library/flows\/(.*)"),needsPermission("library.write"),library.post);
adminApp.get("/library/flows",needsPermission("library.read"),library.getAll); adminApp.get("/library/flows",needsPermission("library.read"),library.getAll);
adminApp.get(new RegExp("/library/flows\/(.*)"),needsPermission("library.read"),library.get); adminApp.get(new RegExp("/library/flows\/(.*)"),needsPermission("library.read"),library.get);
// Settings // Settings
adminApp.get("/settings",needsPermission("settings.read"),info.settings); adminApp.get("/settings",needsPermission("settings.read"),info.settings);
// Error Handler // Error Handler
adminApp.use(errorHandler); adminApp.use(errorHandler);
} }