So I found a hacky way of achieving #2.
var $tw = require("tiddlywiki/boot/boot").TiddlyWiki();
$tw.boot.argv = []
$tw.boot.boot();
$tw.loadTiddlersNode();
At the conclusion of that code, you can access $tw.wiki to get a Wiki
object representing the entire state of the wiki, AFAIK. Hopefully, if I
can get this and #4 sorted, I can start trying to get multiserver up for
folders at least, and then expand it to files.
On Thursday, May 12, 2016 at 3:32:49 PM UTC-4, Matthew Lauber wrote:
>
> All,
> During a hangout a while back Jeremy outlined where he'd like to take
> TiddlyDesktop, indicating that he'd like to move towards using the users
> standard browser and having TiddlyDesktop act as a local webserver that
> serves the files and provides a adapter to allow automatic local saving via
> the same process as TiddlyFox. I've been looking into how I would go about
> writing something like this, and I've got a few questions about the
> architecture of TiddlyWiki I was hoping the community could help me with.
>
> We've currently got two ways for storing tiddlers - in a single wikifile,
> and as a wikifolder. With both of these I assume at some point we translate
> them into a $tw.Wiki
> <https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L875>
> object. With this in mind, I was wondering what the process was for:
>
> 1. Constructing a $tw.Wiki object representing the tiddlers in
> wikifile?
> Based on what I found for #2, I think this is the corresponding
> function.
> https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L1406
>
> 2. Constructing a $tw.Wiki object representing the tiddlers in
> wikifolder?
> MY understanding is that this will load all the tiddlers
> https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L1745
>
> 3. Writing a a $tw.Wiki object to a wikifile?
> My understanding is that we follow the process here
>
> <https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/saver-handler.js#L151>,
>
> where we render a specific tiddler that is basically a template for the
> entire html file. Is this correct?
>
> 4. Writing a a $tw.Wiki object to a wikifolder?
> I've not been able to figure out the process for this, or even whether
> we save the entire $tw.Wiki object as a batch or individual tiddlers.
>
>
> My overall plan for how to implement this was to construct multiple
> $tw.Wiki objects and refactor the /core/modules/commands/server.js into
> multiserver.js. multiserver.js would construct a Server object for each
> $tw.Wiki object, and a routingServer would use a hashtable of
> {prefixes:Server} to determine which server to forward the request to.
> Notably, only the routingServer would listen on a port, the others would
> just respond to function calls, and I'd be able to reuse the TiddlyFox
> protocol. If anyone is able to provide a bit of direction on how to load
> and save data on the filesystem, I'm hopeful that I can have a basic, beta
> version of this up soon.
>
> Thanks,
> Matt Lauber
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" 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/tiddlywikidev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/b6562571-ae06-4126-87f8-3f868d4dd91e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.