From 5d0e480f1c128e07c782645450fb10657d52d91a Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sat, 26 Feb 2022 21:57:36 +0000 Subject: [PATCH] InfoBroker: fix make_table_meta --- src/lib/SystemQuery.mjs | 2 +- src/lib/core/InfoBroker.mjs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/SystemQuery.mjs b/src/lib/SystemQuery.mjs index 5ec0d80..a0e272c 100644 --- a/src/lib/SystemQuery.mjs +++ b/src/lib/SystemQuery.mjs @@ -44,7 +44,7 @@ class SystemQuery extends EventEmitter { // TODO: Is this the best way of doing this? Maybe we should have a separate class for this? I'm not sure. this.mode = mode; this.config = config; - this.info = new InfoBroker(); + this.info = new InfoBroker(this); this.pkg = null; this.version = null; diff --git a/src/lib/core/InfoBroker.mjs b/src/lib/core/InfoBroker.mjs index 1f73519..27a0030 100644 --- a/src/lib/core/InfoBroker.mjs +++ b/src/lib/core/InfoBroker.mjs @@ -12,7 +12,9 @@ const __dirname = import.meta.url.slice(7, import.meta.url.lastIndexOf("/")); class InfoBroker { - constructor() { + constructor(sysquery) { + this.sysquery = sysquery; + this.allowed_tables = { // name → sysinfo name cpu: "cpu", @@ -32,7 +34,7 @@ class InfoBroker { async make_table_meta() { return { - version: JSON.parse(fs.promises.readFile(path.resolve(__dirname, "../../../package.json"), "utf-8")).version, + version: `${this.sysquery.version}-${this.sysquery.commit.substring(0, 7)}`, versions_env: process.versions, pid: process.pid, uptime: process.uptime(),