@profullstack/threatcrush 0.13.46 → 0.13.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/systemd/threatcrushd.service +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39448,6 +39448,12 @@ async function useOrganization(slug) {
|
|
|
39448
39448
|
var import_node_readline2 = __toESM(require("readline"));
|
|
39449
39449
|
var import_node_os9 = require("os");
|
|
39450
39450
|
init_cli_config();
|
|
39451
|
+
function connectionStatus(server, now = Date.now()) {
|
|
39452
|
+
const seen = server.last_seen ? Date.parse(server.last_seen) : NaN;
|
|
39453
|
+
const online = Number.isFinite(seen) && now - seen <= 3 * 60 * 1e3;
|
|
39454
|
+
if (!online) return "offline";
|
|
39455
|
+
return server.status === "unreachable" ? "unreachable" : "online";
|
|
39456
|
+
}
|
|
39451
39457
|
async function serversCommand(options) {
|
|
39452
39458
|
const { action, name, org } = options;
|
|
39453
39459
|
if (action === "list" || !action) {
|
|
@@ -39620,7 +39626,8 @@ async function listServers(orgSlug) {
|
|
|
39620
39626
|
console.log(source_default.dim(" Link this machine: threatcrush servers link\n"));
|
|
39621
39627
|
return;
|
|
39622
39628
|
}
|
|
39623
|
-
for (const
|
|
39629
|
+
for (const raw of servers) {
|
|
39630
|
+
const server = { ...raw, status: connectionStatus(raw) };
|
|
39624
39631
|
const statusColor = server.status === "online" ? source_default.green : server.status === "unreachable" ? source_default.red : source_default.gray;
|
|
39625
39632
|
const statusDot = server.status === "online" ? "\u25CF" : "\u25CB";
|
|
39626
39633
|
const self = server.id === config.server_id ? source_default.cyan(" (this machine)") : "";
|