diff --git a/client/pages/adminpage/setup.js b/client/pages/adminpage/setup.js
index 1654002d..2e84f4e6 100644
--- a/client/pages/adminpage/setup.js
+++ b/client/pages/adminpage/setup.js
@@ -67,31 +67,6 @@ export class SetupPage extends React.Component {
});
}
- onExposeInstance(choice, done){
- this.setState({busy: true});
- return Config.all().then((config) => {
- config = FormObjToJSON(config);
- config.connections = window.CONFIG.connections;
- switch(choice){
- case "tunnel":
- config.features.server.enable_tunnel = true;
- break;
- default:
- config.features.server.enable_tunnel = false;
- break;
- }
- Config.save(config, false)
- .then(() => this.setState({busy: false}, done))
- .catch((err) => {
- notify.send(err && err.message, "error");
- this.setState({busy: false});
- });
- }).catch((err) => {
- notify.send(err && err.message, "error");
- this.setState({busy: false});
- });
- }
-
enableLog(value){
Config.all().then((config) => {
config = FormObjToJSON(config);
@@ -111,7 +86,7 @@ export class SetupPage extends React.Component {
"name_failure": "SSL is not configured properly",
"pass": window.location.protocol !== "http:",
"severe": true,
- "message": "This can lead to data leaks. Please use a SSL certificate or expose your instance via a filestash domain"
+ "message": "This can lead to data leaks. Please use a SSL certificate"
}, {
"name_success": "Application is running as '" + objectGet(config, ["constant", "user", "value"]) + "'",
"name_failure": "Application is running as root",
@@ -137,22 +112,13 @@ export class SetupPage extends React.Component {
this.setState({busy: false});
});
}
- tunnelCall(){
- this.setState({busy: true});
- return Config.all().then((config) => {
- //this.setState({busy: false});
- return objectGet(config, ["features", "server", "tunnel_url", "value"]);
- });
- }
render(){
return (
+ summaryCall={this.summaryCall.bind(this)} />
);
}
@@ -166,73 +132,29 @@ class MultiStepForm extends React.Component {
current: parseInt(window.location.hash.replace("#", "")) || 0,
answer_password: "",
has_answered_password: false,
- answer_expose: "",
- has_answered_expose: false,
- deps: [],
- redirect_uri: null,
- working_message: "Working"
+ deps: []
};
}
componentDidMount(){
- if(this.state.current == 2){
- this.fetchDependencies();
+ if(this.state.current === 1){
+ this.props.summaryCall().then((deps) => {
+ this.setState({deps: deps});
+ });
}
}
onAdminPassword(e){
e.preventDefault();
this.props.onAdminPassword(this.state.answer_password, () => {
- this.setState({current: 1, has_answered_password: true});
- });
- }
-
- onExposeInstance(value, e){
- e.preventDefault();
- this.setState({answer_expose: value});
- this.props.onExposeInstance(value, () => {
- if(value === "tunnel"){
- const waitForDomain = (count = 0) => {
- return this.props.tunnelCall().then((url) => {
- if(url && /\.filestash\.app$/.test(url) === true){
- return Promise.resolve(url);
- }
- if(count > 10){
- this.setState({working_message: "Building your domain"});
- }else if(count > 30){
- this.setState({working_message: "Processing ."+".".repeat(count % 3)});
- }
- if(count >= 60){
- return Promise.reject({message: "Couldn't create a domain name"});
- }
- return new Promise((done) => window.setTimeout(done, 1000))
- .then(() => waitForDomain(count + 1));
- });
- };
- waitForDomain().then((url) => {
- this.setState({redirect_uri: url});
- }).catch((err) => {
- window.location.hash = "#2";
- window.location.reload();
- });
- } else {
- this.setState({current: 2, has_answered_expose: true}, () => {
- this.onStepChange(2);
- });
- }
+ this.setState({has_answered_password: true});
+ this.onStepChange(1);
});
}
onStepChange(n){
- this.setState({current: n});
- if(n === 2){
- this.fetchDependencies();
- }
- }
-
- fetchDependencies() {
- this.props.summaryCall().then((deps) => {
- this.setState({deps: deps});
+ this.setState({current: n}, () => {
+ if(n === 1) this.componentDidMount();
});
}
@@ -242,11 +164,11 @@ class MultiStepForm extends React.Component {
return (
- Step 1/2: Secure your instance
+ Admin Password
-
Create your admin password:
+
Create your instance admin password: