Minimal Ruby Server

275 views
Skip to first unread message

Jim

unread,
May 12, 2018, 10:32:45 AM5/12/18
to TiddlyWiki
I use Ruby and so always have it installed. If you do too, here's a minimal server using Ruby Webrick. It just serves up files from the same folder and handles saving.

Once running, just point yor web browser at localhost:8000 to view the folder listing, and click on your wiki html file.

https://gist.github.com/jimfoltz/ee791c1bdd30ce137bc23cce826096da


Mark S.

unread,
May 12, 2018, 1:49:27 PM5/12/18
to TiddlyWiki
You should add this as a PR as saver #21 at TiddlyWiki.com

Will this also serve images?

-- Mark

Jim

unread,
May 13, 2018, 10:32:49 AM5/13/18
to TiddlyWiki
I've updated the file to create a back-up file on save. It might slow things down on large TW's but better to be safe than sorry.


> You should add this as a PR as saver #21 at TiddlyWiki.com

I'm not against it, but have no idea.


> Will this also serve images?

Images in a TW (which is just html)? Then yes it works.

Mark S.

unread,
May 13, 2018, 12:18:33 PM5/13/18
to TiddlyWiki
No, I meant images to external files. Adding images to TW directly slows it down very quickly.

-- Mark

Jim

unread,
May 13, 2018, 12:42:40 PM5/13/18
to TiddlyWiki
Both of these work - a remote image and a local image:

Mark S.

unread,
May 13, 2018, 6:39:49 PM5/13/18
to TiddlyWiki

-- Mark

On Sunday, May 13, 2018 at 7:32:49 AM UTC-7, Jim wrote:

TonyM

unread,
May 13, 2018, 8:29:38 PM5/13/18
to TiddlyWiki
Jim,

My cpanel account permits the use of Ruby on Rails. Can you possibly provide guidence on using this to serve tiddlywiki files that can be saved?

Regards
Tony

Mark S.

unread,
May 13, 2018, 9:47:02 PM5/13/18
to TiddlyWiki
I would be really worried about using this on a world-facing server. Or does WebBrick have security built in somehow?

-- Mark

Jim

unread,
May 14, 2018, 4:06:18 PM5/14/18
to TiddlyWiki
Sorry Tony I don't have the knowledge to help with that.  I agree with Mark - I would only use it locally and as-needed, shutting it down when you no longer need it.

Jim

unread,
May 14, 2018, 5:18:40 PM5/14/18
to TiddlyWiki
Cool, thanks.

Sebastian Silva

unread,
May 14, 2018, 11:16:45 PM5/14/18
to TiddlyWiki
That's fun! I've been experimenting with supporting Tiddlywiki and integrating parts of it with my Python application.

I've found that in Python you can use the WsgiDAV library to serve single file TiddlyWikis very nicely.

All you need to do is install wsgidav library:

pip install wsgidav
# or pip install --user wsgidav

After that you can run:
wsgidav --host=0.0.0.0 --server wsgiref --port=80 --root=/path/to/your/tiddlywiki/

You can also use it to integrate into an existing web app or building something else. Here's the documentation.

Use the latest Tiddlywiki with the fixes for WebDAV or the wsgidav from git to avoid 412 errors.

Hope it's useful to someone.

Regards,
Sebastian

Mark S.

unread,
May 15, 2018, 12:24:14 AM5/15/18
to TiddlyWiki
Oh snap -- method #22.

Does using 0.0.0.0 expose server to the entire local web (in which case there is a coffee-house danger) ?

Thanks!
Mark

Sebastian Silva

unread,
May 15, 2018, 12:31:37 AM5/15/18
to tiddl...@googlegroups.com

Yes I should've mentioned that - you can use 127.0.0.1 to just use it yourself.

I don't remember which is the default.

Regards,

Sebastian

--
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/ETot2hZNgYM/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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/ba13b4ca-838a-4279-813e-0ae297f05d4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arlen Beiler

unread,
May 15, 2018, 6:04:39 PM5/15/18
to TiddlyWiki
I think we really just need one method called "Serving static files with saving" and include everything that provides that capability using the put saver or equivalent mechanism. :)

--
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+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages