levix-bot 4.6.0 → 4.8.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/README.md +12 -2
- package/app.cjs +32 -7
- package/package.json +2 -2
- package/public/dashboard/assets/index-B8E5IYlB.js +540 -0
- package/public/dashboard/assets/index-C5D4wzm4.css +2 -0
- package/public/dashboard/index.html +4 -3
- package/public/dashboard.css +152 -53
- package/public/gateway-i18n.js +295 -0
- package/public/gateway.js +30 -1
- package/public/ui-boot.js +71 -0
- package/src/bootstrap/core.js +9 -0
- package/src/commands/md.cjs +44 -0
- package/src/config/defaults.cjs +1 -0
- package/src/core/socket.js +23 -0
- package/src/db/store.cjs +8 -0
- package/src/diagnostics/crashReports.cjs +491 -0
- package/src/diagnostics/device.cjs +119 -0
- package/src/diagnostics/sanitize.cjs +90 -0
- package/src/handlers/command.handler.js +2 -1
- package/src/index.js +9 -1
- package/src/panel/feedback.cjs +13 -1
- package/src/routes/dashboard.api.esm.js +186 -15
- package/src/services/autoDelete.cjs +3 -1
- package/src/utils/logger.cjs +88 -34
- package/src/utils/markdownParser.cjs +208 -136
- package/src/utils/storage.cjs +1 -0
- package/src/utils/storage.esm.js +1 -0
- package/views/dashboard.ejs +2 -1
- package/views/login.ejs +102 -71
- package/views/qr.ejs +59 -30
- package/views/setup.ejs +34 -30
- package/public/dashboard/assets/index-Con1xdhN.js +0 -515
- package/public/dashboard/assets/index-De78KNvv.css +0 -2
package/README.md
CHANGED
|
@@ -72,8 +72,8 @@ docker compose logs levix
|
|
|
72
72
|
Run Levix directly on an Android device (Android 10+, ARM64 or ARMv7) as a self-contained background companion:
|
|
73
73
|
|
|
74
74
|
1. Download **`levix-android-arm64.apk`** (64-bit phones) or **`levix-android-armv7.apk`** (32-bit phones) from [Releases](https://github.com/Abdodiab2005/levix/releases).
|
|
75
|
-
2. Install the APK and tap **Start
|
|
76
|
-
3. Tap **
|
|
75
|
+
2. Install the APK and tap **Start Assistant** — the big circle on the home screen.
|
|
76
|
+
3. Tap **Connect WhatsApp** to set your panel password and link WhatsApp via an 8-character pairing code.
|
|
77
77
|
|
|
78
78
|
See [ANDROID.md](ANDROID.md) for full instructions, OEM battery optimizations (Xiaomi, Samsung, OnePlus), and offline handling.
|
|
79
79
|
|
|
@@ -118,6 +118,16 @@ several tool rounds, search the web, read a page, save long-term memories, and
|
|
|
118
118
|
manage bot roles. It narrates progress by editing one WhatsApp message and lists
|
|
119
119
|
sources when it uses web search.
|
|
120
120
|
|
|
121
|
+
AI answers are formatted for WhatsApp automatically: `**bold**` becomes `*bold*`,
|
|
122
|
+
`__italic__` becomes `_italic_`, and tables become named entries with labeled
|
|
123
|
+
bullet points. Headings, lists, checkboxes, strikethrough and links are converted;
|
|
124
|
+
code contents and URLs are preserved.
|
|
125
|
+
|
|
126
|
+
Use `!md` (or `!markdown`) to convert text from any other AI or message, without
|
|
127
|
+
an AI key. Reply to that message with `!md`, or paste Markdown after the command,
|
|
128
|
+
including multiline tables and code. For example: `!md **Bold** and __italic__`.
|
|
129
|
+
Existing WhatsApp `*bold*` and `_italic_` text keeps its formatting.
|
|
130
|
+
|
|
121
131
|
AI is optional. The rest of Levix works without an AI key.
|
|
122
132
|
|
|
123
133
|
### Persistent schedules and memory
|
package/app.cjs
CHANGED
|
@@ -218,9 +218,14 @@ function isLocalRequest(req) {
|
|
|
218
218
|
return isDirectLocalRequest(req, { proxyConfigured: PROXY_CONFIGURED });
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
// `error` is { code, message } or null: `message` is the English the page
|
|
222
|
+
// renders by default, `code` is the stable key public/gateway-i18n.js turns
|
|
223
|
+
// into the reader's language. A string is still accepted for callers that
|
|
224
|
+
// have no code to offer.
|
|
221
225
|
function renderSetup(req, res, error, status = 200) {
|
|
222
226
|
res.status(status).render("setup", {
|
|
223
|
-
error,
|
|
227
|
+
error: error ? error.message || error : null,
|
|
228
|
+
errorCode: error?.code ?? null,
|
|
224
229
|
needsCode: !isLocalRequest(req),
|
|
225
230
|
minLength: secrets.MIN_PASSWORD_LENGTH,
|
|
226
231
|
});
|
|
@@ -238,7 +243,12 @@ app.post("/setup", (req, res, next) => {
|
|
|
238
243
|
const retryAfter = blockedFor(peer);
|
|
239
244
|
if (retryAfter) {
|
|
240
245
|
res.set("Retry-After", String(retryAfter));
|
|
241
|
-
return renderSetup(
|
|
246
|
+
return renderSetup(
|
|
247
|
+
req,
|
|
248
|
+
res,
|
|
249
|
+
{ code: "tooManyAttempts", message: "Too many attempts. Try again later." },
|
|
250
|
+
429,
|
|
251
|
+
);
|
|
242
252
|
}
|
|
243
253
|
|
|
244
254
|
const { password, confirm, code } = req.body || {};
|
|
@@ -246,17 +256,22 @@ app.post("/setup", (req, res, next) => {
|
|
|
246
256
|
if (!isLocalRequest(req) && !secrets.setupCodeMatches(code)) {
|
|
247
257
|
recordFailure(peer);
|
|
248
258
|
logger.warn({ ip: peer }, "[dashboard] Setup attempted with a wrong code");
|
|
249
|
-
return renderSetup(req, res, "Wrong setup code.", 401);
|
|
259
|
+
return renderSetup(req, res, { code: "wrongSetupCode", message: "Wrong setup code." }, 401);
|
|
250
260
|
}
|
|
251
261
|
|
|
252
262
|
if (password !== confirm) {
|
|
253
|
-
return renderSetup(
|
|
263
|
+
return renderSetup(
|
|
264
|
+
req,
|
|
265
|
+
res,
|
|
266
|
+
{ code: "passwordMismatch", message: "The two passwords don't match." },
|
|
267
|
+
400,
|
|
268
|
+
);
|
|
254
269
|
}
|
|
255
270
|
|
|
256
271
|
try {
|
|
257
272
|
secrets.setDashboardPassword(password);
|
|
258
273
|
} catch (error) {
|
|
259
|
-
return renderSetup(req, res, error.message, 400);
|
|
274
|
+
return renderSetup(req, res, { code: "invalidPassword", message: error.message }, 400);
|
|
260
275
|
}
|
|
261
276
|
|
|
262
277
|
clearAttempts(peer);
|
|
@@ -291,13 +306,21 @@ app.get("/", noStore, (req, res) => {
|
|
|
291
306
|
}
|
|
292
307
|
return res.render("dashboard");
|
|
293
308
|
}
|
|
294
|
-
return res.render("login", {
|
|
309
|
+
return res.render("login", {
|
|
310
|
+
error: null,
|
|
311
|
+
errorCode: null,
|
|
312
|
+
minLength: secrets.MIN_PASSWORD_LENGTH,
|
|
313
|
+
});
|
|
295
314
|
});
|
|
296
315
|
|
|
297
316
|
app.get("/login", noStore, (req, res) => {
|
|
298
317
|
if (!secrets.hasDashboardPassword()) return res.redirect("/setup");
|
|
299
318
|
if (isPanelSessionValid(req.session)) return res.redirect("/");
|
|
300
|
-
return res.render("login", {
|
|
319
|
+
return res.render("login", {
|
|
320
|
+
error: null,
|
|
321
|
+
errorCode: null,
|
|
322
|
+
minLength: secrets.MIN_PASSWORD_LENGTH,
|
|
323
|
+
});
|
|
301
324
|
});
|
|
302
325
|
|
|
303
326
|
app.post("/login", (req, res, next) => {
|
|
@@ -309,6 +332,7 @@ app.post("/login", (req, res, next) => {
|
|
|
309
332
|
res.set("Retry-After", String(retryAfter));
|
|
310
333
|
return res.status(429).render("login", {
|
|
311
334
|
error: "Too many attempts. Try again later.",
|
|
335
|
+
errorCode: "tooManyAttempts",
|
|
312
336
|
minLength: secrets.MIN_PASSWORD_LENGTH,
|
|
313
337
|
});
|
|
314
338
|
}
|
|
@@ -318,6 +342,7 @@ app.post("/login", (req, res, next) => {
|
|
|
318
342
|
logger.warn({ ip: peer }, "[dashboard] Failed login attempt");
|
|
319
343
|
return res.status(401).render("login", {
|
|
320
344
|
error: "Incorrect Password",
|
|
345
|
+
errorCode: "incorrectPassword",
|
|
321
346
|
minLength: secrets.MIN_PASSWORD_LENGTH,
|
|
322
347
|
});
|
|
323
348
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "levix-bot",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "A self-hosted personal WhatsApp bot with an AI agent, group moderation and a web control panel.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@sefinek/google-tts-api": "^2.1.15",
|
|
41
41
|
"@whiskeysockets/baileys": "7.0.0-rc14",
|
|
42
42
|
"axios": "^1.9.0",
|
|
43
|
-
"ejs": "^
|
|
43
|
+
"ejs": "^7.0.1",
|
|
44
44
|
"express": "^5.1.0",
|
|
45
45
|
"express-session": "^1.18.1",
|
|
46
46
|
"ffmpeg-static": "^5.3.0",
|