levix-bot 4.8.0 → 4.9.2
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/README.md +9 -5
- package/SETUP.md +21 -2
- package/app.cjs +69 -23
- package/package.json +3 -2
- package/public/dashboard/assets/index-4xhK_Tpl.js +561 -0
- package/public/dashboard/assets/index-CK8osB4o.css +2 -0
- package/public/dashboard/index.html +2 -2
- package/public/dashboard.css +21 -0
- package/public/dashboard.js +25 -2
- package/public/gateway-i18n.js +26 -0
- package/src/bootstrap/core.js +4 -0
- package/src/bootstrap/session-startup-policy.js +6 -6
- package/src/commands/group/antilink.cjs +82 -59
- package/src/commands/group/antispam.cjs +112 -0
- package/src/commands/group/clearwarns.cjs +6 -6
- package/src/commands/group/demote.cjs +11 -13
- package/src/commands/group/flagged.cjs +52 -0
- package/src/commands/group/kick.cjs +25 -15
- package/src/commands/group/media.cjs +65 -29
- package/src/commands/group/policy.cjs +215 -0
- package/src/commands/group/promote.cjs +11 -12
- package/src/commands/group/rules.cjs +9 -6
- package/src/commands/group/setwarn.cjs +17 -27
- package/src/commands/group/warn.cjs +13 -63
- package/src/commands/group.cjs +5 -2
- package/src/commands/mod.cjs +101 -26
- package/src/commands/translate.cjs +585 -0
- package/src/config/ai-identity.cjs +53 -1
- package/src/config/ai-persona.md +32 -73
- package/src/config/baileys.config.js +15 -2
- package/src/config/defaults.cjs +2 -0
- package/src/config/secrets.cjs +71 -3
- package/src/config/settings.cjs +39 -1
- package/src/core/connection.js +40 -1
- package/src/core/session.js +11 -2
- package/src/core/socket.js +4 -5
- package/src/db/db.cjs +66 -0
- package/src/db/store.cjs +264 -16
- package/src/diagnostics/baileysLog.cjs +87 -0
- package/src/diagnostics/crashReports.cjs +35 -9
- package/src/diagnostics/debugLog.cjs +405 -0
- package/src/diagnostics/nodeRuntime.cjs +131 -0
- package/src/handlers/command.handler.js +1 -0
- package/src/handlers/group.handler.js +32 -1
- package/src/handlers/message.handler.js +53 -17
- package/src/middleware/antispam.middleware.js +95 -48
- package/src/panel/feedback.cjs +32 -5
- package/src/panel/one-time-code.cjs +156 -0
- package/src/panel/password-reset.cjs +187 -91
- package/src/panel/recovery-email.cjs +333 -0
- package/src/routes/dashboard.api.esm.js +267 -20
- package/src/services/aiAgent.cjs +25 -3
- package/src/services/moderationPolicy.cjs +895 -0
- package/src/services/settingsTransfer.cjs +4 -2
- package/src/utils/linkedCreds.cjs +22 -0
- package/src/utils/logger.cjs +11 -0
- package/src/utils/moderationAction.cjs +637 -0
- package/src/utils/moderationSummary.cjs +225 -0
- package/src/utils/permissions.cjs +70 -0
- package/src/utils/permissions.esm.js +48 -8
- package/src/utils/storage.cjs +8 -0
- package/src/utils/storage.esm.js +4 -0
- package/views/login.ejs +100 -28
- package/public/dashboard/assets/index-B8E5IYlB.js +0 -540
- package/public/dashboard/assets/index-C5D4wzm4.css +0 -2
- package/src/commands/group/antiSpam.cjs +0 -97
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
// language, delays, thumbnails, port and proxy shape, …) plus the command
|
|
16
16
|
// table — prefix, permission overrides, alias overrides, disabled commands.
|
|
17
17
|
// Not covered on purpose: per-group config and the memory files (they are
|
|
18
|
-
// personal data, not settings)
|
|
19
|
-
// operator authors, shared by copy-paste if wanted)
|
|
18
|
+
// personal data, not settings), the AI persona (a behaviour file the
|
|
19
|
+
// operator authors, shared by copy-paste if wanted), and account security
|
|
20
|
+
// (`auth:password`, `auth:recovery-email`). The recovery address is sealed
|
|
21
|
+
// outside the settings list and must never be added to this file.
|
|
20
22
|
|
|
21
23
|
const settings = require("../config/settings.cjs");
|
|
22
24
|
const runtimeConfig = require("../config/runtime-config.cjs");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Whether Baileys credentials describe a finished link to a WhatsApp account.
|
|
2
|
+
//
|
|
3
|
+
// One definition, because three places need the answer (the boot policy that
|
|
4
|
+
// resumes a paired install, the session manager, and the socket factory) and
|
|
5
|
+
// they used to disagree with Baileys instead of with each other.
|
|
6
|
+
//
|
|
7
|
+
// me.id requestPairingCode writes it, with name "~", before the phone
|
|
8
|
+
// accepts the code. Alone it proves nothing.
|
|
9
|
+
// registered Baileys sets it true only in the pairing-code flow. A link
|
|
10
|
+
// made by scanning a QR code stays `registered: false` forever,
|
|
11
|
+
// so `false` cannot mean "unfinished".
|
|
12
|
+
// account the signed device identity, written by pair-success in both
|
|
13
|
+
// flows and in neither unfinished state.
|
|
14
|
+
//
|
|
15
|
+
// So a link is finished when there is a me.id and either the code flow said so
|
|
16
|
+
// or the account identity arrived.
|
|
17
|
+
function isLinkedCreds(creds) {
|
|
18
|
+
if (!creds?.me?.id) return false;
|
|
19
|
+
return creds.registered !== false || Boolean(creds.account);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = { isLinkedCreds };
|
package/src/utils/logger.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const fs = require("node:fs");
|
|
|
3
3
|
const pino = require("pino");
|
|
4
4
|
|
|
5
5
|
const { ensureDataDir } = require("../config/paths.cjs");
|
|
6
|
+
const debugLog = require("../diagnostics/debugLog.cjs");
|
|
6
7
|
|
|
7
8
|
// Logs go in the data directory with everything else the bot writes, so a
|
|
8
9
|
// global install never tries to write next to its own code.
|
|
@@ -52,6 +53,8 @@ const logger = pino(
|
|
|
52
53
|
base,
|
|
53
54
|
pino.multistream([
|
|
54
55
|
{ level: "trace", stream: combinedStream },
|
|
56
|
+
// Detailed, sanitized, local only. See src/diagnostics/debugLog.cjs.
|
|
57
|
+
{ level: "debug", stream: debugLog.stream },
|
|
55
58
|
{ level: "error", stream: errorStream },
|
|
56
59
|
{
|
|
57
60
|
level: "trace",
|
|
@@ -62,6 +65,12 @@ const logger = pino(
|
|
|
62
65
|
]),
|
|
63
66
|
);
|
|
64
67
|
|
|
68
|
+
// Writes only to the sanitized debug log: never combined.log, error.log or the
|
|
69
|
+
// console. For detail that matters only when diagnosing (Baileys, Node's
|
|
70
|
+
// network layer), and that leaves the device only inside an operator-sent
|
|
71
|
+
// crash report or feedback with diagnostics ticked.
|
|
72
|
+
logger.debugOnly = pino(base, debugLog.stream);
|
|
73
|
+
|
|
65
74
|
const MAX_READ_BYTES = 256 * 1024;
|
|
66
75
|
|
|
67
76
|
/** Read only the bounded tail of the operational log, never arbitrary files. */
|
|
@@ -127,6 +136,8 @@ logger.clearLogs = function clearLogs() {
|
|
|
127
136
|
errorStream.flushSync();
|
|
128
137
|
fs.ftruncateSync(combinedStream.fd, 0);
|
|
129
138
|
fs.ftruncateSync(errorStream.fd, 0);
|
|
139
|
+
// The debug log is part of "the logs": one Clear removes it too.
|
|
140
|
+
debugLog.clearDebugLogs();
|
|
130
141
|
};
|
|
131
142
|
|
|
132
143
|
module.exports = logger;
|