output and whitespace

This commit is contained in:
AJ ONeal 2018-06-13 13:12:38 -06:00
parent 8a1d9feb26
commit f17619efd2
3 changed files with 31 additions and 19 deletions

View File

@ -359,15 +359,27 @@ function parseConfig(err, text) {
+ " Consider peaking at the logs either with 'journalctl -xeu telebit' or /opt/telebit/var/log/error.log");
console.warn(resp.statusCode, body);
//cb(new Error("not okay"), body);
} else {
if (body) {
console.info('Response');
console.info(body);
//cb(null, body);
} else {
console.info("👌");
//cb(null, "");
return;
}
if (!body) {
console.info("👌");
return;
}
try {
body = JSON.parse(body);
} catch(e) {
// ignore
}
if ("AWAIT_AUTH" === body.code) {
console.info(body.message);
} else if ("CONFIG" === body.code) {
delete body.code;
YAML.safeDump(body);
} else {
console.info(JSON.stringify(body, null, 2));
}
}

View File

@ -97,6 +97,7 @@ function serveControls() {
servernames: state.servernames
, ports: state.ports
, ssh: state.config.sshAuto || 'disabled'
, code: 'CONFIG'
};
if (/\btelebit\.cloud\b/i.test(state.config.relay) && state.config.email && !state.token) {
@ -104,7 +105,7 @@ function serveControls() {
dumpy.message = "Check your email. You must verify your email address to activate this device.";
}
res.end(YAML.safeDump(dumpy));
res.end(JSON.stringify(dumpy));
}
function sshSuccess() {

View File

@ -231,7 +231,7 @@ elif [ -d "$my_root/etc/systemd/system" ]; then
$sudo_cmd systemctl daemon-reload
echo " > ${sudo_cmde}systemctl enable $my_app"
$sudo_cmd systemctl enable $my_app
$sudo_cmd systemctl enable $my_app >/dev/null
fi
sleep 1
@ -320,7 +320,6 @@ if [ "systemd" == "$my_system_launcher" ]; then
$sudo_cmd systemctl restart $my_app
fi
echo ""
echo " > telebit init --tty"
echo ""
sleep 0.25