Merge pull request #11 from bxb100/main

fix: bigint overflow
This commit is contained in:
asvow
2024-07-30 20:07:13 +08:00
committed by GitHub

View File

@@ -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"]);
}