fca-nx 7.2.5 → 7.3.0
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/func/logger.js
CHANGED
|
@@ -126,9 +126,27 @@ function formatMessage(text) {
|
|
|
126
126
|
.replace(/\n+/g, "\n");
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
// 7.3.0 quiet logs: when config.json has "quietLogs": true (or FCA_NX_QUIET=1),
|
|
130
|
+
// info/debug/success lines are hidden. Warnings and errors always show.
|
|
131
|
+
// FCA_NX_DEBUG=1 turns everything back on. The bot can call
|
|
132
|
+
// require("fca-nx/func/logger").setQuiet(false) to change it at runtime.
|
|
133
|
+
let quietOverride = null;
|
|
134
|
+
const QUIET_HIDDEN = { info: true, debug: true, success: true };
|
|
135
|
+
function isQuiet() {
|
|
136
|
+
if (process.env.FCA_NX_DEBUG === "1") return false;
|
|
137
|
+
if (quietOverride !== null) return quietOverride;
|
|
138
|
+
try {
|
|
139
|
+
const c = global.fca && global.fca.config;
|
|
140
|
+
if (c && c.quietLogs === true) return true;
|
|
141
|
+
} catch (_) {}
|
|
142
|
+
return process.env.FCA_NX_QUIET === "1";
|
|
143
|
+
}
|
|
144
|
+
const logFn = (text, type = "info") => {
|
|
145
|
+
if (isQuiet() && QUIET_HIDDEN[type]) return;
|
|
130
146
|
const message = formatMessage(text);
|
|
131
147
|
const prefix = formatPrefix(type);
|
|
132
148
|
|
|
133
149
|
process.stderr.write(`${prefix} ${co(">")} ${message}\n`);
|
|
134
150
|
};
|
|
151
|
+
logFn.setQuiet = (v) => { quietOverride = v === null ? null : !!v; };
|
|
152
|
+
module.exports = logFn;
|
package/package.json
CHANGED
|
@@ -20,7 +20,9 @@ const getTaskResponseData = require("./core/getTaskResponseData");
|
|
|
20
20
|
const createEmitAuth = require("./core/emitAuth");
|
|
21
21
|
const createMiddlewareSystem = require("./middleware");
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
// 7.3.0: auto-cycle disabled by default. The forced MQTT reconnect every hour
|
|
24
|
+
// looked like automated behaviour. Set mqtt cycleMs in options to re-enable.
|
|
25
|
+
const CYCLE_MS_DEFAULT = 0;
|
|
24
26
|
const RECONNECT_DELAY_MS_DEFAULT = 3000;
|
|
25
27
|
const UNSUB_ALL_TIMEOUT_MS = 5000;
|
|
26
28
|
const MAX_MQTT_RECONNECT_DELAY_MS = 60000;
|
|
@@ -122,7 +122,9 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
|
122
122
|
// Read FastConfig-style anti-get-info flag from global config (if available)
|
|
123
123
|
const cfg = global.fca && global.fca.config;
|
|
124
124
|
const antiCfg = cfg && cfg.antiGetInfo;
|
|
125
|
-
|
|
125
|
+
// 7.3.0: on-demand lookup is the default. The background 10s refresh queue made
|
|
126
|
+
// many Facebook calls. Set antiGetInfo.AntiGetUserInfo to false to restore it.
|
|
127
|
+
const disableAntiUserInfo = !(antiCfg && antiCfg.AntiGetUserInfo === false);
|
|
126
128
|
|
|
127
129
|
// Lightweight, Horizon-style implementation without database/queue
|
|
128
130
|
if (disableAntiUserInfo) {
|