ibnishak / Timimi

Webextension to save Tiddlywiki
https://ibnishak.github.io/Timimi/
GNU Affero General Public License v3.0
206 stars 23 forks source link

Could tiddlers.json would be exported automatically when saved and use the same backup copies strategy as the wiki? #76

Open offray opened 2 years ago

offray commented 2 years ago

Hi,

Thanks for Timimi. It has been the best saving experience we have used with TiddlyWiki so far and we are introducing it to several TW learners as the default saving option.

I would like to suggest adding the automatic exportation of tiddlers.json with each save and also applying to it the same backup copies strategy of the whole wiki. As TiddlyHost produces a JSON export with any update/save of the wiki (available at mywiki.tiddlyhost.com/tiddlers.json), I think that this would give the same option, but for the "local first" save on your desktop world that Timimi is enabling in such fluent way.

I imagine something like going to the plugin setup interface and adding something like a checkbox that says "Export tiddlers.json" and also a route to it, that can use the same relative path convention as the backups directory, so I can fill in a small inbox saying that I want to export my tiddlers as ./tiddlers.json or as ./my-wiki.json or so on (maybe if only the "Export tiddlers.json" checkbox is selected, but no extra customization is done, it will assume the default to be ./tiddlers.json). The JSON exported file with the tiddlers could have the same directory and back-up strategy as the wiki file. In that way the ./tw-backups/ directory would contain mywiki-A1.html, mywiki-A2.html, tiddlers-A1.json, tiddlers-A2.json and so on.

As you can see, this is pretty specific request and I'm don't know how to program in Go, so I can only provide use cases and imagined interactions. But let me know if I can help in any other way beyond programming.

BTW, here is the lesson where we teach how to use Timimi to store your wikis locally (in Spanish):

Timimi: persistencia/almacenamiento.

Thanks in advance.

ibnishak commented 2 years ago

The problem with this is, the first step should come from tiddlywiki side. Timimi doesn't parse the HTML, merely save the html send by tiddlywiki to the path which is also send by tiddlywiki. So if tiddlers.json is to be exported, tiddlywiki should send that.

offray commented 2 years ago

Ohhh, OK. So Timimi doesn't allow to access the TiddlyWiki functionality allowing it to, let's say invoke the proper "export as JSON" option that appears in the UI? All seems to indicate that the CORS enabling that allow such JSON export in TiddlyHost case (see 1 and 2) would require also a client server architecture... :-/ . Do you see any other alternative?

Thanks

ibnishak commented 2 years ago

Timimi doesn't allow to access the TiddlyWiki functionality allowing it to, let's say invoke the proper "export as JSON" option that appears in the UI?

No. Timimi makes use of Tiddlyfox code in tiddlywiki, which sends the whole html. Infact, timimi doesn't care or read what tiddlywiki is sending, as long as it has data and a path to save it to.

There could be solutions. For eg, you can ask in the group if someone has a tiddlywiki plugin that will send tiddlers.json and a path in tandem with html. This could be a pure tiddlywiki plugin that modifies the core tiddlywiki to send html and tiddlers.json one after another when save is triggered.