From dbdbfc6d7537a2a1b0314c121b0e627e02565b2c Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 23 Aug 2016 15:10:46 -0400 Subject: [PATCH 1/2] allowing the port to be defined by a custom port environment variable, for certain hosting environments --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index 7fdee397f9..c633af9932 100644 --- a/app.js +++ b/app.js @@ -124,7 +124,7 @@ function start() { nconf.set('secure', urlObject.protocol === 'https:'); nconf.set('use_port', !!urlObject.port); nconf.set('relative_path', relativePath); - nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || 4567); + nconf.set('port', urlObject.port || nconf.get('port') || nconf.get('PORT') || (nconf.get('PORT_ENV_VAR') ? nconf.get(nconf.get('PORT_ENV_VAR')) : false) || 4567); nconf.set('upload_url', nconf.get('upload_path').replace(/^\/public/, '')); if (nconf.get('isPrimary') === 'true') { From 598935b3bfbca89fe176c7f2050325e6de6811d9 Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Tue, 23 Aug 2016 19:35:50 -0500 Subject: [PATCH 2/2] Fix null object in search for users with no preferences set. localStorage.getItem returned null, and JSON.parse(null) is null. --- public/src/modules/search.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/src/modules/search.js b/public/src/modules/search.js index be6ac6a711..147683c550 100644 --- a/public/src/modules/search.js +++ b/public/src/modules/search.js @@ -75,7 +75,7 @@ define('search', ['navigator', 'translator'], function(nav, translator) { Search.getSearchPreferences = function() { try { - return JSON.parse(localStorage.getItem('search-preferences')); + return JSON.parse(localStorage.getItem('search-preferences') || '{}'); } catch(e) { return {}; } @@ -179,4 +179,4 @@ define('search', ['navigator', 'translator'], function(nav, translator) { }; return Search; -}); \ No newline at end of file +});