Hi & Thanks for Tiddlywiki + redbean server implementation

New TiddlyWiki user here.
First of all: thanks for this!
I thought I’d never find something like TiddlyWiki.
So nice to have a tool which doesn’t jail you into a certain infrastructure, platform or programming language…a low-code unhosted backend.
I’m using it as my personal notebook now, and am baffled how powerful & scriptable this app is.

Btw. here’s a 1.2mb tiddlywiki server-binary which runs on win/mac/linux: tiddlywiki + redbean server (1.2MB) GitHub Gist

here’s an example zip: https://gist.github.com/coderofsalvation/f9e22cef04222bca03f7bc342b2a0a2c/raw/21e1c8b5a014915faddcdfa936dbd98686b38e56/example.zip

Basically you’d:

  • unzip example.zip
  • run ./redbean.com -D . -M 5000000 in a console on your laptop (or on a server)
  • surf to http://localhost:8080 and voila

In case of questions, modifications, scripting e.g. surf to redbean dot dev

5 Likes

Welcome and thanks for your contribution.

Of course many of us will not be able to make use of your solution be cause we are dummies. If you can package or make executables all the better, although I am sure some of us can make use of it.

sure, I’ve updated the post.

2 Likes

I was able to run it on Windows 10.

On Create new tiddler, and save the tiddler, I got the bellow error

image

My console screen is like below

# .\redbean.com -D . -M 500000
I2022-07-28T08:39:26.393286:tool/net/redbean.c:982:redbean:11600] (cfg) program directory: .
I2022-07-28T08:39:26+009035:tool/net/redbean.c:7029:redbean:11600] (srvr) listen http://192.168.88.2:8080
I2022-07-28T08:39:26+000000:tool/net/redbean.c:7029:redbean:11600] (srvr) listen http://127.0.0.1:8080I2022-07-28T08:39:44.351052:tool/net/redbean.c:5988:redbean:12408] (req) received 127.0.0.1:64242 HTTP11 GET http://127.0.0.1:8080/ "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 Edg/103.0.1264.71"
I2022-07-28T08:39:44+250846:tool/net/redbean.c:5988:redbean:12408] (req) received 127.0.0.1:64242 HTTP11 OPTIONS http://127.0.0.1:8080/ "http://127.0.0.1:8080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 Edg/103.0.1264.71"
I2022-07-28T08:39:44+293635:tool/net/redbean.c:5988:redbean:12408] (req) received 127.0.0.1:64242 HTTP11 GET http://127.0.0.1:8080/favicon.ico "http://127.0.0.1:8080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 Edg/103.0.1264.71"
E2022-07-28T08:40:09.621288:tool/net/redbean.c:2435:redbean:12408] (srvr) failure: 413 Payload Too Large 127.0.0.1:64242 HTTP11 PUT "127.0.0.1:8080" "/" "http://127.0.0.1:8080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36 Edg/103.0.1264.71"
>:

Hm…your server says “Payload Too Large” (maybe because of images inside the tiddlywiki).
I guess you have to change the uploadlimit (./redbean.com -D . -M 5000000) to something higher (add some zeros to 500000).

Hi folks,

Please make sure that you understand what’s going on here.
Make sure you know where the executable comes from and what it does contain.

Please make sure, that you exactly know what the following commands mean, because you “bet” your computer on it.

curl https://redbean.dev/redbean-latest.com > redbean.com
chmod +x redbean.com
chmod 755 redbean.com

Just that nobody can say … I didn’t tell you.

have fun!

1 Like

I and I expect others have had some spam appear in talk.tiddlywiki.org which are quickly flagged and removed from view. We need to be aware people or robots have joined to spam and possibly phish so we do need to be carful.

  • This illustrates the value in macro solutions without exe’s or Javascript because they are safer and harder to hide payloads.

Hang on @pmario and @TW_Tones! It’s not at all welcoming to new posters to make posts that question their motives.

There’s nothing wrong or suspicious here. @coderofsalvation is using Readbean which is widely used and extensively tested.

@pmario is correct that people should be careful running these low level commands, but it’s very important to make clear that that is general advice, and not specific to this case.

@TW_Tones this is absolutely nothing to do with spam, and bringing it up here just looks incredibly unwelcoming.

Please be aware that your words have an impact on people; @coderofsalvation is a human being, and doesn’t deserve to be treated with suspicion like this.

4 Likes

@coderofsalvation welcome to the community and thank you for sharing. It is really nice to see more interest in using TiddlyWiki with RedBean. In case it is of interest to you, here is a prior example of RedBean used with TW: Redbean Tiddlywiki Saver: rpdillon.net — Rick's Home Online

Would you be amenable to the title of the thread being changed to include a reference to a redbean server implementation? The motive is to make it easier for other interested users to find your post in the future.

2 Likes

Would it be feasible to add support for the HTTP COPY method to copy an existing wiki to another path?

I have a WebDAV saver plugin for TiddlyWiki that does backups via this approach that I would like to get cleaned up and published.

3 Likes

2 posts were split to a new topic: Public moderation

@jeremyruston @ pmario @ TW_Tones thanks for the heads up, all good, no harm done :heart:

@saqimtiaz sure, I’ve updated the thread title as you request.
Btw. I don’t know too much about HTTP COPY & WebDav.
So I think I’ll just leave it at this simple reference implementation, and leave it up to somebody else to extend it further.
I know Rick’s Post thx, in fact, I simply summarized (+bugfixed) Rick’s post into a shellscript.
The zip/binary was posted on @ TW_Tones’s request.

@coderofsalvation … I’m sorry if it came through, as if it was “questioning the motives”. That wasn’t in my interest. … I wanted to make sure, that users know, that the commands in my post are dangerous if they are used “blindly”. … That’s it.

Does this solution only serve TW, or does it allow saving as well?

1 Like

Yes, the topic deserves more attention and a more in depth write up.

Yes it allows saving.

redbean is a server that is scriptable in the Lua language. Assets can be embeded, served, and updated within the executable, or assets can be served from files on disc.

Assets (html, images, server scripts) are added to the redbean executable using the ubiquitous zip utility.

Unfortunately, the function (StoreAsset) which updates an asset in the executable is not yet working on the Windows platform. redbean is a cross-platform executable - meaning the exact same binary can run on Windows, Linux, and Mac - so build once, run anywhere.

One obvious possible use of redbean is distributing a tiddlywiki as a single-file executable.

This version of the server script is serving a tiddlywiki .html file from disk, and allows saving to disc without extra plugins for the wiki.

This is in my view very important especially with a view to finding a solution similar to Make TiddlyWiki your own - discussion. Basicaly finding a way to give people a simple download and serve with one or more tiddlywiki editions therein.

There is a solution called twexe which comes with a default wiki, and you can load another wiki and the distribute that, however we do need to find away to give it a crc check or something.

Thanks @coderofsalvation for introducing this alternative and making the exe, if you can think of any other ease of acquisition steps for the distribution of tiddlywiki “applications” do let us know.

  • It will be a few more days before I can give this the focus I want.
1 Like

update:

should be:

This is needed to turn off caching.
Reason: I’ve started to use a (redbean) tiddlywiki on my (and my wife’s) smartphone (using chrome’s ‘add to homescreen’) so we could easily share ideas for home refurbishment, holidays etc (using the ‘refresh all’-button).
However, it didn’t properly refresh new tiddlers because of caching.
In the browser network console, I could see it was doing a PUT request, while the server was not reporting any request.
(As if an internal http-request layer inside tiddlywiki was not relaying it)

hope this helps!

HI @coderofsalvation

If you include a .init.lua file which is executed first, you can set these options there and avoid the command line options, as well as do other initializations like setting the server address and port, or launching your browser if you like.

-- file: .init.lua
WIKI_PATH="wiki.html"

ProgramCache(0)
-- ProgramAddr(0.0.0.0)
-- ProgramPort(8765)
ProgramDirectory(".")
ProgramMaxPayloadSize(2 * GetAssetSize(WIKI_PATH))
LaunchBrowser()

Thanks for making this thread.

My build script is here.

1 Like