From 8753777c7f671296508b021400d0ed87341d7b8e Mon Sep 17 00:00:00 2001 From: stevepodell Date: Tue, 20 Feb 2024 11:32:29 -0800 Subject: [PATCH 1/4] Updated webpack to use wevotedeveloper.com SSL if configured Works on Safari and Firefox for webapp, but not on Chrome. Works on Chrome for local Python API server. --- src/js/components/Widgets/StorybookRedirect.jsx | 12 ++++++++++++ webpack.config.js | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/js/components/Widgets/StorybookRedirect.jsx diff --git a/src/js/components/Widgets/StorybookRedirect.jsx b/src/js/components/Widgets/StorybookRedirect.jsx new file mode 100644 index 000000000..ae049c55d --- /dev/null +++ b/src/js/components/Widgets/StorybookRedirect.jsx @@ -0,0 +1,12 @@ +import React from 'react'; +import { renderLog } from '../../common/utils/logging'; + + +// React functional component example +export default function StorybookRedirect () { + renderLog('StorybookRedirect functional component'); + + return ( + Redirect to Html page + ); +} diff --git a/webpack.config.js b/webpack.config.js index e3378a920..c0cd09730 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -29,6 +29,8 @@ if (major < 13) { } else { console.log(`Node version is: ${process.version}`); } +console.log('useRealCerts in webpack.config.js ', useRealCerts); +console.log('key: ', fs.readFileSync(`./${source}/cert/wevotedeveloper.com.crt`).toString()); module.exports = (env, argv) => ({ entry: path.resolve(__dirname, `./${source}/index.jsx`), @@ -166,7 +168,7 @@ module.exports = (env, argv) => ({ static: { directory: path.join(__dirname, './build'), }, - host: 'localhost', + host: (useRealCerts ? 'wevotedeveloper.com' : 'localhost'), port, historyApiFallback: true, // open: true, From 05a8a406881da55f30b3c3f94facbb2f17cf2fd0 Mon Sep 17 00:00:00 2001 From: stevepodell Date: Tue, 20 Feb 2024 11:39:42 -0800 Subject: [PATCH 2/4] Updated webpack to use wevotedeveloper.com SSL if configured Works on Safari and Firefox for webapp, but not on Chrome. Works on Chrome for local Python API server. --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index c0cd09730..5bdd2f98d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,7 +30,7 @@ if (major < 13) { console.log(`Node version is: ${process.version}`); } console.log('useRealCerts in webpack.config.js ', useRealCerts); -console.log('key: ', fs.readFileSync(`./${source}/cert/wevotedeveloper.com.crt`).toString()); +// console.log('key: ', fs.readFileSync(`./${source}/cert/wevotedeveloper.com.crt`).toString()); module.exports = (env, argv) => ({ entry: path.resolve(__dirname, `./${source}/index.jsx`), From 437c5ce0e76816915ac5ceba891b1f26a0252da4 Mon Sep 17 00:00:00 2001 From: stevepodell Date: Tue, 20 Feb 2024 13:24:58 -0800 Subject: [PATCH 3/4] Updated webpack to use wevotedeveloper.com SSL if configured Works on Safari and Firefox for webapp, but not on Chrome. Works on Chrome for local Python API server. --- serverWevotedeveloper.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 serverWevotedeveloper.js diff --git a/serverWevotedeveloper.js b/serverWevotedeveloper.js new file mode 100644 index 000000000..37e76be74 --- /dev/null +++ b/serverWevotedeveloper.js @@ -0,0 +1,25 @@ +/* eslint-disable */ +// start the express server +const express = require("express"); +const app = express(); +const fs = require("fs"); +const https = require("https"); +const path = require("path"); +const webAppConfig = require("./src/js/config"); + +const port = 3000; +const opts = { redirect: true }; +const hostname = "wevotedeveloper.com"; + +app.use("/", express.static("build", opts)); +app.all("*", (req, res) => res.sendFile(__dirname + "/build/index.html")); + +const certOptions = { + key: fs.readFileSync(path.resolve(__dirname + "/src/cert/wevotedeveloper.com_key.txt")), + cert: fs.readFileSync(path.resolve(__dirname + "/src/cert/wevotedeveloper.com.crt")), +}; + +const server = https.createServer(certOptions, app).listen(port, function () { + console.log("INFO: https server started", new Date()); + console.log(`INFO: Server is at https://${hostname}:${port}`); +}); From cd24729235d06280d39c4cd6ce8c37a4b2261f3e Mon Sep 17 00:00:00 2001 From: stevepodell Date: Tue, 20 Feb 2024 13:26:14 -0800 Subject: [PATCH 4/4] Updated webpack to use wevotedeveloper.com SSL if configured Works on Safari and Firefox for webapp, but not on Chrome. Works on Chrome for local Python API server. --- serverWevotedeveloper.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/serverWevotedeveloper.js b/serverWevotedeveloper.js index 37e76be74..66d6b87b2 100644 --- a/serverWevotedeveloper.js +++ b/serverWevotedeveloper.js @@ -1,5 +1,10 @@ /* eslint-disable */ + // start the express server + +// invoke: +// node serverWevotedeveloper.js + const express = require("express"); const app = express(); const fs = require("fs");