Twexes on different port numbers

When you open several Twexes after another, they start running on different ports, starting with 8080. So you have to set the correct saving address, including port number, after opening a Twexe, and if you open more than one the order of opening matters.

The saving address is stored in the system tiddler $:/UploadURL and the used server port is stored in a few shadow tiddlers $:/info/url/...

I could make a button in each Twexe that copies the server address to the saving address. Can this be done automatically? How can I make my Twexes more ‘self-aware’ about the port number?

Greetings,
Sjaak

Are you asking how to make twexe’s that ALWAYS bind to a specific port? If so, you can technically do this BUT you’d have to edit the source code of twexe and rebuild it for your system (I.E, windows, Linux, Mac, Etc), if you are on windows you can try doing something like writing a batch file to execute in order your twexe instances. Not sure if this helps

The best I could think of is that I can start twexes in any order and that the twexes themselves know on which port they run and use that port number in the save address.

I managed to do this by adding the following tiddler to a twexe and tag it with $:/tags/StartupActions/Browser:

<$let fullurl={{$:/info/url/full}} saveat={{{ [<fullurl>addsuffix[store]] }}}>
<$action-setfield $tiddler="$:/UploadURL" $value=<<saveat>> />
</$let>

As far as I can tell, no harm is done when this tiddler is added to a HTML wiki.

I need to stop thinking outside tiddlywiki man, tiddlywiki is insane and I love it. Clever trick

1 Like