tiddlyhost / tiddlyhost-com

Rails application for creating and hosting TiddlyWiki sites, plus resources for deploying it to https://tiddlyhost.com/
Other
184 stars 17 forks source link

Support new JSON store area coming soon in TW 5.2.0 #161

Closed simonbaird closed 3 years ago

simonbaird commented 3 years ago

See https://github.com/Jermolene/TiddlyWiki5/pull/5708 for details.

Since Tiddlyhost injects tiddlers like $:/UploadURL, and also provides access to individual tiddlers via the /tiddler/TiddlerName.tid urls, it needs to understand the store area and how to read from and write to it.

It also needs to support the older format too so existing sites can remain fully functional.

Jermolene commented 3 years ago

Hi @simonbaird. I wondered how you were getting on with this? I don't want to merge https://github.com/Jermolene/TiddlyWiki5/pull/5708 until you're ready. Is there anything that @saqimtiaz or I can do to help?

saqimtiaz commented 3 years ago

@simonbaird yes please let me know if I can be of assistance.

There is some documentation here on the new store area and how the old and new format interact: https://saqimtiaz.github.io/sq-tw/temp/dev.html

simonbaird commented 3 years ago

No progress yet. I'll take a look this weekend.

simonbaird commented 3 years ago

@simonbaird yes please let me know if I can be of assistance.

There is some documentation here on the new store area and how the old and new format interact: https://saqimtiaz.github.io/sq-tw/temp/dev.html

That was really helpful, thanks. Actually the "append an additional script store element" idea looks like an easy way to get the basic Tiddlyhost functionality working quickly. Then the /tiddler/TiddlerName.tid and the /tiddlers.json functionality could be split out and implemented later as a lower priority.

saqimtiaz commented 3 years ago

Then the /tiddler/TiddlerName.tid and the /tiddlers.json functionality could be split out and implemented later as a lower priority.

I agree. There is no one actively using that at the moment (exciting as the possibilities are with it!).

Jermolene commented 3 years ago

Great thanks @simonbaird @saqimtiaz

saqimtiaz commented 3 years ago

@simonbaird in what situations does TiddlyHost need to inject tiddlers into TiddlyWiki files? I assume it injects tiddlers in to the DIV store area.

simonbaird commented 3 years ago

@simonbaird in what situations does TiddlyHost need to inject tiddlers into TiddlyWiki files? I assume it injects tiddlers in to the DIV store area.

See https://github.com/simonbaird/tiddlyhost/blob/main/rails/lib/th_file.rb#L37 for the details.

It does this every time a site is served, which means you can do a simple site rename and everything will still work automatically. Also notice how $:/UploadURL needs to get wiped when you download.

  • If it is for new TiddlyWiki, files the existing mechanism should continue to work regardless of whether the TiddlyWiki in question has the new store area or the old, as tiddlers from the DIV store area will continue to be loaded.

For a brand new empty file, that's probably true, but we also need to support uploaded TiddlyWiki files that are not empty. Because content in the div store area is obscured by content in the script/json store, adding content there may have no effect.

  • With TW files with content, the existing mechanism should continue to work as long as you don't need to overwrite a tiddler that exists in the new JSON store area.

We do need to overwrite, so that's why I think supporting the new store format is required.

simonbaird commented 3 years ago

I have a patch in progress, will push it up soon as an MR.

simonbaird commented 3 years ago

FYI you can test it. Click "Advanced options" at https://tiddlyhost.com/sites/new and choose the "New JSON store..." option.

saqimtiaz commented 3 years ago

@simonbaird thank you, I've given it a quick spin and it works well with no issues.

simonbaird commented 3 years ago

FYI @Jermolene @saqimtiaz I think you can go ahead and merge https://github.com/Jermolene/TiddlyWiki5/pull/5708 when you're happy with it.

Ps, the significant moment for Tiddlyhost isn't that merge, but the moment I change the default empty file used when creating a site. Currently it's a 5.1.24-prerelease from some time ago.

saqimtiaz commented 3 years ago

Thank you @simonbaird

simonbaird commented 3 years ago

I guess 5.2 is still coming along slowly. I decided to merge this now. If there are any changes needed post 5.2, I'll worry about it then.

Jermolene commented 3 years ago

I guess 5.2 is still coming along slowly. I decided to merge this now. If there are any changes needed post 5.2, I'll worry about it then.

We do need to take v5.2.0 quite slowly. But it's very helpful to have TiddlySpot updated now as it allows us all to do more extensive testing.