From f70e9ea076fba7dbacc60f46024c42c355f3de3f Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 8 Jul 2015 17:07:14 +0100 Subject: [PATCH] Ensure RED._ is defined before initialising settings - remove permissions requirement from locales files so the login dialog can be nls'd --- editor/js/main.js | 8 +++----- red/api/index.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/editor/js/main.js b/editor/js/main.js index bfe446ac2..305fb7092 100644 --- a/editor/js/main.js +++ b/editor/js/main.js @@ -16,10 +16,6 @@ var RED = (function() { - function loadLocales() { - RED.i18n.init(loadEditor); - } - function loadNodeList() { $.ajax({ headers: { @@ -225,7 +221,9 @@ var RED = (function() { ace.require("ace/ext/language_tools"); - RED.settings.init(loadLocales); + RED.i18n.init(function() { + RED.settings.init(loadEditor); + }) }); diff --git a/red/api/index.js b/red/api/index.js index c8fe6ea30..6e2fe8162 100644 --- a/red/api/index.js +++ b/red/api/index.js @@ -38,9 +38,9 @@ var errorHandler = function(err,req,res,next) { }; function init(adminApp,storage) { - + auth.init(settings,storage); - + // Editor if (!settings.disableEditor) { ui.init(settings); @@ -58,7 +58,7 @@ function init(adminApp,storage) { adminApp.use(express.urlencoded()); adminApp.get("/auth/login",auth.login); - + if (settings.adminAuth) { //TODO: all passport references ought to be in ./auth adminApp.use(passport.initialize()); @@ -74,7 +74,7 @@ function init(adminApp,storage) { // Flows adminApp.get("/flows",needsPermission("flows.read"),flows.get); adminApp.post("/flows",needsPermission("flows.write"),flows.post); - + // Nodes adminApp.get("/nodes",needsPermission("nodes.read"),nodes.getAll); 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.put("/nodes/:mod",needsPermission("nodes.write"),nodes.putModule); adminApp.delete("/nodes/:mod",needsPermission("nodes.write"),nodes.delete); - + adminApp.get("/nodes/:mod/:set",needsPermission("nodes.read"),nodes.getSet); 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.init(adminApp); adminApp.post(new RegExp("/library/flows\/(.*)"),needsPermission("library.write"),library.post); adminApp.get("/library/flows",needsPermission("library.read"),library.getAll); adminApp.get(new RegExp("/library/flows\/(.*)"),needsPermission("library.read"),library.get); - + // Settings adminApp.get("/settings",needsPermission("settings.read"),info.settings); - + // Error Handler adminApp.use(errorHandler); }