Conversion to Node.js problems

201 views
Skip to first unread message

JWHoneycutt

unread,
May 3, 2018, 7:21:29 AM5/3/18
to TiddlyWiki

I am trying to convert a couple TW5 files to Node.js, (both on Dropbox).

The reason for this is I think I will be able to edit them from my ipad or iphone (preferred) rather than only the laptop.

I am running into 2 snags, pertaining to image calls and IOS access.

Image calls:

I have liked the simplicity of Danielo's <<ximg "Picture.jpg" path:$:/macros/ximg/path>> macrocall, which I then collect into image galleries grouped by tags.

They stopped working.

Should I copy the image files into the server directory (or an Image subdirectory?) Or is it just a matter of getting the syntax right on the pathfile?

IOS access:

localhost:19671 only works on my laptop and not on my IOS devices. (I am using these instructions: http://undefinedvalue.com/setting-personal-tiddlywiki-server-os-x.html)

Am I incorrect about being able to access via IOS? How is it done? Do I need a "Terminal emulator" loaded onto my IOS devices?


Any help is appreciated.

JWHoneycutt

Jed Carty

unread,
May 3, 2018, 7:48:35 AM5/3/18
to TiddlyWiki
File system access on iOS is made to be difficult. It is treated more like a document store database than a normal file system and image access via anything other than the built-in image gallery is difficult.

If you want to have a tiddlywiki server that is accessible from the local network than you are probably making things more difficult than they need to be. If you want to have node running on iOS than I don't know if that is possible. For all of the iOS development work I have done I ended up needing to use an external server to get any reasonable file access setup.

The multiuser plugin I may made be useful if you just want to be able to access it from the local network, you can run it on your laptop and edit them normally on your iphone or iPad.

BurningTreeC

unread,
May 3, 2018, 8:09:57 AM5/3/18
to TiddlyWiki
Hi all, I've recently seen something on github - native nodejs for android and iOS - if I remember it right

I'll post the link if I find it again

BTC

BurningTreeC

unread,
May 3, 2018, 8:11:12 AM5/3/18
to TiddlyWiki
Hi all, I've recently seen something on github - native nodejs for android and iOS - if I remember it right

I'll post the link if I find it again

BTC

@TiddlyTweeter

unread,
May 3, 2018, 8:50:06 AM5/3/18
to TiddlyWiki
BTC, does this mean, in principle, that TiddlyDesktop, Jed's MultiUser, Arlen's TiddlyServer could be compiled to run on Android & iOS more easily?

Diego Mesa

unread,
May 3, 2018, 9:31:28 AM5/3/18
to TiddlyWiki
Wow! 

Can someone post some instructions/help/tips on getting this setup on their IOS devices? 

Mark S.

unread,
May 3, 2018, 11:58:39 AM5/3/18
to TiddlyWiki
RE the first part. Node.js doesn't serve up images. If you can get Jed or Arlen's server's to run somewhere, then they should be able to serve up images. Then you have to determine the path to those files (your local web path, not the physical file path) and change the contents of $:/macros/ximg/path" (going from memory here) to reflect that new path basis.

It's unclear from your description whether you're actually trying to run nodejs ON your iOS device, or whether you're trying to connect to an existing server running on your laptop. If the latter, then your address won't start with "localhost" but something like 192.168.1.2: 19671 (it will depend on your router IP assignments).

Good luck
-- Mark

Jed Carty

unread,
May 3, 2018, 12:08:21 PM5/3/18
to TiddlyWiki
Another thing that can make life a lot easier is on everything other than Windows and Android you can use mdns/bonjour for the local network, this lets you name the server instead of having to use the ip address. So for my pie server setup I don't need to know the ip address, I can just got to pieserver.local on whatever network I am on and it will point to my server.

On osx, iOS and linux that makes connecting to a local server much easier. There may be some way to set it up on windows but it doesn't work out of the box.

JWHoneycutt

unread,
May 3, 2018, 9:57:35 PM5/3/18
to tiddl...@googlegroups.com
@BurningTreeC
Thank you for the link.  I didn't know that Node.js doesn't just automatically run on iOS, but can be made to, using X-code, React, etc.  Sounds like a task.
JWHoneycutt

JWHoneycutt

unread,
May 3, 2018, 9:58:08 PM5/3/18
to tiddl...@googlegroups.com
@Mark S. 
`local web path, not the physical file path` Is there an example of image refs on Node.js I can copy? (I don't know how to convert to local web path lingo)

`whether you're actually trying to run nodejs ON your iOS device, or whether you're trying to connect to an existing server running on your laptop`
I have my wiki autoloading when my laptop boots, and I love that. I can edit it and everything (except I've lost my images).
I was hoping that any changes I made were saved to Dropbox, and when I "load" my wiki using my phone, it would access the updated info on Dropbox.  I think that means I am trying to run Node.js ON my IOS device (right?).
Your post has me guessing every conceivable combo starting with 192.168.X.X:19671 on my iphone though (in hopes that it works through my wifi FROM my laptop)

JWHoneycutt

JWHoneycutt

unread,
May 3, 2018, 10:00:38 PM5/3/18
to TiddlyWiki
@Jed Carty
I have always ignored "Bonjour" - sounds like I need to look into it.  I assume I have Node.js running on the laptop, and it just "communicates" to the iOS device.  Thanks

Mark S.

unread,
May 3, 2018, 10:56:47 PM5/3/18
to TiddlyWiki
Since the server is running on your laptop, it would be it's IP address that you need. You didn't mention whether your laptop was windows or mac. I know nothing of macs, but here's a link to several methods for finding your IP:

https://www.wikihow.com/Find-Your-IP-Address-on-a-Mac

If you're on windows, just open a command shell and type ipconfig. Look for the line that says "IPv4".

According to tiddlywiki.com (https://tiddlywiki.com/#ServerCommand) you need to change the options part of your node.js invocation to:
 
--server 8080 $:/core/save/all text/plain text/html "" "" 192.168.0.245

where 192.168.0.245 gets substituted with your laptop's actual IP of course.

But tiddlywiki on plain.js doesn't serve images, and the browser will absolutely refuse to let you access the local images while viewing as a localhost web page.

So, you might want to try Jed's Bob server or Arlen's tiddly-server.  Each one has a different way of configuring for an image (files) directory. Assuming your images lived somewhere on a relative path to your TW instance, then once you know your  IP and the virtual file path then you can change the base path for your <<ximg>> to something like "http://192.168.1.114:8080/files/" .

HTH
-- Mark

JWHoneycutt

unread,
May 4, 2018, 6:09:04 PM5/4/18
to TiddlyWiki

"tiddlywiki on plain.js doesn't serve images, and the browser will absolutely refuse to let you access the local images while viewing as a localhost web page"

That sounds like a huge setback for Node.js as a solution for TW5!  Glad for Jed and Arlen's work on servers.  I'll have to start looking at them for ease of conversion if I still want to use my iOS devices like that.  In the meantime, I did find the app "Quine", but also have lost my image links via <<ximg ...>> there.

Thanks for the info.
JWH

Jed Carty

unread,
May 5, 2018, 6:18:05 AM5/5/18
to TiddlyWiki
What do you want to be able to do on iOS? If you want to be able to edit and view the wiki when the different node options will let you.

And I think that I should point out that the node version not serving other files on your computer is because of how servers work, it isn't a tiddlywiki specific problem. You have to explicitly say what the server makes available or it becomes a huge security problem because anyone can access anything on your computer.

Mark S.

unread,
May 5, 2018, 1:09:53 PM5/5/18
to TiddlyWiki


On Saturday, May 5, 2018 at 3:18:05 AM UTC-7, Jed Carty wrote:

And I think that I should point out that the node version not serving other files on your computer is because of how servers work, it isn't a tiddlywiki specific problem.

Well, it does mean that TW on node can't do everything that stand-alone TW can do, which isn't clear to most people considering node as a save option. To me, loss of images is pretty important.

Is there any intrinsic reason why tiddlywiki on node couldn't come with a server like Arlen's does? In terms of security, I wouldn't expect node.js to be web-facing. Or am I wrong? Is there a secure way to use node across the internet?

Thanks!
Mark
 

@TiddlyTweeter

unread,
May 5, 2018, 1:19:16 PM5/5/18
to TiddlyWiki
Mark S. wrote:
Well, it does mean that TW on node can't do everything that stand-alone TW can do, which isn't clear to most people considering node as a save option...

Agreed.

I think the lack of clarity about that in documentation is a Black Mark for users. These kinds of fundamental things need to be clear. Its easier to be okayish, once you know its gonna be hassle to image. But not knowing that up-front is not good.

To me, loss of images is pretty important.

Totally agree.

Jed Carty

unread,
May 5, 2018, 1:34:56 PM5/5/18
to TiddlyWiki
It doesn't have to be web facing to be a security concern. If you ever bring your computer or phone to starbucks it is exposed on a public network and if you have anything set up to be served on 0.0.0.0 it is accessible to anyone there, and if it is also able to serve anything from your computer your entire hard drive is exposed to everyone.

There are plenty of secure ways to use node as an externally facing server, I have one set up for tiddlywiki. But security is a difficult problem and it isn't obvious where there are security concerns, even to experienced security people. It is generally a good idea to go with a more conservative approach to security.

As a developer I do have responsibility for the things that I create so I am never going to make something that serves on 0.0.0.0 by default, nor anything that serves any file from the hard drive by default because it is unreasonable to expect everyone who uses what I make to understand the security and privacy implications of that.

If someone using what I make wants to change the settings to allow those things than they can, but then it is their decision to do something potentially dangerous and expose themselves in that way.

Anything that we make as the basic version of tiddlywiki should be as safe as possible. That means no serving arbitrary files by default. If people want to change the settings they are free to do that, but here there be dragons.

Mark S.

unread,
May 5, 2018, 2:08:29 PM5/5/18
to TiddlyWiki
Ji Jed,


On Saturday, May 5, 2018 at 10:34:56 AM UTC-7, Jed Carty wrote:
 
There are plenty of secure ways to use node as an externally facing server, I have one set up for tiddlywiki. But security is a difficult problem and it isn't obvious where there are security concerns, even to experienced security people. It is generally a good idea to go with a more conservative approach to security.


Yes. Security is messy. Which is why I assume that node isn't meant to be web-facing. I suppose you can use some sort of vpn. But it might be better to use syncthing which has security baked-in from the start.
 
 
As a developer I do have responsibility for the things that I create so I am never going to make something that serves on 0.0.0.0 by default, nor anything that serves any file from the hard drive by default because it is unreasonable to expect everyone who uses what I make to understand the security and privacy implications of that.

Uhmm ... when I launch your multi-user node (a few days older version) I get

Serving on 0.0.0.0:8080

I'm pretty sure *I* didn't put that 0.0.0.0 there. Unless it's the dust-bunnies carousing in my memory palace.

Anything that we make as the basic version of tiddlywiki should be as safe as possible. That means no serving arbitrary files by default. If people want to change the settings they are free to do that, but here there be dragons.

True, but it's not in there at all. Nor any warning or direction about images. And no alert about the dangers of coffee-shop use, which for a lot of people is a main use-case.

-- Mark

Jed Carty

unread,
May 5, 2018, 3:29:51 PM5/5/18
to TiddlyWiki
Heh, of course after I say all of that there I make a mistake somewhere. The dust bunnies are hiding in the example settings file on GitHub. I made a mistake and put the wrong host in it.

But with as careful as I was about default values and not exposing things that shouldn't be exposed I made a mistake in a demo settings file. So given that this sort of mistake is almost invisible (if you hadn't mentioned it I would have no reason to use the demo wiki or to think there are any problems with it) and can happen when all the defaults are what they should be and I know what I am doing.

Which is why hosting files is a separate thing and is not enabled by default. Otherwise that mistake would mean that all the files on anyones computer would have been exposed instead of one wiki.

Also I always forget that people aren't like me and won't immediately customise everything. I know that I should expect it but using the default or example version is still something that I have to force myself to consider people doing.

So I need to go change that demo settings file.
Reply all
Reply to author
Forward
0 new messages