Commit Graph

410 Commits

Author SHA1 Message Date
KnugiHK
0ba81e0863 Implement granular error handling
Added and improved layered Zlib and SQLite header checks to distinguish between authentication failures (wrong key) and data corruption.
2026-01-08 23:59:31 +08:00
KnugiHK
647e406ac0 Implement early key validation via authenticated decryption (#190)
Utilize `decrypt_and_verify` to immediately identify incorrect user-provided keys via GCM tag validation.
2026-01-08 23:57:02 +08:00
KnugiHK
3538c81605 Enhance qouted message resolution to include media caption
Modified the `reply_query` to support messages that may not have body text but contain media caption.
2026-01-06 20:59:51 +08:00
KnugiHK
5a20953a81 Optimize quoted message lookups via global in-memory mapping
This change replaces the inefficient N+1 SQL query pattern with a pre-computed hash map. By fetching `ZSTANZAID` and `ZTEXT` pairs globally before processing, the exporter can resolve quoted message content in O(1) time.

Crucially, this maintains parity with the Android exporter by ensuring that replies to messages outside the current date or chat filters are still correctly rendered, providing full conversational context without the performance penalty of repeated database hits.
2026-01-06 20:51:29 +08:00
KnugiHK
8f29fa0505 Center the version string in the exporter banner 2026-01-06 20:35:02 +08:00
KnugiHK
412efd66a0 Add --tg as an alias to --telegram 2026-01-01 15:06:21 +08:00
KnugiHK
aef568b80b Merge branch 'main' into dev 2025-12-27 16:48:47 +08:00
Knugi
42e583ac7c Merge pull request #175 from tomballgithub/vcard_fix
Fix vcard decoding errors
2025-12-15 23:00:07 +08:00
KnugiHK
71ca293557 Add main entry point
Added a main entry point in __main__.py to allow running the exporter as a script. Required for standalone binary
2025-12-15 01:12:04 +08:00
KnugiHK
5a80fe189d Add error handling to quoted-printable decoding
Wrapped the decode_quoted_printable function in a try-except block to handle decoding errors gracefully. If decoding fails, a warning is logged and the original value is returned, improving robustness when processing malformed vCard data.
2025-12-14 23:49:10 +08:00
KnugiHK
bb10203b44 Remove vobject dependency from project and workflow
Eliminated the use of the vobject library from the codebase, dependency groups, and GitHub Actions workflow. vobject is no longer a dependency for vCards enrichment.
2025-12-14 23:47:24 +08:00
KnugiHK
ddd0ac3143 Refactor vCard parsing to improve decoding and structure
Replaces regex-based vCard parsing with dedicated functions for parsing lines, handling quoted-printable encoding, and extracting fields. Adds support for CHARSET and ENCODING parameters, improves handling of multi-line and encoded values, and centralizes vCard entry processing for better maintainability and accuracy.
2025-12-14 23:00:48 +08:00
KnugiHK
43658a92c4 Replace print with logger in read_vcards_file
Changed the contact import message from a print statement to a logger.info call for better logging consistency.
2025-12-14 21:57:17 +08:00
KnugiHK
194ed29a6e Switch the default template to the WhatsApp-alike them
The old telegram theme can still be applied with the `--old-theme` option
2025-12-14 21:40:17 +08:00
tomballgithub
8c9c69a536 Print the number of imported vcards 2025-11-29 20:28:51 -06:00
tomballgithub
029700359e Fix vcard decoding errors 2025-11-29 19:34:27 -06:00
KnugiHK
beaf272a63 ignoreUnreadable line in vcard #173
This makes multi line entry in vcard being ignored.
2025-11-26 22:05:42 +08:00
Knugi
1d5bad92a7 Add new IV and DB entry to utility.py
Reported by @silasjelley
2025-11-07 13:13:14 +00:00
KnugiHK
da4cea6230 Change how contacts are populated from vCards (fix #167)
Enrichment is now performed before message processing to ensure that all contacts are available, regardless of whether they exist in the ChatCollection.
2025-10-12 23:18:55 +08:00
Knugi
2b8af6a2fc Merge pull request #163 from jensb/fix-162-empty-chat-names
Update vcards_contacts.py to handle enrichment of empty chat names (#162)
2025-08-19 22:35:46 +08:00
jensb
f04205cb49 Update vcards_contacts.py to handle enrichment of empty chat names. Fixes #162. 2025-08-17 23:55:32 +02:00
KnugiHK
177b936b25 Give styling to "End of history" 2025-07-27 16:28:28 +08:00
KnugiHK
101e554413 Refactor 2025-07-27 16:25:47 +08:00
KnugiHK
49851f5874 Fix overflow in reply text 2025-07-27 16:14:54 +08:00
KnugiHK
8cf1071c90 Implement media preview in reply bubble #128 2025-07-27 15:58:36 +08:00
Knugi
25fa1cc530 Merge pull request #157 from glemco/telegram_json
Add support for telegram JSON file format
2025-07-02 18:26:52 +08:00
glemco
deebd6c87e Changes after code review 2025-06-29 10:49:01 +02:00
KnugiHK
f623eddc23 Fix incorrect SQL statement
The incorrect SQL statement prevents retrieval of media information.
2025-06-19 23:13:28 +08:00
KnugiHK
5cd8d953ac Add an option to skip processing replies in iOS
Since processing replies take time
2025-06-19 22:10:12 +08:00
KnugiHK
265afc1312 Implement (blue) ticks for message status #146 2025-06-19 22:00:26 +08:00
KnugiHK
9d3e65bd92 Fix error when using not supplying a value (default) to --size 2025-06-19 21:41:03 +08:00
KnugiHK
5aa12482e0 Fix on disappearing reply feature in iOS #154 2025-06-19 21:22:20 +08:00
KnugiHK
716d4af3f3 Fix incorrect type on comparison of exception 2025-06-19 21:09:00 +08:00
KnugiHK
4742ffd858 Handle a permission error on macOS #158
Although this does not fix the issue, when the error occurs, it will provide more information to users
2025-06-19 00:10:31 +08:00
glemco
5ed260b0b7 Add support for telegram JSON file format
Add the --telegram command line argument that, combined with a JSON
output, generates a Telegram compatible JSON file [1].

The JSON is per-chat, so the --telegram argument implies the
--json-per-chat setting.

I took a few shortcuts:
* Contact and Ids are inferred from the chat id or phone numbers
* All text is marked as plain (e.g. no markup or different types)
* Only personal chats and private groups supported
* Private groups are defined if the chat has a name
* Various ids try to match the ones in WA but may require bulk edits

[1] - https://core.telegram.org/import-export

Fixes: https://github.com/KnugiHK/WhatsApp-Chat-Exporter/issues/152
2025-06-16 13:01:33 +02:00
KnugiHK
99213503c4 Fix on incorrect rejection by the regex of the size_str
String like '1. MB' should be accepted
2025-06-01 12:17:21 +08:00
KnugiHK
f89f53cf2d Fix test cases 2025-06-01 12:15:54 +08:00
KnugiHK
0ecfe6c59a Cast numeric string in readable_to_bytes 2025-06-01 12:15:15 +08:00
KnugiHK
706466f63b Enforce a tighter check on the input of size_str 2025-06-01 11:54:24 +08:00
KnugiHK
24653b8753 Fixed integer input for --size not being casted to int #156 2025-06-01 11:53:45 +08:00
KnugiHK
e408c31415 Fix: it is impossible to have 0.1 byte as byte is the smallest unit 2025-05-17 19:26:18 +08:00
KnugiHK
bbb558713f Replace sanitize_filename with safe_name 2025-05-17 18:24:30 +08:00
KnugiHK
ea6e72bf0b Bug fix on incorrectly striping decimal to integer 2025-05-17 17:46:51 +08:00
KnugiHK
d7ded16239 Reimplement the convert_time_unit function to make it more human-readable 2025-05-17 17:35:30 +08:00
KnugiHK
8c2868a60e Fix on missing return in get_status_location 2025-05-17 16:20:11 +08:00
KnugiHK
a53e5a2b3d Update type hint syntax for Python < 3.10 compatibility 2025-05-17 16:18:16 +08:00
KnugiHK
3f88f7fe08 Replacing slugify with a new function 2025-05-17 16:04:31 +08:00
KnugiHK
96e483a6b0 Clean up unused code in bplist.py 2025-05-11 18:16:17 +08:00
KnugiHK
587b743522 Fix logging for decrypting whatsapp database 2025-05-11 18:14:41 +08:00
KnugiHK
33149075d3 autopep8 2025-05-11 18:07:51 +08:00