output and whitespace
This commit is contained in:
parent
81bdb44a7b
commit
6c1efd476d
|
@ -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);
|
||||
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 {
|
||||
if (body) {
|
||||
console.info('Response');
|
||||
console.info(body);
|
||||
//cb(null, body);
|
||||
} else {
|
||||
console.info("👌");
|
||||
//cb(null, "");
|
||||
}
|
||||
console.info(JSON.stringify(body, null, 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -172,15 +172,15 @@ rm -rf ~/.config/$my_app ~/.local/share/$my_app
|
|||
EOF
|
||||
chmod a+x $TELEBIT_PATH/bin/${my_app}_uninstall
|
||||
|
||||
echo " > ${sudo_cmde}ln -sf $TELEBIT_PATH/bin/$my_app /usr/local/bin/$my_app"
|
||||
echo " > ${sudo_cmde}ln -sf $TELEBIT_PATH/bin/$my_app /usr/local/bin/$my_app"
|
||||
$sudo_cmd ln -sf $TELEBIT_PATH/bin/$my_app /usr/local/bin/$my_app
|
||||
echo " > ${sudo_cmde}ln -sf $TELEBIT_PATH/bin/$my_daemon /usr/local/bin/$my_daemon"
|
||||
echo " > ${sudo_cmde}ln -sf $TELEBIT_PATH/bin/$my_daemon /usr/local/bin/$my_daemon"
|
||||
$sudo_cmd ln -sf $TELEBIT_PATH/bin/$my_daemon /usr/local/bin/$my_daemon
|
||||
|
||||
set +e
|
||||
if type -p setcap >/dev/null 2>&1; then
|
||||
#echo "Setting permissions to allow $my_app to run on port 80 and port 443 without sudo or root"
|
||||
echo " > ${sudo_cmde}setcap cap_net_bind_service=+ep $TELEBIT_PATH/bin/node"
|
||||
echo " > ${sudo_cmde}setcap cap_net_bind_service=+ep $TELEBIT_PATH/bin/node"
|
||||
$sudo_cmd setcap cap_net_bind_service=+ep $TELEBIT_PATH/bin/node
|
||||
fi
|
||||
set -e
|
||||
|
@ -216,22 +216,22 @@ my_system_launcher=""
|
|||
if [ -d "/Library/LaunchDaemons" ]; then
|
||||
my_system_launcher="launchd"
|
||||
my_app_launchd_service="Library/LaunchDaemons/${my_app_pkg_name}.plist"
|
||||
echo " > ${sudo_cmde}$rsync_cmd $TELEBIT_PATH/usr/share/dist/$my_app_launchd_service /$my_app_launchd_service"
|
||||
echo " > ${sudo_cmde}$rsync_cmd $TELEBIT_PATH/usr/share/dist/$my_app_launchd_service /$my_app_launchd_service"
|
||||
$sudo_cmd $rsync_cmd "$TELEBIT_PATH/usr/share/dist/$my_app_launchd_service" "/$my_app_launchd_service"
|
||||
|
||||
echo " > ${sudo_cmde}chown root:wheel $my_root/$my_app_launchd_service"
|
||||
echo " > ${sudo_cmde}chown root:wheel $my_root/$my_app_launchd_service"
|
||||
$sudo_cmd chown root:wheel "$my_root/$my_app_launchd_service"
|
||||
echo " > ${sudo_cmde}launchctl unload -w $my_root/$my_app_launchd_service >/dev/null 2>/dev/null"
|
||||
echo " > ${sudo_cmde}launchctl unload -w $my_root/$my_app_launchd_service >/dev/null 2>/dev/null"
|
||||
$sudo_cmd launchctl unload -w "$my_root/$my_app_launchd_service" >/dev/null 2>/dev/null
|
||||
|
||||
elif [ -d "$my_root/etc/systemd/system" ]; then
|
||||
my_system_launcher="systemd"
|
||||
echo " > ${sudo_cmde}$rsync_cmd $TELEBIT_PATH/usr/share/dist/etc/systemd/system/$my_app.service /etc/systemd/system/$my_app.service"
|
||||
echo " > ${sudo_cmde}$rsync_cmd $TELEBIT_PATH/usr/share/dist/etc/systemd/system/$my_app.service /etc/systemd/system/$my_app.service"
|
||||
$sudo_cmd $rsync_cmd "$TELEBIT_PATH/usr/share/dist/etc/systemd/system/$my_app.service" "/etc/systemd/system/$my_app.service"
|
||||
|
||||
$sudo_cmd systemctl daemon-reload
|
||||
echo " > ${sudo_cmde}systemctl enable $my_app"
|
||||
$sudo_cmd systemctl enable $my_app
|
||||
echo " > ${sudo_cmde}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
|
||||
|
|
Loading…
Reference in New Issue