Why is username stored in status?

When running TW from NodeJS, the username is reset to empty every time I refresh the page.

“Username for signing edits” is stored in $:/status/UserName.

From Github:

$:/state/ tiddlers are not synced from the browser back to the server in client server configuration. This is done so that multiple users’ state doesn’t interact

Question 1

Can the username be stored in a non-state tiddler for persistence?

Non-Ideal Solution

There is this solution posted on GitHub.

The workaround is to manually create a .tid file in your wiki folder and then restart the server

But this also means I cannot drag and drop the username from one tiddler’s browser tab to another. To sync usernames, I will always have to copy username.tid file to the tiddlers’ folder and restart the server.

Remarks

TW does not have an authentication model in a multi-user environment. It seems storing the username in the state tiddlers is a stop-gap measure to identify the author of a tiddler in multiple-users accessing the same wiki scenario.

2 Likes

You can change your https://tiddlywiki.com/#%24%3A%2Fconfig%2FSyncFilter tiddler and add the $:/status/UserName so it is synced.

Config tiddlers are there to be changed

1 Like

Oh wow! You know I was apprehensive before posting this question that there would be no way to sync the state tiddlers :clap: :clap:

When running under Node.js, the value of $:/status/UserName reflects the user name as determined by the server.

If you are not using authentication but want to have an explicit username then you must use the anon-username configuration parameter of the --listen command. See https://tiddlywiki.com/#WebServer%20Parameter%3A%20anon-username

For example:

tiddlywik mywikifolder --listen anon-username=joe

That is not the recommended approach.

3 Likes

Thank you. I updated my scripts to use anon-username paramter.

$:/config/SyncFilter tip can be used in other cases. Like to always show editor’s preview pane.