Fetching tiddlers from a child wiki with Bob?

69 views
Skip to first unread message

Matthew Lauber

unread,
Oct 15, 2018, 11:12:08 AM10/15/18
to TiddlyWiki
This is probably most likely aimed at Jed, but anyone who has advice is welcome.  I'm looking at the Other Wikis tab in Bob, and I was going to see about improving it.  What I'd like to do is for each wiki, request that wiki's $:/SiteTitle and $:/SiteSubTitle tiddlers, and use those to get better text for the link.  After looking around for bit, I'm not sure how to achieve that, or if it's even the best way to approach it.  I've been left with a few questions.
  • Is there any way for me to request a specific tiddler from a specific wiki via Bob?  
  • Is there another way you'd recommend achieving this goal?  
  • Is there a specific technical hurdle that makes this goal unlikely to be achievable?  

Thanks,
Matt Lauber

Jed Carty

unread,
Oct 15, 2018, 11:28:35 AM10/15/18
to TiddlyWiki
Short answer, internalFetch is made for exactly this sort of thing, there is nothing that would prevent what you want but there are some relatively minor concerns.

More detail:

The internalFetch websocket message is made to fetch tiddlers from other wikis served by Bob. https://github.com/OokTech/TW5-Bob/blob/master/Documentation/WebSocketMessages/WebSocketMessage-internalFetch.tid

I haven't come up with a better method of getting information from one wiki to another yet, so I would go with that.

The only potential worry is that fetching from a wiki loads the tidders for that wiki on the back-end, so if you have a lot of them it may take a few seconds for them to load and for the tiddlers to be fetched. So whatever the solution is it shouldn't run often.

I am not sure what the best way to ensure that this information is shared between all the wikis is. I think that adding it to the wiki settings would work but that would either mean there was a duplicate list or I have to redesign how the paths to the wikis are listed. Another concern with that is I am working on some more privacy features so that you only see the wikis you have access too instead of seeing all the wikis regardless of if you can access them or not, which would make running this once at the start and sharing that with each wiki more complex.

@TiddlyTweeter

unread,
Oct 15, 2018, 11:50:48 AM10/15/18
to tiddl...@googlegroups.com
Jed & Matthew

I'd like chip in.

I think internalFetch is, basically, extremely good as it is.

One thing that I think would be helpfully additive is some kind of "push" from Bob Central of certain tiddlers on startup.

A particular use case is this ... that I think in is some ways relevant to Matthew's interest.

I want to maintain "administrative" tiddlers only in Bob Central. By which I mean a complex tiddler transcluding several others that provides the tools the individual child-wiki need. I constantly work on these. What I want to avoid is ending up with too many versions--so I work on them only in Bob Central.

In my own work I found "fetch" from Bob Central from child wiki didn't work to get them into the children. I'm not sure why?

Anyway I hope you get the issue.

Best wishes
Josiah

Matthew Lauber

unread,
Oct 15, 2018, 1:19:59 PM10/15/18
to TiddlyWiki
Hey Jed, I've got a working version of things now.  It comes with a "Refresh Titles" button that uses internalFetch to grab the data from all the wikis and stores it in $:/state/Bob/{{wiki name}}/[$:/SiteTitle,$:/SiteSubtitle].  Then, I've reworked the Wiki Listing view to show the SiteTitle and SiteSubtitle in the Wiki Listing.  IF the state tiddlers are not available, it falls back to the Wiki Name, as before.  

\define addPrefix() [addprefix[$:/state/Bob/$(WikiName)$/]]
\define getTitle() $:/state/Bob/$(WikiName)$/$:/SiteTitle
\define getSubtitle() $:/state/Bob/$(WikiName)$/$:/SiteSubtitle

Available Wikis: <$button>
  Refresh Titles
  <$list filter="[[$:/WikiSettings/split/wikis]indexes[]]" variable="WikiName">
     <$action-websocketmessage
       $type='internalFetch'
       fromWiki=<<WikiName>>
       filter='[title[$:/SiteTitle]]'
       transformFilter=<<addPrefix>>
       resolution='force'
     />
     <$action-websocketmessage
       $type='internalFetch'
       fromWiki=<<WikiName>>
       filter='[title[$:/SiteSubtitle]]'
       transformFilter=<<addPrefix>>
       resolution='force'
     />
   </$list>
</$button>


<$list filter="[[$:/WikiSettings/split/wikis]indexes[]]" variable="WikiName">
<li>
<a href=<<WikiName>> target='_blank'>
<$transclude tiddler=<<getTitle>> ><$text text=<<WikiName>> /></$transclude></a> <$transclude tiddler=<<getSubtitle>> />
</li>
</$list>


Reply all
Reply to author
Forward
0 new messages