simonw / datasette-tiddlywiki

Run TiddlyWiki in Datasette and save Tiddlers to a SQLite database
Apache License 2.0
32 stars 0 forks source link

Support plugin installation somehow #8

Open simonw opened 2 years ago

simonw commented 2 years ago

https://twitter.com/btbytes/status/1474138481324666891

This is sweeet! Since this is a "client-server" configuration, do you know where to find the tiddlywiki.info file for installing plugins etc? https://tiddlywiki.com/#Installing%20a%20plugin%20from%20the%20plugin%20library

Not sure how to approach this one. The tiddlywiki.info mechanism is part of the Node.js server, and I've not figured out how it works - I have a hunch that it's executing JavaScript from TiddlyWiki core though, which isn't an option for my Python code.

simonw commented 2 years ago

I'm using essentially the same approach as rsc/tiddly which says this in the README: https://github.com/rsc/tiddly#tiddlywiki-base-image

The TiddlyWiki code is stored in and served from index.html, which (as you can see by clicking on the Tools tab) is TiddlyWiki version 5.1.21.

Plugins must be pre-baked into the TiddlyWiki file, not stored on the server as lazily loaded Tiddlers. The index.html in this directory is 5.1.21 with the TiddlyWeb and Markdown plugins added. The TiddlyWeb plugin is required, so that index.html talks back to the server for content.

So one way to do this would be to support a custom tiddlywiki.html file which the user can create by following the instructions on that page. It's not very slick though.

Jermolene commented 2 years ago

Not sure how to approach this one. The tiddlywiki.info mechanism is part of the Node.js server, and I've not figured out how it works - I have a hunch that it's executing JavaScript from TiddlyWiki core though, which isn't an option for my Python code.

That's right, the tiddlywiki.info file is part of the wiki folder format, which is how TiddlyWiki stores wikis as individual tiddler files (docs), and so doesn't apply here.

I think the options are:

  1. Bake the required plugins into the TiddlyWiki HTML file template
  2. Splice the plugins into the template when the page is served (presumably along with all the other tiddlers)
  3. Use a preloader script that loads all the tiddlers from the server using the tiddlers.json route before booting into TidlyWiki's JavaScript.

I use a combination of the last two approaches on wikis like https://manuals.annafreud.org/ambit. The wiki files are baked into S3 a few times per day, but on startup it preloads any newer tiddlers via the tiddlers.json route.

ludwa6 commented 2 years ago

I've installed Datasette app on my Mac, installed "datasette-tiddlywiki" via the built-in Plugins installer, and am eager to have it storing my TW content in SQLite!

Problem is: the app running in my browser at http://localhost:8001/-/tiddlywiki wants to access a tiddlywiki.db file... So i have created one from the "File: New empty database..." menu command, which does then enable loading a new TW instance in browser, but it appears with the two error messages below superimposed on top, preventing any interaction with the TW instance.

So i'm wondering: is this method of plugin installation from within the Datasette GUI supposed to work? I wonder, because the instructions in Readme of this repo don't address this method; they only cover installation from commandline.

I also wonder if it matters where the tiddlywiki.db file is stored; as the "New empty database..." modal defaulted to my ~/Documents folder, i put it there, but still: i wonder. ?

syncer-browser-tiddlyweb - 26th December 2021 at 12:50pm

Error retrieving skinny tiddler list: [XMLHttpRequest](http://localhost:8001/-/tiddlywiki#XMLHttpRequest) error code: 500

syncer-browser-tiddlyweb - 26th December 2021 at 12:50pm (count: 3)

Sync error while processing save of '[$:/StoryList](http://localhost:8001/-/tiddlywiki#%24%3A%2FStoryList)': [XMLHttpRequest](http://localhost:8001/-/tiddlywiki#XMLHttpRequest) error code: 500