Programmatically add tiddlers to running TW instance (node)

114 views
Skip to first unread message

Luca Dorigo

unread,
Dec 31, 2018, 8:13:16 AM12/31/18
to TiddlyWiki
Hi there,

Sorry if this was asked before but search is pretty bad on the google group.

I wanted to write a small script to quickly add pictures (screenshots from my clipboards) to TW, as the current interface is way too slow.

I wrote the script to add the image and corresponding .meta file in the "tiddlers" folder of my TiddlyWiki, but the problem is that the running instance of TiddlyServer doesn't see it: I need to relaunch it, which renders the whole thing pointless (as it takes even more time). 

Is there some way I can force the server to reload the list of tiddlers?

Thanks in advance!

Donald Coates

unread,
Jan 1, 2019, 11:01:03 PM1/1/19
to TiddlyWiki
In my limited scope of understanding the web server needs to be restarted in order to load tiddlers added in this way.  You can check out the Bob plugin (https://github.com/OokTech/TW5-Bob) which offers "Two-way real-time syncing between the browser and file system"

Diego Mesa

unread,
Jan 1, 2019, 11:06:03 PM1/1/19
to TiddlyWiki
Arlen's TiddlyServer also accomplishes this:

Arlen Beiler

unread,
Jan 24, 2019, 11:08:32 PM1/24/19
to TiddlyWiki
TiddlyServer just uses TiddlyWiki under the hood, but if you add "?restart=true" to the data folder path, it will immediately reload the data folder instance from disk. So if you're accessing your data folder at http://localhost/mydatafolder/ you would change that to http://localhost/mydatafolder/?reload=true 

You can probably do this from an external script if you like. Keep in mind that pending file changes may get lost, so be careful if you do this while editing Tiddlers. The changes are still written to disc, as the old instance can still finish processing, but the new instance will probably have already loaded the files from disc. In the future, I hope to improve this.

--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
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/614b1536-4809-482c-87c4-1591cc39d203%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TonyM

unread,
Jan 24, 2019, 11:23:50 PM1/24/19
to TiddlyWiki
Arlen

If you can trigger this reload from inside the wiki to which it applies, an action tiddler to close all, save then reload would be a good safety would it not?

Tony

Arlen Beiler

unread,
Jan 24, 2019, 11:30:00 PM1/24/19
to TiddlyWiki
Actually, if I remember right, the server and the client save separately, so even though the client has saved everything the server may still have operations pending. However, if you were somehow able to trigger a server-side action that would trigger a reload once everything was saved server-side, then that would work. But you would have to do it on the server, not the client. It would be pretty simple to do inside TiddlyServer, so I might put that on my to-do list along with the upgrade to 5.1.19.

Reply all
Reply to author
Forward
0 new messages