PureWriter / desktop

Pure Writer Desktop
https://writer.drakeet.com/desktop
GNU General Public License v3.0
1.22k stars 100 forks source link

Is there a *.pwb backup file format specification? #53

Open erandelax opened 2 years ago

erandelax commented 2 years ago

Mobile app is really gorgeous, desktop... Well, for now I use git as my project storage (for a bunch of raw .md files) writing across four different OS (and 2-3 editor apps) and the whole device-bound idea of "connect them over the local network cause you need to have an android-based phone with a core editor app on it on hand to work with your project" sounds... Counterproductive.

So...

I love the app but I won't risk losing access to project data just because my android device suddenly decided to go AWOL. If the format is not "proprietary locked" I'm fine with writing a custom converter to pack/unpack it to plain text files and work with my project using usual desktop IDEs while my android device is out of reach, just loading the rebuilt backup file from cloud to app later.

PS. It's really sad you can't just "load/save a book folder" (or well, zip archive with a bunch of article text files and a some kind of json/toml/yaml ".pw-project" PW-specific config among them) from/to the phone storage.

drakeet commented 2 years ago

The pwb is actually a zip


From: Alexander Paliy @.> Sent: Saturday, December 25, 2021 6:50:08 AM To: PureWriter/desktop @.> Cc: Subscribed @.**> Subject: [PureWriter/desktop] Is there a .pwb backup file format specification? (Issue #53)

Mobile app is really gorgeous, desktop... Well, for now I use git as my project storage (for a bunch of raw .md files) writing across four different OS (and 2-3 editor apps) and the whole device-bound idea of "connect them over the local network cause you need to have an android-based phone with a core editor app on it on hand to work with your project" sounds... Bad.

So...

I love the app but I won't risk losing access to project data just because my android device suddenly decided to go AWOL.

— Reply to this email directly, view it on GitHubhttps://github.com/PureWriter/desktop/issues/53, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABHZABS7SA6WLUDYK22GE4DUST2KBANCNFSM5KXE3ZOA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

erandelax commented 2 years ago

Didn't expect that to be that easy... Wonderful, thank you very much.

For those who might come here later:

  • Google Drive sync seems to store files to application specific storage (and it does not seem you can access them there directly as user), however Dropbox just puts it to Apps/PureWriter/Backups/.pwb where they can be easily downloaded later.
  • Inside of *.pwb file (which can be renamed to *.zip and unpacked as-is) there is your app configuration dump and *.db file -- which is a SQLite database you can read with any database viewer application.

So. Yeah, you can definitely recover your project without access to original app or Android OS.

Now... Presuming I can freely unpack the backup file into a bunch of markdown files with front matter for non-content database columns, may I ask for a bit more specific info how to pack them back then?..

Specifically, I see there is a hash file "MD5" in the backup root -- I guess it would need to be regenerated so that app won't think the modified backup file is corrupt... How/from which data should it be generated?

If that repacking operation would not be considered violating terms of use or smth of course.

drakeet commented 2 years ago

The MD5 is the database's MD5, and you can just use the .db file, Pure Writer also supports Restore from a db file as well as pwb, if Restore from a db file, Pure Writer will not check the md5.

erandelax commented 2 years ago

Mhm. How is the primary key value generated for id columns at Article/Category/Folder? It looks like a 12-byte cut of MD5 (757ffa7b1299 sequences)... Does any unique random value suffice?

I'm afraid to cause a conflict or collision with mobile app new article creation if I put something random there.

drakeet commented 2 years ago

It's just a random string.