On Monday, March 14, 2016 at 2:26:48 PM UTC, Robert Kreuzer wrote: > > > I would like to run TW5 via TiddlyWeb for a multi-user wiki. I have a > running TiddlyWeb instance, but I couldn't find any documentation how to > integrate TW5 with it. > Is there anybody who has done this recently and could point me in the > right direction? >
Thanks for posting here Robert. As I said I would in the issue[1] I've started experimenting with this and it is has been more complicated that I initially expected, so it is good the thread is started here so we can get some input from people more familiar with the tw5 side of things. I'm gathering my notes here so people can chime in and we can figure out the right solution. Eventually we'll have one. We didn't talk at the time how you wanted to set things up, there are a few options: 1. Run a web server that hosts a tw5 html file that it serves to users, alongside the tiddlyweb service. This is a bit like what Tank[2] can do and is essentially what tw5 itself does, in server mode. 2. Have editions of tiddlywiki5 which are built to talk to a server where the content lives, but are otherwise empty. This mode could allow the same bare tiddlywiki5 to talk to lots of different server, based on configuration settings. The editions/tw5tiddlyweb that is in the TiddlyWiki5 code repo is built specifically for talking to TiddlySpace, requiring a few features that are (custom /status response, custom authentication challenger). Since TiddlySpace is dying, this isn't a great solution, so I worked on option 2 to see what issues are present. There are a few. On the tiddlywiki5 side: * tiddlywebadaptor.js requires /status to provide recipe information. This is only done on tiddlyspace, and is extractable from the user's request based on the domain they are accessing the service with. On a plain TiddlyWeb server you can only know the recipe if it is in the URL. So this won't work. In my experiment I modified tiddlywebadaptor.js that will use a $:/config/tiddlyweb/recipe tiddler during the build process. It contains the name of the recipe (in my case "foo") in which tiddlers are to be stored. * tiddlywebadaptor.js assumes that the wiki will be loaded from http or https. If it is not, the adaptor doesn't run at all. If I create appropriate $:/config/tiddlyweb/host and $:/config/tiddlyweb/recipe tiddlers, adjust tiddlywebadaptor.js to use, and adjust the adaptor to export itself without checking document.location.protocol, then I can produce an edition which will communicate appropriately with the tiddlyweb server and recipe described by the host and recipe tiddlers. On the tiddlyweb side: * Even though it doesn't produce the desired information a /status url still needs to return a json object such that tiddlywebadaptor.js will call it and then call the subsequent callback (listing the tiddlers on the server). This can be done by adding the tiddlywebplugins.status plugin to the tiddlywebconfig.py's system_plugins list. * In order for the browser to communicate to the server via a file: URL CORS is required on the server. tiddlywebplugins.cors can provide that. * The recipe defined $:/config/tiddlyweb/recipe needs to exist before the TiddlyWiki looks for it. * For the time being I've ignored authentication. Once all that's done, at least in Firefox it all works quite gracefully. Load the tiddlywiki, it gets the list of tiddlers from the server, when you create a new one it is saved to the server. So that's at least a starting point. That suggests we need to: * Effectively document the tiddlyweb-side configuration and running pieces. It's not hugely complicated, but it does require installing tiddlyweb plus a few plugins and then configuring the instance to use them. I can make a cookbook for that and then I reckon someone could probably make a container that does it cleanly. * Either create a new edition for tiddlywiki5 which could be described as "standalone access to tiddlyweb", or make the existing tw5tiddlyweb edition support that use case as well. * Such as edition would need to account for the changes to tiddlywebadaptor.js described above. Probably by effectively branching in the right places based on certain conditions. This is hard for me to do because I don't know the available contextual variables. What do people think? [1] https://github.com/tiddlyweb/tiddlyweb/issues/105 [2] https://tank.peermore.com/tanks/docs/TiddlyWiki%20Five -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/565e4eac-4285-4856-b23b-befaba55cbae%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

