diff --git a/red/ui.js b/red/ui.js index 52b98112f..93bdfaf71 100644 --- a/red/ui.js +++ b/red/ui.js @@ -14,6 +14,8 @@ * limitations under the License. **/ var express = require('express'); +var util = require('util'); +var crypto = require('crypto'); var fs = require("fs"); var app = express(); var events = require("./events"); @@ -21,13 +23,16 @@ var path = require("path"); var icon_paths = [path.resolve(__dirname + '/../public/icons')]; +var settings; // settings has to be global, otherwise variable not in scope for express + events.on("node-icon-dir",function(dir) { icon_paths.push(path.resolve(dir)); }); -// TODO: nothing here uses settings... so does this need to be a function? -function setupUI(settings) { +function setupUI(_settings) { + + settings = _settings; // TODO confirm if settings are needed // Need to ensure the url ends with a '/' so the static serving works // with relative paths @@ -45,7 +50,7 @@ function setupUI(settings) { app.get("/icons/:icon",function(req,res) { if (iconCache[req.params.icon]) { - res.sendfile(iconCache[req.params.icon]); + res.sendfile(iconCache[req.params.icon]); // if not found, express prints this to the console and serves 404 } else { for (var p=0;p