From 67b5887ba516cd4f9be922aa1fc4fc0c719eb10c Mon Sep 17 00:00:00 2001 From: bill bittner Date: Mon, 2 Jul 2018 18:22:06 -0700 Subject: [PATCH 1/7] fixed layout path --- index.js | 11 ++++++----- server/controllers/pages/sendVideoEmbedPage.js | 2 +- server/views/embed.handlebars | 2 +- server/views/layouts/embed.handlebars | 10 +++++----- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index be30317c..75097f3b 100644 --- a/index.js +++ b/index.js @@ -16,7 +16,6 @@ checkForConfig('siteConfig'); const express = require('express'); const bodyParser = require('body-parser'); const expressHandlebars = require('express-handlebars'); -const Handlebars = require('handlebars'); const helmet = require('helmet'); const cookieSession = require('cookie-session'); const http = require('http'); @@ -81,11 +80,13 @@ function Server () { app.use(speechPassport.session()); // configure handlebars & register it with express app - const hbs = expressHandlebars.create({ + const viewsPath = Path.resolve(process.cwd(), 'node_modules/spee.ch/server/views'); + app.engine('handlebars', expressHandlebars({ defaultLayout: 'embed', - handlebars : Handlebars, - }); - app.engine('handlebars', hbs.engine); + partialsDir: Path.join(viewsPath, '/partials'), + layoutsDir: Path.join(viewsPath, '/layouts') + })); + app.set('views', viewsPath); app.set('view engine', 'handlebars'); // set the routes on the app diff --git a/server/controllers/pages/sendVideoEmbedPage.js b/server/controllers/pages/sendVideoEmbedPage.js index 01f6b1f4..a401360a 100644 --- a/server/controllers/pages/sendVideoEmbedPage.js +++ b/server/controllers/pages/sendVideoEmbedPage.js @@ -4,7 +4,7 @@ const sendVideoEmbedPage = ({ params }, res) => { const claimId = params.claimId; const name = params.name; // get and render the content - res.status(200).render('embed', { layout: 'embed', host, claimId, name }); + res.status(200).render('embed', { host, claimId, name }); }; module.exports = sendVideoEmbedPage; diff --git a/server/views/embed.handlebars b/server/views/embed.handlebars index eb6c4839..c0b2e4f5 100644 --- a/server/views/embed.handlebars +++ b/server/views/embed.handlebars @@ -1 +1 @@ - + diff --git a/server/views/layouts/embed.handlebars b/server/views/layouts/embed.handlebars index 59b5b52f..6626e1f5 100644 --- a/server/views/layouts/embed.handlebars +++ b/server/views/layouts/embed.handlebars @@ -3,14 +3,14 @@ {{{body}}} - \ No newline at end of file + From af0595641ad082861594fc084452da9b413129a2 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Mon, 2 Jul 2018 22:47:18 -0700 Subject: [PATCH 2/7] testing iframe page --- index.js | 2 ++ server/controllers/pages/sendVideoEmbedPage.js | 3 +++ server/views/embed.handlebars | 5 ++++- server/views/layouts/embed.handlebars | 14 +++++++------- test/iframeTest.htm | 9 +++++++++ test/test.html | 6 ++++++ 6 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 test/iframeTest.htm diff --git a/index.js b/index.js index 75097f3b..2c2843c6 100644 --- a/index.js +++ b/index.js @@ -82,6 +82,8 @@ function Server () { // configure handlebars & register it with express app const viewsPath = Path.resolve(process.cwd(), 'node_modules/spee.ch/server/views'); app.engine('handlebars', expressHandlebars({ + async: false, + dataType: 'text', defaultLayout: 'embed', partialsDir: Path.join(viewsPath, '/partials'), layoutsDir: Path.join(viewsPath, '/layouts') diff --git a/server/controllers/pages/sendVideoEmbedPage.js b/server/controllers/pages/sendVideoEmbedPage.js index a401360a..3c4cf9af 100644 --- a/server/controllers/pages/sendVideoEmbedPage.js +++ b/server/controllers/pages/sendVideoEmbedPage.js @@ -3,6 +3,9 @@ const { details: { host } } = require('@config/siteConfig'); const sendVideoEmbedPage = ({ params }, res) => { const claimId = params.claimId; const name = params.name; + console.log('HOST:', host); + console.log('CLAIM ID:', claimId); + console.log('NAME:', name); // get and render the content res.status(200).render('embed', { host, claimId, name }); }; diff --git a/server/views/embed.handlebars b/server/views/embed.handlebars index c0b2e4f5..9cc0d40e 100644 --- a/server/views/embed.handlebars +++ b/server/views/embed.handlebars @@ -1 +1,4 @@ - + diff --git a/server/views/layouts/embed.handlebars b/server/views/layouts/embed.handlebars index 6626e1f5..c9202662 100644 --- a/server/views/layouts/embed.handlebars +++ b/server/views/layouts/embed.handlebars @@ -1,16 +1,16 @@ - + -{{{body}}} +{{{ body }}} diff --git a/test/iframeTest.htm b/test/iframeTest.htm new file mode 100644 index 00000000..22af6fef --- /dev/null +++ b/test/iframeTest.htm @@ -0,0 +1,9 @@ + + + + +

i frame:

+

yes identifier, yes ending

+ yes identifier, yes ending + + diff --git a/test/test.html b/test/test.html index 01a5d622..1d92227f 100644 --- a/test/test.html +++ b/test/test.html @@ -17,5 +17,11 @@ yes identifier, no ending

yes identifier, yes ending

yes identifier, yes ending +

i frame:

+ +

i frame:

+ From 802f8ac7c306a2d95cde9388eec6f428a0d5d024 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Tue, 3 Jul 2018 09:03:58 -0700 Subject: [PATCH 3/7] updated test --- test/test.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/test.html b/test/test.html index 1d92227f..a594079b 100644 --- a/test/test.html +++ b/test/test.html @@ -17,11 +17,19 @@ yes identifier, no ending

yes identifier, yes ending

yes identifier, yes ending -

i frame:

- -

i frame:

+

i frame 1:

+ +

i frame 2:

+

i frame 3:

+ +

i frame 4:

+ From 5c62b98d5375498ebdde89b8b130ba5894e3dfd6 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Wed, 11 Jul 2018 16:42:40 -0700 Subject: [PATCH 4/7] updated nav-bar spacing --- client/scss/_variables.scss | 1 + client/scss/components/_nav-bar.scss | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/scss/_variables.scss b/client/scss/_variables.scss index 2716def5..26f125d8 100644 --- a/client/scss/_variables.scss +++ b/client/scss/_variables.scss @@ -8,6 +8,7 @@ $failure-color: red; $primary-padding: 3em; $secondary-padding: 2em; +$tertiary-padding: 1em; $thin-padding: 0.3em; $full-width-thin-padding: calc(100% - 0.6em); diff --git a/client/scss/components/_nav-bar.scss b/client/scss/components/_nav-bar.scss index e61211bf..8d5e3f37 100644 --- a/client/scss/components/_nav-bar.scss +++ b/client/scss/components/_nav-bar.scss @@ -8,7 +8,7 @@ } .nav-bar-link { - padding: $secondary-padding; + padding: calc(1em - 2px); display: inline-block; } From eb2f60d6af329d202f6bde4eca54dda0b8f433e6 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Wed, 11 Jul 2018 17:06:06 -0700 Subject: [PATCH 5/7] centered dropzone instruction text --- .../DropzoneInstructionsDisplay/index.js | 14 ++++++---- .../DropzoneInstructionsDisplay/index.jsx | 27 ++++++++++++++----- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/client/build/components/DropzoneInstructionsDisplay/index.js b/client/build/components/DropzoneInstructionsDisplay/index.js index fdaec59e..04139032 100644 --- a/client/build/components/DropzoneInstructionsDisplay/index.js +++ b/client/build/components/DropzoneInstructionsDisplay/index.js @@ -9,22 +9,26 @@ var _react = _interopRequireDefault(require("react")); var _FormFeedbackDisplay = _interopRequireDefault(require("@components/FormFeedbackDisplay")); +var _Row = _interopRequireDefault(require("@components/Row")); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var DropzoneInstructionsDisplay = function DropzoneInstructionsDisplay(_ref) { var fileError = _ref.fileError; return _react.default.createElement("div", { className: 'dropzone-instructions-display' - }, _react.default.createElement("p", { + }, _react.default.createElement(_Row.default, null, _react.default.createElement("p", { className: 'text--large' - }, "Drag & drop image or video here to publish"), _react.default.createElement("p", { + }, "Drag & drop image or video here to publish")), _react.default.createElement(_Row.default, null, _react.default.createElement("p", { className: 'text--small' - }, "OR"), _react.default.createElement("p", { + }, "OR")), fileError ? _react.default.createElement("div", null, _react.default.createElement(_Row.default, null, _react.default.createElement("p", { className: 'text--large text--underline' - }, "CHOOSE FILE"), _react.default.createElement(_FormFeedbackDisplay.default, { + }, "CHOOSE FILE")), _react.default.createElement(_FormFeedbackDisplay.default, { errorMessage: fileError, defaultMessage: false - })); + })) : _react.default.createElement("p", { + className: 'text--large text--underline' + }, "CHOOSE FILE")); }; var _default = DropzoneInstructionsDisplay; diff --git a/client/src/components/DropzoneInstructionsDisplay/index.jsx b/client/src/components/DropzoneInstructionsDisplay/index.jsx index cb06392b..3f13c69f 100644 --- a/client/src/components/DropzoneInstructionsDisplay/index.jsx +++ b/client/src/components/DropzoneInstructionsDisplay/index.jsx @@ -1,16 +1,29 @@ import React from 'react'; import FormFeedbackDisplay from '@components/FormFeedbackDisplay'; +import Row from '@components/Row'; const DropzoneInstructionsDisplay = ({fileError}) => { return (
-

Drag & drop image or video here to publish

-

OR

-

CHOOSE FILE

- + +

Drag & drop image or video here to publish

+
+ +

OR

+
+ { fileError ? ( +
+ +

CHOOSE FILE

+
+ +
+ ) : ( +

CHOOSE FILE

+ )}
); }; From 04a653fefb762017e5647d26da687343c555f261 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 12 Jul 2018 11:30:27 -0700 Subject: [PATCH 6/7] updated the iframe test page --- test/iframeTest.htm | 9 ------ test/{test.html => test-embed.html} | 18 +++--------- test/test-iframe.html | 44 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 23 deletions(-) delete mode 100644 test/iframeTest.htm rename test/{test.html => test-embed.html} (62%) create mode 100644 test/test-iframe.html diff --git a/test/iframeTest.htm b/test/iframeTest.htm deleted file mode 100644 index 22af6fef..00000000 --- a/test/iframeTest.htm +++ /dev/null @@ -1,9 +0,0 @@ - - - - -

i frame:

-

yes identifier, yes ending

- yes identifier, yes ending - - diff --git a/test/test.html b/test/test-embed.html similarity index 62% rename from test/test.html rename to test/test-embed.html index a594079b..b0953586 100644 --- a/test/test.html +++ b/test/test-embed.html @@ -9,27 +9,17 @@ test embed +

no identifier, no ending

no identifier, no ending +

no identifier, yes ending

no identifier, yes ending +

yes identifier, no ending

yes identifier, no ending +

yes identifier, yes ending

yes identifier, yes ending -

i frame 1:

- -

i frame 2:

- -

i frame 3:

- -

i frame 4:

- diff --git a/test/test-iframe.html b/test/test-iframe.html new file mode 100644 index 00000000..86e4dbff --- /dev/null +++ b/test/test-iframe.html @@ -0,0 +1,44 @@ + + + + + + + Document + + + +

i frame: weather.gov

+ + +

i frame: dev1.spee.ch video direct embed page

+ + +

i frame: dev1.spee.ch image direct asset

+ + +

i frame: image from internet

+ + +

i frame: giphy

+ + +

i frame: giphy 2

+ + + From 7400fba3ad27c6e5203499b5c969ca06b579f955 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 12 Jul 2018 12:44:53 -0700 Subject: [PATCH 7/7] removed X-Frame-Option from video-embed response headers --- server/controllers/pages/sendVideoEmbedPage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/controllers/pages/sendVideoEmbedPage.js b/server/controllers/pages/sendVideoEmbedPage.js index 3c4cf9af..79d7eefa 100644 --- a/server/controllers/pages/sendVideoEmbedPage.js +++ b/server/controllers/pages/sendVideoEmbedPage.js @@ -3,9 +3,9 @@ const { details: { host } } = require('@config/siteConfig'); const sendVideoEmbedPage = ({ params }, res) => { const claimId = params.claimId; const name = params.name; - console.log('HOST:', host); - console.log('CLAIM ID:', claimId); - console.log('NAME:', name); + // test setting response headers + console.log('removing x-frame-options'); + res.removeHeader('X-Frame-Options'); // get and render the content res.status(200).render('embed', { host, claimId, name }); };