levix-bot 2.1.2 → 2.2.1
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 +8 -4
- package/SETUP.md +11 -5
- package/app.cjs +6 -0
- package/package.json +2 -2
- package/public/dashboard.css +2167 -519
- package/public/dashboard.js +100 -36
- package/scheduler.cjs +84 -17
- package/src/bootstrap/core.js +17 -11
- package/src/bootstrap/session-startup-policy.js +23 -0
- package/src/commands/autoschedule.cjs +19 -42
- package/src/config/ai-identity.cjs +4 -3
- package/src/config/brand.cjs +3 -0
- package/src/db/db.cjs +8 -0
- package/src/db/store.cjs +25 -5
- package/src/panel/session-store.cjs +100 -0
- package/src/routes/dashboard.api.esm.js +60 -3
- package/src/utils/recurrence.cjs +161 -0
- package/src/utils/storage.cjs +1 -0
- package/src/utils/storage.esm.js +1 -0
- package/views/dashboard.ejs +464 -94
- package/views/login.ejs +50 -86
- package/views/qr.ejs +51 -53
- package/views/setup.ejs +67 -110
package/README.md
CHANGED
|
@@ -18,9 +18,11 @@ go to **Connection**, press **Start session** and scan the QR — see
|
|
|
18
18
|
[SETUP.md](SETUP.md) for the longer version, Docker, and running it as a
|
|
19
19
|
service.
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
commands come up
|
|
23
|
-
|
|
21
|
+
On a brand-new install, starting Levix does not begin WhatsApp pairing by
|
|
22
|
+
itself: the panel, database and commands come up first, and the Connection
|
|
23
|
+
screen starts the first session when you ask. After that first successful link,
|
|
24
|
+
the saved WhatsApp session resumes automatically after a process, Docker or
|
|
25
|
+
systemd restart unless you explicitly stop or unlink it.
|
|
24
26
|
|
|
25
27
|
```
|
|
26
28
|
levix start Levix with the web panel
|
|
@@ -54,7 +56,9 @@ is a Markdown file you can edit from the panel.
|
|
|
54
56
|
per-chat file. Plain Markdown, hand-editable, injected into every prompt.
|
|
55
57
|
|
|
56
58
|
**Scheduled messages** — one-off (`!schedule`) or recurring (`!autoschedule`),
|
|
57
|
-
|
|
59
|
+
including daily and weekly schedules with Arabic or English day names. Jobs
|
|
60
|
+
survive restarts; their latest delivery result is shown in the panel, where a
|
|
61
|
+
failed message can be retried manually.
|
|
58
62
|
|
|
59
63
|
**Optional proxy** — Settings → WhatsApp proxy routes the WhatsApp connection
|
|
60
64
|
through an HTTP, HTTPS or SOCKS5 proxy, including the media it sends and
|
package/SETUP.md
CHANGED
|
@@ -58,9 +58,14 @@ The terminal prints something like:
|
|
|
58
58
|
bot before you do.)
|
|
59
59
|
3. You land on the control panel. Go to **Connection**, press **Start session**,
|
|
60
60
|
and scan the QR with WhatsApp → Settings → Linked devices → Link a device.
|
|
61
|
-
|
|
61
|
+
A brand-new install does not begin pairing until you press Start.
|
|
62
62
|
4. Send `!ping` in any chat. The bot answers.
|
|
63
63
|
|
|
64
|
+
After that first successful pairing, the saved WhatsApp session resumes
|
|
65
|
+
automatically after a Levix, Docker or systemd restart. You only need the
|
|
66
|
+
Connection screen again if you deliberately stop/unlink the session or WhatsApp
|
|
67
|
+
requires a new link.
|
|
68
|
+
|
|
64
69
|
Levix only opens a browser when there is one to open: over SSH, under systemd,
|
|
65
70
|
in Docker or in CI it just prints the address and says why. `--no-open` turns
|
|
66
71
|
it off anywhere.
|
|
@@ -85,7 +90,8 @@ Then open <http://localhost:3001>. The setup code is in the logs:
|
|
|
85
90
|
docker compose logs levix | grep -F '[Setup] Setup code:' | tail -1
|
|
86
91
|
```
|
|
87
92
|
|
|
88
|
-
Everything the bot owns lives in the `levix-data` volume.
|
|
93
|
+
Everything the bot owns lives in the `levix-data` volume. Once WhatsApp has
|
|
94
|
+
been paired, restarting the container reuses that saved session automatically.
|
|
89
95
|
|
|
90
96
|
---
|
|
91
97
|
|
|
@@ -181,11 +187,11 @@ journalctl -u levix --no-pager | grep -F '[Setup] Setup code:' | tail -1
|
|
|
181
187
|
|
|
182
188
|
Read the script first if you like — it is short, and it explains each step.
|
|
183
189
|
|
|
184
|
-
That always installs the newest stable Levix. To stay on
|
|
185
|
-
script, pinned — use its own URL:
|
|
190
|
+
That always installs the newest stable Levix. To stay on this release — the
|
|
191
|
+
same script, pinned — use its own URL:
|
|
186
192
|
|
|
187
193
|
```bash
|
|
188
|
-
curl -fsSL https://levix.leviro.net/install/v2.
|
|
194
|
+
curl -fsSL https://levix.leviro.net/install/v2.2.1.sh | bash
|
|
189
195
|
```
|
|
190
196
|
|
|
191
197
|
**Behind a proxy** — if this server reaches the internet through a proxy, the
|
package/app.cjs
CHANGED
|
@@ -19,6 +19,7 @@ const { assetPath } = require("./src/config/paths.cjs");
|
|
|
19
19
|
const brand = require("./src/config/brand.cjs");
|
|
20
20
|
const settings = require("./src/config/settings.cjs");
|
|
21
21
|
const secrets = require("./src/config/secrets.cjs");
|
|
22
|
+
const { PanelSessionStore } = require("./src/panel/session-store.cjs");
|
|
22
23
|
const { getQrCode } = require("./src/utils/storage.cjs");
|
|
23
24
|
const {
|
|
24
25
|
clientAddress,
|
|
@@ -151,9 +152,14 @@ app.locals.brand = brand;
|
|
|
151
152
|
app.use(express.static(assetPath("public")));
|
|
152
153
|
app.use(express.urlencoded({ extended: true, limit: "100kb" }));
|
|
153
154
|
|
|
155
|
+
// Levix is intentionally one process and one operator, so a small expiring
|
|
156
|
+
// in-memory store is enough. Unlike express-session's development MemoryStore,
|
|
157
|
+
// it is explicitly bounded and prunes expired entries instead of growing for
|
|
158
|
+
// the lifetime of the process. Sessions still disappear on restart by design.
|
|
154
159
|
const sessionMiddleware = session({
|
|
155
160
|
name: SESSION_COOKIE_NAME,
|
|
156
161
|
secret: secrets.getSessionSecret(),
|
|
162
|
+
store: new PanelSessionStore({ ttlMs: SESSION_MAX_AGE_MS }),
|
|
157
163
|
resave: false,
|
|
158
164
|
saveUninitialized: false,
|
|
159
165
|
cookie: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "levix-bot",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
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": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"type": "git",
|
|
58
58
|
"url": "https://github.com/Abdodiab2005/levix.git"
|
|
59
59
|
},
|
|
60
|
-
"homepage": "https://
|
|
60
|
+
"homepage": "https://levix.leviro.net",
|
|
61
61
|
"bugs": {
|
|
62
62
|
"url": "https://github.com/Abdodiab2005/levix/issues"
|
|
63
63
|
},
|