Re: Problems connecting to my tiddlywiki on my Android phone installed with nodejs (Termux) using a different device on my local network

257 views
Skip to first unread message
Message has been deleted

Rob Hoelz

unread,
Nov 6, 2018, 12:35:18 PM11/6/18
to TiddlyWiki
Hi John,

TiddlyWiki's node daemon defaults to listening on the 127.0.0.1 address only - if you want to access it from other devices, you'll need to tell the server to listen on a different address.

However, I must caution you - I think that having a server open to other network clients on various WiFi networks would be unwise from a security standpoint.

-Rob

On Tuesday, November 6, 2018 at 10:22:23 AM UTC-6, john smith wrote:
So i've installed tiddlywiki via nodejs on my Android phone using Termux

Runs well on my phone browser when connecting to http://127.0.0.1:8080/

However I can't see the tiddlywiki on any other device on the local network (my laptop and ipad).

I'm using the local IP address provided on the android wi-fi settings and the port (192.168.x.x:8080) in browser.

i'm not very technically minded so hopefully the solution doesn't involve too much hassle every time i'm connected to a different wi-fi as i travel a lot.

Mark S.

unread,
Nov 6, 2018, 12:35:44 PM11/6/18
to TiddlyWiki
How are you launching node.js/TiddlyWiki ? You need to specify the full IP number in order to open it to the network. Something like:

--server 8080 $:/core/save/all text/plain text/html "" "" 192.168.0.245
where 192.168.0.245 is the IP of your "server" device.

Good luck!
-- Mark

Jeremy Ruston

unread,
Nov 6, 2018, 12:45:53 PM11/6/18
to tiddl...@googlegroups.com
Alternatively, you can use 0.0.0.0 to listen on all available network addresses.

Best wishes

Jeremy.


-- 
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/d4d57494-0770-404f-a60b-ff9b60b2766e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TonyM

unread,
Nov 6, 2018, 5:04:01 PM11/6/18
to TiddlyWiki
John,

As Jeremy says, use the special address 0.0.0.0 in launching tiddlywiki and then you can access the Wiki at the devices IP address on your local network. Do keep in mind that the IP address is usually obtained by using a DHCP server on the local network to issue the address. If your local router does not have a static address assigned to your device (Set using the devices MAC address) then the phone could get issued with different IP Addresses, and if you connect to a different network or router (Wifi) your mobile device may get another IP Address. 

I have not confirmed it, but it makes sense, that if the server is run and starts being available on one IP Address, then the Devices IP Address changes then you may loose access, in which case you may need to reload the tiddlywiki server on 0.0.0.0 again to "bind" to the new address.

Regards
Tony
Message has been deleted

h0p3

unread,
Nov 6, 2018, 6:43:41 PM11/6/18
to TiddlyWiki

It might be worth trying to keep certain kinds of content separate from or external to the wiki. My wife has a lot of pictures she uses in her wiki, but he keeps them in a directory next to her static html file and just links to them instead. This keeps her html file fairly small, and the pictures are only loaded when she open a tiddler that points to them.

On Tuesday, November 6, 2018 at 6:05:58 PM UTC-5, john smith wrote:
Thanks guys i got it working.

My next issue is that i've imported a very large static html tiddlywiki (over 200mb, full of images, PDF's, saved webpages etc) into the nodejs version, after successfully importing it runs out of memory when i try and load it in the browser. Below is a screenshot out of the Termux output.

Mark S.

unread,
Nov 6, 2018, 7:33:47 PM11/6/18
to TiddlyWiki

TW isn't indexed like a database and doesn't scale up well. I try to keep it below 10M for compatibility with devices. 30-40 Megs is the upper range on my desk-top machine.

The solution is to put images, PDF's, etc. into sub-directories. Unfortunately plain node.js won't serve up images, etc. I don't know if anyone has tried tiddlyserver on a device, but TS will serve up images and PDF's (though whether your device browser can use the PDF is another question).

Another possibility on node.js is to use "lazy loading". This brings in all regular tiddlers as empty until you click on them. This can greatly reduce the memory load since it's unlikely that you need to look at all the content all the time.

Good luck
-- Mark

On Tuesday, November 6, 2018 at 3:05:58 PM UTC-8, john smith wrote:
Thanks guys i got it working.

My next issue is that i've imported a very large static html tiddlywiki (over 200mb, full of images, PDF's, saved webpages etc) into the nodejs version, after successfully importing it runs out of memory when i try and load it in the browser. Below is a screenshot out of the Termux output.



On Tuesday, November 6, 2018 at 5:35:44 PM UTC, Mark S. wrote:

TonyM

unread,
Nov 6, 2018, 7:41:49 PM11/6/18
to TiddlyWiki
Mark,

Do you think using iframes is valid ?

Regards
Tony

Mark S.

unread,
Nov 6, 2018, 8:18:01 PM11/6/18
to TiddlyWiki
I'm not sure what you mean by "valid". Using iframes won't fix the node.js image/document server problem.

One thing you can do with iframe (and probably "embed" as well) is to put it in a macro that specifies the first part of an object path. Then when you change to a different locale, where the resources are in a different directory, you only have to change the macro. The reason you would want to do this is that on small devices the internal memory card tends to have precious little space for images, pdf's. But there's often an external card that has loads of space. So you can have your main TW file on the main card, but your resources off in a separate directory. Then, back on the desktop, you can co-locate the TW file and resources. This is what I used to do with AndTidWiki ... though it's looking like the days of that utility are numbered if there isn't an update.

Have fun
-- Mark

TonyM

unread,
Nov 6, 2018, 8:27:09 PM11/6/18
to TiddlyWiki
Sorry, let me clarify,

Place the images elsewhere and display them on demand and or from an iframe - this means the images and the device need to be online, but they will be pulled into the device browser cache when needed and not before.

Regards
Tony

Mark S.

unread,
Nov 6, 2018, 9:07:46 PM11/6/18
to TiddlyWiki
As long as you're using node.js (plain), it won't solve the problem. The browser won't let a server serve up local files -- they have to be served up via a web-like address.

You could, of course, have a local instance of TW, and then iframe (or _canonical_uri, or <img> ) will allow you to use local files. But that would be a completely different set-up.

-- Mark

TonyM

unread,
Nov 6, 2018, 11:52:45 PM11/6/18
to TiddlyWiki
I know this is off Topic, please forgive me

Mark,

You say " they have to be served up via a web-like address" and that is exactly where I am coming from. Personally I can dump images on the internet (my host) and reference them as URL's and load them as needed. However for local only wikis, say my photo library, the next version of tiddlywiki server apparently lets you also serve files, never the less, I am about to test a simple nodeJS or similar file server that can publish files/images on localhost addresses,  I could have a configurable prefix say http://localhost:8088/images/ then if I do publish this on the internet I can change that configurable prefix to https://domain.com/images/

What I have being thinking is why fight the file:// limitations, just use http addressing.

This comes on the back of my recent discovery that if you go to import a file (on my FF windows 10) and rather than select a file on the local system, paste a url eg https://serverpress.com/wp-content/uploads/2013/02/export_import.jpg
Then it will import the image to tiddly wiki. Try it.

You could then embed the image in tiddlywiki multiple times with {{export_import.jpg}} or effectivly lazy load using


which is a form of lazzy loading, because it is retrieved and displayed only when the tiddler is displayed

This is actually bad practice with other people images and websites, but if you have your own image repository online, even password protected, it would be fine.

Given all the above I am now looking at a way to import such resource addresses from a directory list so that the tiddlywiki contains the names and folders of selected resources (not the resource them-self)  to allow me to browse these resources AS IF I had access to the server file system. The "File" Directory is effectively maintained in TiddlyWiki and gives me the full address to the resource as I need it. Perhaps I can make a fake file and folder directory appear in TiddlyWiki.

TiddlyServer already can do this, see my attachment

filesbytiddlyserver.jpg


My TiddlyServer settings.json contains a tree item "Pictures": "C:\\Users\\antho\\Pictures\\TiddlyWiki\\", I can browse to http://localhost:8088/Pictures open and view a file like http://localhost:8088/Pictures/blog-jqueryimageloading1.jpg
I can import it with the address or display it with <img src="http://localhost:8088/Pictures/blog-jqueryimageloading1.jpg" alt="HTML5 Icon" >

Even if "only" displayed, not imported I can transclude a tiddler containing the <img src html, and the image will display.

You can also import files and URL's from using the <$browse> widget.
Too cool if you ask me.

Mark S.

unread,
Nov 7, 2018, 12:22:22 AM11/7/18
to TiddlyWiki
Yes, tiddlyserver does this -- that's one of the main reasons to use it instead of node.js. Do you happen to know it ts runs on Termux? Unfortunately, my 4.2 devices can't run termux.

You can certainly use some a separate server to serve up images, etc. But if you do the addresses will not be relative to the TW file, nor relate to your directory structure, which is important for portability, and have different port numbers. Also, you will need to be running a second server on a device. What server software can you use, and what will be the performance hit? You could use an external 3rd party web site (most of the free ones are gone) but then your system will not work fully when disconnected from the internet.

All of these complications are reasons why it may often be better to simply run a local file in your device browser, synching either by hand or possibly with the aid of 3rd party software.

Have fun!
-- Mark

TonyM

unread,
Nov 7, 2018, 1:23:51 AM11/7/18
to TiddlyWiki
Mark,

Some thoughts on what you just said.
  • Turmux allows you to run nodeJS, On Top of NodeJS is TiddlyServer, although Arlen has packaged it so you do not need to install nodeJS, I believe you can install it into Node JS yourself, the same works for Bob.
  • If you cant get Termux look for other possible ways to install nodeJS on you devices, there are a few.
  • If we are managing large volumes of image and audio files locally then it may still make sense to serve them locally, if designed carefully you can change the location of files and update you wiki to access another location. Nothing is hard coded in TiddlyWiki really. I do think we can make tiddlywiki move to and from local and internet especially if we maintain media at URL addresses. Changing the address, Port and folder for all images should be trivial.
  • Actually, without being sure how large volumes of media would work, for most practical uses we can use CouchDB with PouchDB for offline access aka NoteSelf but I believe we can see more database backend possibilities becoming available in time. I could see a MySQL database working, easily. 
  • In the mean time, it could be simple to export tiddlers from NoteSelf (using built in PouchDB) and importing them back into another wiki, browser and session, perhaps via drop box or any other share.
  • My Hosting provider offers $7 a month hosting which would be enough for most single user and team TiddlyWikis without large media, maybe a lot more.
  • I expect once we have some security additions, I could actually run Bob on my Internet host (through NodeJS)
  • Of late I have served a single file wiki online with a Content Delivery Network caching the tiddlywiki file, performance is great.
  • The beaker browser also has some unique offerings
You have fun too.

Tony
Reply all
Reply to author
Forward
Message has been deleted
0 new messages