carderne / signal-export

Export your Signal chats to markdown files with attachments
Other
436 stars 46 forks source link

Message Reply: Original message that was replied too is not shown in the export. #42

Closed Kiatra closed 2 years ago

Kiatra commented 2 years ago

Is it possible to show the the message that was replied to as well in the export? I use that feature a lot and manay exported messages do not make much sense without the context.

carderne commented 2 years ago

Have added this feature behind a --quote flag. Give it a try and let me know what you think.

Currently, it adds quotes like this to the markdown output:

[2021-01-01 00:00] Sender:
>
> quote text goes here
>
Message body goes here

And puts the quote into an extra div in the html output. The markdown stuff needs to be relatively unique (unlikely to appear in a message normally) so that the HTML parser can pick it up, while still not being too visually intrusive... And also ideally work with existing Markdown stuff.

yringot commented 2 years ago

I tried it and got an error message (on Windows 10 Home 64 bit):

C:\Users\USER>docker run --rm -it --name signal-export --pull=always -v C:\Users\USER\AppData\Roaming\Signal:/Signal  -v C:\Users\USER\Desktop\signal_export:/output carderne/signal-export:latest --quote --chats="CHATNAME"
latest: Pulling from carderne/signal-export
Digest: sha256:e6fad4b645f39ebdfbbbfa7010282e0c9bdb806dd51a22a25615b1c3c0163d96
Status: Image is up to date for carderne/signal-export:latest
Copying and renaming attachments
Creating markdown files
Traceback (most recent call last):
  File "/usr/local/bin/sigexport", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/sigexport/main.py", line 647, in cli
    run(main)
  File "/usr/local/lib/python3.9/site-packages/typer/main.py", line 864, in run
    app()
  File "/usr/local/lib/python3.9/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/typer/main.py", line 500, in wrapper
    return callback(**use_params)  # type: ignore
  File "/usr/local/lib/python3.9/site-packages/sigexport/main.py", line 634, in main
    make_simple(dest, convos, contacts, quote)
  File "/usr/local/lib/python3.9/site-packages/sigexport/main.py", line 201, in make_simple
    quote += msg["quote"]["text"]
TypeError: can only concatenate str (not "NoneType") to str
carderne commented 2 years ago

This should be fixed now. There are probably other edge cases, please let me know in a new issue.