From 629ddf78860ea929c9a3fc3bb56fa37114d7784e Mon Sep 17 00:00:00 2001 From: Jackie Luo Date: Tue, 23 Aug 2016 10:46:27 -0700 Subject: [PATCH] feat(onboarding): Allow HTTPS in self-hosted sync engine onboarding --- .../lib/page-self-hosting-config.jsx | 20 +++++++++++++++++-- .../onboarding/stylesheets/onboarding.less | 7 +++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/internal_packages/onboarding/lib/page-self-hosting-config.jsx b/internal_packages/onboarding/lib/page-self-hosting-config.jsx index 62eaab966..bc84e5928 100644 --- a/internal_packages/onboarding/lib/page-self-hosting-config.jsx +++ b/internal_packages/onboarding/lib/page-self-hosting-config.jsx @@ -14,6 +14,7 @@ class SelfHostingConfigPage extends React.Component { constructor(props) { super(props) this.state = { + usesHTTPS: false, url: "", port: "", error: null, @@ -32,6 +33,12 @@ class SelfHostingConfigPage extends React.Component { }) } + _onChangeProtocol = (event) => { + this.setState({ + usesHTTPS: !this.state.usesHTTPS, + }) + } + _addAccountJSON = () => { // Connect to local sync engine's /accounts endpoint and add accounts to N1 const xmlHttp = new XMLHttpRequest() @@ -57,7 +64,7 @@ class SelfHostingConfigPage extends React.Component { return } NylasEnv.config.set('env', 'custom') - NylasEnv.config.set('syncEngine.APIRoot', `http://${this.state.url}:${this.state.port}`) + NylasEnv.config.set('syncEngine.APIRoot', `http${this.state.usesHTTPS ? "s" : ""}://${this.state.url}:${this.state.port}`) Actions.setNylasIdentity({ token: "SELFHOSTEDSYNCENGINE", firstname: "", @@ -116,7 +123,7 @@ class SelfHostingConfigPage extends React.Component {
-

{`http://`}

+

{`http${this.state.usesHTTPS ? "s" : ""}://`}

@@ -142,6 +149,15 @@ class SelfHostingConfigPage extends React.Component { />
+
+ + +