diff --git a/browser/components/loop/standalone/package.json b/browser/components/loop/standalone/package.json index b7214f8c5a39..e84242bcc6f4 100644 --- a/browser/components/loop/standalone/package.json +++ b/browser/components/loop/standalone/package.json @@ -14,7 +14,7 @@ "devDependencies": { "eslint": "0.20.x", "eslint-plugin-react": "2.2.x", - "express": "3.x" + "express": "4.x" }, "scripts": { "test": "make test", diff --git a/browser/components/loop/standalone/server.js b/browser/components/loop/standalone/server.js index 8288be44738f..bec565736145 100644 --- a/browser/components/loop/standalone/server.js +++ b/browser/components/loop/standalone/server.js @@ -13,10 +13,16 @@ var express = require('express'); var app = express(); var port = process.env.PORT || 3000; -var loopServerPort = process.env.LOOP_SERVER_PORT || 5000; var feedbackApiUrl = process.env.LOOP_FEEDBACK_API_URL || "https://input.allizom.org/api/v1/feedback"; var feedbackProductName = process.env.LOOP_FEEDBACK_PRODUCT_NAME || "Loop"; +var loopServerUrl = process.env.LOOP_SERVER_URL || "http://localhost:5000"; + +// Remove trailing slashes as double slashes in the url can confuse the server +// responses. +if (loopServerUrl[loopServerUrl.length - 1] === "/") { + loopServerUrl = loopServerUrl.slice(0, -1); +} function getConfigFile(req, res) { "use strict"; @@ -25,7 +31,7 @@ function getConfigFile(req, res) { res.send([ "var loop = loop || {};", "loop.config = loop.config || {};", - "loop.config.serverUrl = 'http://localhost:" + loopServerPort + "/v0';", + "loop.config.serverUrl = '" + loopServerUrl + "/v0';", "loop.config.feedbackApiUrl = '" + feedbackApiUrl + "';", "loop.config.feedbackProductName = '" + feedbackProductName + "';", // XXX Update with the real marketplace url once the FxOS Loop app is @@ -54,7 +60,6 @@ app.get('/content/c/config.js', getConfigFile); // /ui - for the ui showcase // /content - for the standalone files. -app.use('/test', express.static(__dirname + '/../test')); app.use('/ui', express.static(__dirname + '/../ui')); // This exists exclusively for the unit tests. They are served the @@ -71,6 +76,10 @@ app.use('/content', express.static(__dirname + '/../content')); app.use('/content/c', express.static(__dirname + '/content')); app.use('/content/c', express.static(__dirname + '/../content')); +// Two lines for the same reason as /content above. +app.use('/test', express.static(__dirname + '/test')); +app.use('/test', express.static(__dirname + '/../test')); + // As we don't have hashes on the urls, the best way to serve the index files // appears to be to be to closely filter the url and match appropriately. function serveIndex(req, res) { diff --git a/browser/components/loop/test/functional/config.py b/browser/components/loop/test/functional/config.py index 940ef234419e..5441c5bd4a56 100644 --- a/browser/components/loop/test/functional/config.py +++ b/browser/components/loop/test/functional/config.py @@ -1,8 +1,9 @@ # Loop server configuration CONTENT_SERVER_PORT = 3001 LOOP_SERVER_PORT = 5001 +LOOP_SERVER_URL = "http://localhost:" + str(LOOP_SERVER_PORT) FIREFOX_PREFERENCES = { - "loop.server": "http://localhost:" + str(LOOP_SERVER_PORT), + "loop.server": LOOP_SERVER_URL + "/v0", "browser.dom.window.dump.enabled": True, # Some more changes might be necesarry to have this working in offline mode "media.peerconnection.default_iceservers": "[]", diff --git a/browser/components/loop/test/functional/serversetup.py b/browser/components/loop/test/functional/serversetup.py index cbda74141ae3..2e7cc1d34067 100644 --- a/browser/components/loop/test/functional/serversetup.py +++ b/browser/components/loop/test/functional/serversetup.py @@ -21,7 +21,7 @@ # Set PORT so that it does not interfere with any other # development server that might be running CONTENT_SERVER_ENV.update({"PORT": str(CONTENT_SERVER_PORT), - "LOOP_SERVER_PORT": str(LOOP_SERVER_PORT)}) + "LOOP_SERVER_URL": LOOP_SERVER_URL}) ROOMS_WEB_APP_URL = "http://localhost:" + str(CONTENT_SERVER_PORT) + \ "/content/{token}" @@ -32,7 +32,7 @@ # development server that might be running LOOP_SERVER_ENV.update({"NODE_ENV": "dev", "PORT": str(LOOP_SERVER_PORT), - "SERVER_ADDRESS": "localhost:" + str(LOOP_SERVER_PORT), + "SERVER_ADDRESS": LOOP_SERVER_URL, "ROOMS_WEB_APP_URL": ROOMS_WEB_APP_URL})