What's the process for moving a single-file TiddlyWiki to a TiddlyWiki on node.js?

104 views
Skip to first unread message

Charlie Veniot

unread,
Aug 14, 2021, 1:36:45 PM8/14/21
to TiddlyWiki
Hello all,

I was under the impression that the html file for a single-file TiddlyWiki could simply be dragged to the node.js TiddlyWiki for importing.

Having tried this with two different single-file TiddlyWikis, the node.js TiddlyWiki (i.e. a clean/unmodified new TiddlyWiki instance) cannot be restarted after the import, getting all kinds of errors that seem javascript related.

Using this single-file TiddlyWiki as the case study, what's the process to successfully import that TiddlyWiki's tiddlers into a new and unmodified TiddlyWiki running on node.js ?

And are there other process steps to consider that may not need to be considered in this particular example TiddlyWiki ?

PMario

unread,
Aug 14, 2021, 2:39:14 PM8/14/21
to TiddlyWiki
Hi,
Which TW server version do you use?

tiddlywiki --version   will show it.

-m

Charlie Veniot

unread,
Aug 14, 2021, 2:54:15 PM8/14/21
to TiddlyWiki
Hi,

version 5.1.23

Should I first upgrade the single-file TiddlyWiki from 5.1.22 to 5.1.23 ?

PMario

unread,
Aug 14, 2021, 3:22:25 PM8/14/21
to TiddlyWiki
On Saturday, August 14, 2021 at 8:54:15 PM UTC+2 cj.v...@gmail.com wrote:
version 5.1.23

Should I first upgrade the single-file TiddlyWiki from 5.1.22 to 5.1.23 ?

No. ... I did test it with the prerelease and it worked without a problem. I'll test it with 5.1.23 again.
-mario

Charlie Veniot

unread,
Aug 14, 2021, 3:28:56 PM8/14/21
to TiddlyWiki
If it matters any: version of node is 10.24.0

PMario

unread,
Aug 14, 2021, 3:30:58 PM8/14/21
to TiddlyWiki
You have a very strange tiddler title, that start with: <$vars vWorkingTid .....   It seems to cause a problem with the node.js syncer. ... No tiddlers are saved. ... I did disable it at import so all tiddlers seemed to be created ... But .. see next issue ;)

And there seems to be a getstartupcontext.js macro that I don't know. ... It causes a problem at server startup.

I'll investigate further and let you know.

-m

On Saturday, August 14, 2021 at 8:54:15 PM UTC+2 cj.v...@gmail.com wrote:

Charlie Veniot

unread,
Aug 14, 2021, 3:35:11 PM8/14/21
to TiddlyWiki
getstartupcontext.js, that I can get rid of going forward.

If you want, delete that tiddler from the process.

Charlie Veniot

unread,
Aug 14, 2021, 3:37:30 PM8/14/21
to TiddlyWiki
And that "<$vars vWorking Tid..." tiddler, that's definitely something I created by mistake while in the process of creating an action widget.

I think.  I can't explain that tiddler.

On Saturday, August 14, 2021 at 4:30:58 PM UTC-3 PMario wrote:

PMario

unread,
Aug 14, 2021, 3:45:19 PM8/14/21
to TiddlyWiki
On Saturday, August 14, 2021 at 9:35:11 PM UTC+2 cj.v...@gmail.com wrote:
getstartupcontext.js, that I can get rid of going forward.

If you want, delete that tiddler from the process.

It's astonishing that this mechanism works. ... Where did you get this implementation from?
The mechanism in "Set Startup Context" is completely new to me. ... And it seems to cause a problem in the server because it references the "window" object, which is only available in the browser. ...

So IMO there would only be a if($tw.browser) needed. ... Maybe

-m

PMario

unread,
Aug 14, 2021, 3:48:25 PM8/14/21
to TiddlyWiki
Hi,
Yea, if those 2 tiddlers are removed it works. ... Will have a closer look at the macro. ...
-m

Charlie Veniot

unread,
Aug 14, 2021, 3:54:22 PM8/14/21
to TiddlyWiki
Please don't spend too much of your time on that macro.

That was very early going when I couldn't figure out a way to accomplish the same thing with just native TW code.

I am no fan of javascript, so quite happy to send that js code to the dustbin.

Maybe not tonight.  Bad thunderstorm going on over here, and the lights are flickering something silly...

PMario

unread,
Aug 14, 2021, 3:54:43 PM8/14/21
to TiddlyWiki
I'm not really sure, what the macro does, but if the .run function would look like this:

exports.run = function() {
    if ($tw.browser) {
            const queryString = window.location.search;
        try {
            const urlParams = new URLSearchParams(queryString);
            const wikicontext = urlParams.get('context');
            var output = wikicontext;

            if ( (output !== "OffGridding") && (output !== "HydroCutting")  && (output !== "Chromebook") ){
            output = "ProductReviews";
            };
            document.title = output;
        }
        catch(err) {
            output = "ProductReviews";
        }
            return output;
    }
};

It will let the server start in a normal way. ..

-mario

PMario

unread,
Aug 14, 2021, 4:03:07 PM8/14/21
to TiddlyWiki
On Saturday, August 14, 2021 at 9:30:58 PM UTC+2 PMario wrote:
You have a very strange tiddler title, that start with: <$vars vWorkingTid .....   It seems to cause a problem with the node.js syncer. ... No tiddlers are saved. ... I did disable it at import so all tiddlers seemed to be created ... But .. see next issue ;)

It seems the prerelease can handle this strange tiddler name. .. That's a good thing :)

have fun!
over and out ;)
mario

Charlie Veniot

unread,
Aug 14, 2021, 4:45:32 PM8/14/21
to TiddlyWiki
Woohoo !

All is working A-1.  Thank-you very much for your help !

I got rid of the wonky tiddler likely created while in the midst of coding a new-tiddler action widget.

I also replaced my on startup "context-setting" javascript macro with some native TW code to do the job, which makes me a much happier camper.

Cheers !

Reply all
Reply to author
Forward
0 new messages