bugfix missing relay on init

This commit is contained in:
AJ ONeal 2018-06-30 18:18:03 -06:00
parent 27a85a3e73
commit 9e61caaa6c
3 changed files with 7 additions and 5 deletions

View File

@ -494,6 +494,7 @@ function getToken(err, state) {
console.error("Error while initializing config [init]:");
throw err;
}
state.relay = state.config.relay;
// { _otp, config: {} }
common.api.token(state, {
@ -581,7 +582,7 @@ function getToken(err, state) {
, end: function () {
utils.putConfig('enable', [], function (err) {
if (err) { console.error(err); return; }
console.info("[end] Success");
console.info("Success");
// workaround for https://github.com/nodejs/node/issues/21319
if (state._useTty) {
@ -602,8 +603,6 @@ function getToken(err, state) {
}
function parseCli(/*state*/) {
//console.log(parseCli);
//console.log(argv);
if (-1 !== argv.indexOf('init')) {
utils.putConfig('list', []/*, function (err) {
}*/);
@ -663,7 +662,6 @@ function handleConfig(err, config) {
}
//console.log("done questioning:", Date.now());
state.relay = state.config.relay;
if (!state.token && !state.config.token) {
getToken(err, state);
} else {
@ -788,6 +786,7 @@ var parsers = {
state.config._otp = common.otp();
}
argv.unshift('init');
parseCb(null, state);
});
}

View File

@ -175,7 +175,7 @@ function serveControlsHelper() {
|| 'undefined' !== typeof conf.agreeTos ) {
state.config.agreeTos = conf.agreeTos || conf.agree_tos;
}
state.otp = conf._otp || '0000'; // this should only be done on the client side
state.otp = conf._otp; // this should only be done on the client side
state.config.relay = conf.relay || state.config.relay || '';
console.log();
console.log('conf.token', typeof conf.token, conf.token);

View File

@ -1,5 +1,8 @@
There are a number of conditions and whatnot that must be tested in more-or-less real-world conditions.
telebit init // fresh install
telebit init // after install complete
telebit http 3000 // have an app listening on localhost:3000
telebit http 4545 // do not have an app listening