TANK TW5 V15 and importing tiddlers

79 views
Skip to first unread message

Danielo Rodríguez

unread,
Aug 27, 2014, 3:09:11 AM8/27/14
to tidd...@googlegroups.com
Hello!

I'm a newcomer to tank. I think it have a great potential, and as a TW user I love to have this oportunity.

I have a TW5 v15 version running on my tank. I tried to import one tiddler from one of my TW dragging and dropping and it went good. But when I tried to import other tiddlers I start to get synchronization errors.

Currently there is not possible to share one tank with multiple compositions right? I think this is only a GUI limitation (I read it somewhere). Could you give me any kind of instruction to share a tank with multiple comps? I would like to use the bookmarklet tool with the same tank as my TW5 tiddlers.

Thanks in advance.

chris...@gmail.com

unread,
Aug 27, 2014, 11:56:32 AM8/27/14
to tidd...@googlegroups.com
On Wed, 27 Aug 2014, Danielo Rodríguez wrote:

> I'm a newcomer to tank. I think it have a great potential, and as a TW user
> I love to have this oportunity.

Glad you find it interesting.

> I have a TW5 v15 version running on my tank. I tried to import one tiddler
> from one of my TW dragging and dropping and it went good. But when I tried
> to import other tiddlers I start to get synchronization errors.

Is it possible for you to provide more information on those errors?
Either from the javascript debugging console in the browser or
perhaps tw5 provides something?

I suspect some data is being clobbered somewhere that is leading to
conflicts during the PUT of the tiddlers, but without more
information I can't really be sure.

Another thing that would help would be some information on the time
and date you tried this and the name of the tank, so I can inspect
the logs.

> Currently there is not possible to share one tank with multiple
> compositions right? I think this is only a GUI limitation (I read it
> somewhere). Could you give me any kind of instruction to share a tank with
> multiple comps? I would like to use the bookmarklet tool with the same tank
> as my TW5 tiddlers.

It's possible to do by manipulating pieces under the GUI. Comps are
created with recipes and you can change the recipe. So, for example
if you have a comp named "boom", there is a recipe for it at
/recipes/boom which can be changed:

http://tiddlyweb.tiddlyspace.com/recipe
http://tiddlyweb.tiddlyspace.com/%2Frecipes%2F%7Brecipe_name%7D
http://tiddlyweb.tiddlyspace.com/How%20can%20I%20use%20curl%20to%20create%20stuff%20in%20TiddlyWeb%3F

--
Chris Dent http://burningchrome.com/
[...]

Danielo Rodríguez

unread,
Aug 28, 2014, 11:57:05 AM8/28/14
to tidd...@googlegroups.com

Is it possible for you to provide more information on those errors?
Either from the javascript debugging console in the browser or
perhaps tw5 provides something?

I suspect some data is being clobbered somewhere that is leading to
conflicts during the PUT of the tiddlers, but without more
information I can't really be sure.

I tried today at 17:53 UTC+2
Here is the error:

Failed to load resource: the server responded with a status of 409 (Conflict) https://tank.peermore.com/bags/default/tiddlers/CreateObjectFromArray
syncer-browser: Sync error while processing 'CreateObjectFromArray': XMLHttpRequest error code: 409 $:/core/modules/utils/logger.js:30


 
It's possible to do by manipulating pieces under the GUI. Comps are
created with recipes and you can change the recipe. So, for example
if you have a comp named "boom", there is a recipe for it at
/recipes/boom which can be changed:

http://tiddlyweb.tiddlyspace.com/recipe
http://tiddlyweb.tiddlyspace.com/%2Frecipes%2F%7Brecipe_name%7D
http://tiddlyweb.tiddlyspace.com/How%20can%20I%20use%20curl%20to%20create%20stuff%20in%20TiddlyWeb%3F


Other question: How can I see the tiddlers that are in a tank? Opening the tank just shows me the empty index.

Could you provide me a basic tiddler creation using CORS? I tried some request and I'm only capable of getting the index of each tank, but I can't get any tiddler inside it.

Thank you. 

chris...@gmail.com

unread,
Aug 28, 2014, 12:48:38 PM8/28/14
to tidd...@googlegroups.com, jeremy...@gmail.com
On Thu, 28 Aug 2014, Danielo Rodríguez wrote:

> Here is the error:
>
> Failed to load resource: the server responded with a status of 409
> (Conflict)
> https://tank.peermore.com/bags/default/tiddlers/CreateObjectFromArray
> syncer-browser: Sync error while processing 'CreateObjectFromArray':
> XMLHttpRequest error code: 409 $:/core/modules/utils/logger.js:30

For some reason some of the tiddlers have their bag set as "default".
That bag does not exist on the server so when TW5 tries to PUT there
it fails.

I seem to remember discussion about this problem with Jeremy Ruston in
the past, so I've added him as a CC so he can chime in. I think it is
a limitation in the tiddlyweb adaptor or in my adaptation to make it
work with Tank.

From my look at the logs it appears to be bits of TiddlyWiki itself
which have the difficult bag.

I assume some of your tiddlers were saved and some were not?

> Other question: How can I see the tiddlers that are in a tank? Opening the
> tank just shows me the empty index.

If what you want is all the tiddlers in a particular tank, you can get
that list by going to the bag URI. So if your tank is named "foo" look
at:

https://tank.peermore.com/bags/foo/tiddlers

for a list of the tiddlers.

> Could you provide me a basic tiddler creation using CORS? I tried some
> request and I'm only capable of getting the index of each tank, but I can't
> get any tiddler inside it.

Can you point me at the code you are already using and then I can
attempt to fix that? There are many different ways. It depends a lot
on libraries you are using, what browsers you're in, etc.

Jeremy Ruston

unread,
Aug 28, 2014, 12:55:45 PM8/28/14
to Chris Dent, tidd...@googlegroups.com
Hi Chris

Yes, it sounds like TW is saving new tiddlers to the bag "default". I'm a bit deep in another bit of refactoring to look at the problem now, but have made a ticket to return to it:


Many thanks,

Jeremy

--
Jeremy Ruston
mailto:jeremy...@gmail.com

Danielo Rodríguez

unread,
Aug 29, 2014, 5:24:44 AM8/29/14
to tidd...@googlegroups.com, jeremy...@gmail.com
> Could you provide me a basic tiddler creation using CORS? I tried some
> request and I'm only capable of getting the index of each tank, but I can't
> get any tiddler inside it.

Can you point me at the code you are already using and then I can
attempt to fix that? There are many different ways. It depends a lot
on libraries you are using, what browsers you're in, etc.


Here is a very basic example. Thanks in advance:

function createCORSRequest(method, url) {
  var xhr = new XMLHttpRequest();
  if ("withCredentials" in xhr) {

    // Check if the XMLHttpRequest object has a "withCredentials" property.
    // "withCredentials" only exists on XMLHTTPRequest2 objects.
    xhr.open(method, url, true);

  } else if (typeof XDomainRequest != "undefined") {

    // Otherwise, check if XDomainRequest.
    // XDomainRequest only exists in IE, and is IE's way of making CORS requests.
    xhr = new XDomainRequest();
    xhr.open(method, url);

  } else {

    // Otherwise, CORS is not supported by the browser.
    xhr = null;

  }
  return xhr;
}

// Make the actual CORS request.
function makeCorsRequest() {

  
var xhr = createCORSRequest('GET', url);
if (!xhr) {
 throw new Error('CORS not supported');
}

xhr.onload = function() {
var responseText = xhr.responseText;
console.log(responseText);
// process the response.
};

xhr.onerror = function() {
 console.log('There was an error!');
};
 
  xhr.setRequestHeader( 'X-Tank-Key','My real key goes here');
  xhr.send();
  } 

chris...@gmail.com

unread,
Aug 29, 2014, 5:55:39 AM8/29/14
to tidd...@googlegroups.com
On Fri, 29 Aug 2014, Danielo Rodríguez wrote:

> Here is a very basic example. Thanks in advance:

First off I'd recommend that you use a library to manage your XHRs,
such as jQuery. Most of the modern JavaScript helper libraries will
work with the browser to "just" do CORS. This is important because
(as usual) different browsers behave slightly differently.

For example I made a tool to migrate content from TiddlySpace to
Tank. It loads from tiddlyspace and operates in the tiddlyspace
domain but is able to write to tank, exercising CORS.

You can see it in action at http://totank.tiddlyspace.com/ and see
the code at https://github.com/cdent/totank

The code that does the PUTting is driven by Angular and can be
found in this file:
https://github.com/cdent/totank/blob/master/assets/totank.js

Angular's $http does the magic for you.
Reply all
Reply to author
Forward
0 new messages