whatsapp: persist chats and messages across restarts (v8 / 2.2.0)
WhatsApp delivers a history sync at login, not on reconnect, so an in-memory store left the connector blind after every process restart (23 in two weeks). The store is now mirrored to store/, next to auth/ and bind-mounted the same way. Not SQLite: node:sqlite needs Node 22 (unflagged only from 24) and the runtime image ships Debian trixie's nodejs = 20.19.2; better-sqlite3 is native and the slim image has no toolchain. So an append-only JSONL log for messages plus a debounced JSON snapshot for chats/contacts, both written tmp+rename so a crash cannot truncate them. Compaction on load and every 500 appends keeps the log from creeping upward. Also fixes a pre-existing duplication bug: pushMessage appended unconditionally, re-adding every message a history re-sync redelivered. It now returns false on a known id and the message is skipped in both the transcript and the log. MAX_MSGS_PER_CHAT 200 -> 500. logout deletes store/ with auth/, so re-linking a different phone cannot inherit the previous account's history. Data at rest: message text is now written to the user's bind-mounted home. Nothing but session keys was persisted before. Verified on skald-runtime:v4 with a seeded store: 751 lines with 50 duplicates, a 700-message chat and a torn trailing line -> 701 loaded, compacted to 501, cap applied, second run 501 -> 501 unchanged.
This commit is contained in:
@@ -794,14 +794,14 @@
|
||||
"type": "qr"
|
||||
},
|
||||
"folder": "whatsapp",
|
||||
"version": 7,
|
||||
"version_string": "2.1.0",
|
||||
"version": 8,
|
||||
"version_string": "2.2.0",
|
||||
"version_release_date": "2026-08-23",
|
||||
"files": [
|
||||
{
|
||||
"path": "connector.json",
|
||||
"sha256": "87bac98a524c604ca016a80b26200ae16aaee3926baecfe99e1c336833823307",
|
||||
"size": 1485
|
||||
"sha256": "7efc38c81915ecef2ecdd5bc16b4e3fbccc9ef735a5ae6262317b823a64d6f31",
|
||||
"size": 1609
|
||||
},
|
||||
{
|
||||
"path": "icon_lg.png",
|
||||
@@ -815,8 +815,8 @@
|
||||
},
|
||||
{
|
||||
"path": "index.js",
|
||||
"sha256": "fa1f1c31c1f3b6b32df3de0a1175e1cb51a0417dce7e3aa52fa8655900dd2967",
|
||||
"size": 29495
|
||||
"sha256": "291a450714859e9f579bd2594bc6a5120daf17a9c77cf6c7cb1e59c64d5aa4f4",
|
||||
"size": 33564
|
||||
},
|
||||
{
|
||||
"path": "package.json",
|
||||
|
||||
Reference in New Issue
Block a user