bepaald / signalbackup-tools

Tool to work with Signal Backup files.
GNU General Public License v3.0
790 stars 38 forks source link

Can you clarify --desktopdir <DIR1> <DIR2> usage in readme or parameter help? #238

Closed warp-9000 closed 1 month ago

warp-9000 commented 1 month ago

I'm trying to use --desktopdir to load backed up folders of Signal Desktop and it's unclear what paths I should be supplying for and . Can you clarify that in the README?

For example: if I've copied the following directories: 1) C:\Users\\\AppData\Roaming\Signal\ 2) C:\Users\\\AppData\Local\Programs\signal-desktop\

And renamed them: 1) ..\Signal.bak\ 2) ..\signal-desktop.bak\

Should I point \<DIR1> at (1) and \<DIR2> at (2) ? Or can I point \<DIR1> and \<DIR2> at two different ..\Roaming\Signal\ folders?

Thanks in advance!

bepaald commented 1 month ago

I've updated the README, it now says (bold part added):

If the files are in a non-standard location or this fails for some other reason, the directories containing them (not the files themselves) can be passed using --desktopdirs <DIR1> <DIR2>, where <DIR1> is the directory containing config.json and <DIR2> is the directory containing sql/db.sqlite (on recent installations, these are usually the same directory).

Maybe that's more clear?

Note, on normal Windows installations, the default directory is C:\Users\<username>\AppData\Roaming\Signal\ which is not either of the ones you mention having copied (but maybe there is just a typo in [1]?). The default directory may have been different in the past though, I think it was even split across two different directories (which is why the option takes two directories as arguments).

Or can I point and at two different ..\Roaming\Signal\ folders?

The program basically needs config.json to read the encryption key from, and sql/db.sqlite to read the actual data (database and attachments). If you point the program at directories from two different Signal installations, either:

Let me know if the description is more clear now. Thanks!

warp-9000 commented 1 month ago

where \<DIR1\> is the directory containing config.json and \<DIR2\> is the directory containing sql/db.sqlite

Excellent!

(on recent installations, these are usually the same directory).

Does this mean you need to pass the same directory twice? If so, that seems redundant but manageable.

Note, on normal Windows installations, the default directory is C:\Users\\AppData\Roaming\Signal\ which is not either of the ones you mention having copied (but maybe there is just a typo in [1]?).

Oops. Yep, a typo. I edited my prior post to fix that and clean up the missing '\'s.

  • The two folders are from different installations. Then mixing the directories will cause errors, as the database will be encrypted with a key that is not in the configuration file.

This is what I needed to know!!

Thanks for the quick response :)

bepaald commented 1 month ago

Does this mean you need to pass the same directory twice? If so, that seems redundant but manageable.

Yes, and yes. It's a bit of an ugly limitation in my argument-parser. It can do optional arguments, but only between a fixed number (in this case 2) and 0, not between 2 and 1. I've been meaning to do something about that, but it's the lowest of low priorities for me, especially considering it's a bit complicated (I don't actually write the argparser directly, I have a program generate it for me automatically, I'd need to alter that program to change this).

This is what I needed to know!!

Thanks for the quick response :)

No worries, good luck to you. Is there anything left to do in this issue, or can it be closed?

Thanks!

warp-9000 commented 1 month ago

I've been meaning to do something about that, but it's the lowest of low priorities for me, especially considering it's a bit complicated (I don't actually write the argparser directly, I have a program generate it for me automatically, I'd need to alter that program to change this).

Doh! Totally understand it's the lowest of low priorities. Given that, I'll close this out.

Thanks for mentioning that though. While it's small and mostly annoying I may try to find time to send you a pull request, or open a new issue to discuss if I can find time. (Which won't happen anytime soon for me right now.)

Thanks again for the discussion and updating the README!

bepaald commented 1 month ago

Thanks, but as I said, the Arg class is generated by an external tool, so there's no point in a pull request, any changes will be overwritten when I need to re-generate it. I'll see if I can find some time to look at it this week. But discussion is always fine of course.

Alternatively I might simply change setdesktopdirs to only take a single argument. I've never actually seen any case in which these locations were split over separate folders, I just read that once in some old reddit post (top reply here: https://old.reddit.com/r/signal/comments/fnyo4n/how_does_desktop_store_messages/), maybe it was like that 4 years ago, but it certainly isn't now.

bepaald commented 5 days ago

Just wanted to add, by now I have added a --desktopdir option which takes just a single directory as argument. I've also updated the README and --help output for this new option. The old --desktopdirs is also still present and working, but not mentioned anywhere anymore.