[TW5] is it possible to serve local file in tiddlywiki server mode

717 views
Skip to first unread message

张雷

unread,
Jan 7, 2015, 9:19:34 PM1/7/15
to tiddl...@googlegroups.com
I am trying to add external link for file in tiddlywiki. I found the `[ext[relative/path]]` method.
But what's the relative path? 

For example 

My tiddlywiki is set up by using `node /usr/local/bin/tiddlywiki /home/jeffrey/Dropbox/wiki/personal --server 8181`

[ext[a.pdf]]
 
it will render like below as expected.

<a class="tc-tiddlylink-external" href="a.pdf" target="_blank">a.pdf</a>

But when click the link. The browser will open `http://localhost:8181/a.pdf` with nothing.

I think it should work if there is a file locate in /home/jeffrey/Dropbox/wiki/personal/ or /home/jeffrey/Dropbox/wiki/personal/tiddllers/.
But I am failed. 

Is it possible?

Tobias Beer

unread,
Jan 8, 2015, 3:08:30 AM1/8/15
to tiddl...@googlegroups.com
Works for me...


Perhaps you forgot to set some fields correctly?

Best wishes, Tobias.

Lei Zhang

unread,
Jan 8, 2015, 3:20:53 AM1/8/15
to tiddl...@googlegroups.com
I don't think this is what I want.

1. I want to link a binary file( like pdf, exe files), not just a image.
2. I think the root cause should be that whether the tiddlywiki server
can serve files from local disk.
i.e, can I get the file through `curl
http://localhost:8181/files/a.pdf` ( the 8181 port running by node )
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "TiddlyWiki" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/tiddlywiki/qDcuJAeaLIY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> tiddlywiki+...@googlegroups.com.
> To post to this group, send email to tiddl...@googlegroups.com.
> Visit this group at http://groups.google.com/group/tiddlywiki.
> For more options, visit https://groups.google.com/d/optout.



--
Lei Zhang
Blog: http://xcodest.me
twitter/weibo: @jeffrey4l

Tobias Beer

unread,
Jan 8, 2015, 3:42:49 AM1/8/15
to tiddl...@googlegroups.com
 
1. I want to link a binary file( like pdf, exe files), not just a image.

Added a pdf.


TiddlyWiki won't have you run an exe.
Your browser won't have you do it, obviously.
 
2. I think the root cause should be that whether the tiddlywiki server can serve files from local disk.

Of course, that node.js server can.
Ok, let me rephrase that: Are you trying to generate a static site?

Also, try [ext[./a.pdf]]for files in the same directory.
Otherwise, use subdirectories, which sounds advisable anyway.

Best wishes, Tobias. 

Tobias Beer

unread,
Jan 8, 2015, 3:51:00 AM1/8/15
to tiddl...@googlegroups.com
Sorry, decided to go into "breakfast-mode" first.
You're all asking about node.js and I hand you dropbox. ^^

Best wishes, Tobias. 

Lei Zhang

unread,
Jan 8, 2015, 3:56:20 AM1/8/15
to tiddl...@googlegroups.com
On Thu, Jan 8, 2015 at 4:51 PM, Tobias Beer <beert...@gmail.com> wrote:
> You're all asking about node.js and I hand you dropbox. ^^

yup.

This is the misunderstand between us.

In dropbox or static html file case, your solution works as expected.

But in nodejs case, the tiddlywiki server doesn't serve the local
file. I still expect that the tiddlywiki server can do.

BJ

unread,
Jan 9, 2015, 8:20:00 AM1/9/15
to tiddl...@googlegroups.com

Hi 张雷,
with a relative path the browser is going to use the location of the webpage as the starting point for relative url so it appends a.pdf to http://localhost:8181 - to form http://localhost:8181/a.pdf. which means that when you click the link to send a 'get' to the tiddlywiki-node processes (at http://localhost:8181), but tiddlywiki on nodejs is not a webserver so this fails.

cheers

BJ
Reply all
Reply to author
Forward
0 new messages