@@ -18,6 +18,10 @@ var callServiceList = rpc.declare({
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
function enquoteBigNumber(str) {
|
||||
return str.replace(/("\w+"):\s*(\d+)/g, '$1:"$2"');
|
||||
}
|
||||
|
||||
function getStatus() {
|
||||
var status = {};
|
||||
return Promise.resolve(callServiceList('tailscale')).then(function (res) {
|
||||
@@ -28,7 +32,7 @@ function getStatus() {
|
||||
}
|
||||
return fs.exec("/usr/sbin/tailscale", ["status", "--json"]);
|
||||
}).then(function(res) {
|
||||
var tailscaleStatus = JSON.parse(res.stdout);
|
||||
var tailscaleStatus = JSON.parse(enquoteBigNumber(res.stdout));
|
||||
if (!tailscaleStatus.AuthURL && tailscaleStatus.BackendState == "NeedsLogin") {
|
||||
fs.exec("/usr/sbin/tailscale", ["login"]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user