Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TiddlyWeb shouldn't sync $:/StoryList to the client #8747

Closed
linonetwo opened this issue Nov 14, 2024 · 4 comments
Closed

[BUG] TiddlyWeb shouldn't sync $:/StoryList to the client #8747

linonetwo opened this issue Nov 14, 2024 · 4 comments

Comments

@linonetwo
Copy link
Contributor

Describe the bug

In readonly client-server setup, the wiki may sync $:/StoryList to the client, redirect the client to another tiddler by overwriting client's $:/StoryList

Expected behavior

Don't send $:/StoryList to the client, each client should have its own $:/StoryList.

To Reproduce

  1. open https://wiki.onetwo.ren/#GoogleEarthVR:GoogleEarthVR
  2. it loads
  3. it get the $:/StoryList on background
  4. it goes to https://wiki.onetwo.ren/#Index:Index by it self

Screenshots

No response

TiddlyWiki Configuration

  • 5.3.5
  • TiddlyWeb

Additional context

The server is started by

tiddlywiki D:\wiki\linonetwo-wiki --listen port=5217 host=0.0.0.0 root-tiddler=$:/core/save/lazy-all gzip=yes readers=(anon) writers=林一二 username=林一二 password=XhJOxxxxxxxxxxxxx anon-username=林一二 --setfield [[$:/plugins/flibbles/relink]] [[$:/plugins/flibbles/relink-markdown]] [[$:/plugins/flibbles/relink-titles]] [[$:/plugins/kixam/datepicker]] [[$:/plugins/kixam/moment]] [[$:/plugins/kookma/commander]] [[$:/plugins/kookma/refnotes]] [[$:/plugins/linonetwo/flow-chart]] [[$:/plugins/linonetwo/zx-script]] [[$:/plugins/linonetwo/github-external-image]] [[$:/plugins/linonetwo/markdown-transformer]] [[$:/plugins/linonetwo/source-control-management]] [[$:/plugins/linonetwo/slate-write]] [[$:/plugins/linonetwo/open-in-external-app]] [[$:/plugins/oflg/fishing]] [[$:/plugins/oflg/fishing-analysis]] [[$:/plugins/oflg/fishing-catchfish]] [[$:/plugins/oflg/fishing-zh-Hans]] [[$:/plugins/tiddlywiki/dynannotate]] [[$:/plugins/linonetwo/sub-wiki]] [[$:/plugins/linonetwo/tw-mobile-sync]] [[$:/plugins/linonetwo/tw-calendar]] [[$:/plugins/linonetwo/tw-whiteboard]] [[$:/plugins/linonetwo/tw-react]] [[$:/plugins/linonetwo/super-tag]] [[$:/plugins/oeyoews/tiddlywiki-codemirror-6]] [[$:/plugins/linonetwo/hyper-table]] [[$:/plugins/BTC/TiddlyFlex]] [[$:/plugins/oeyoews/mermaid]] [[$:/plugins/tiddlywiki/katex]] text text/plain

where password is random generated and masked here. I use random password to make it a readonly blog site.

@jrbntt
Copy link

jrbntt commented Nov 25, 2024

I was able to reproduce this with a very specific combination of options:

  • Wiki is loaded read only
  • $:/config/SyncSystemTiddlersFromServer has a value of "yes"

The $:/config/SyncSystemTiddlersFromServer Tiddler in particular is crucial. If I set it to "no", then the read only client only opens whatever is specified by the URL (either the value of $:/DefaultTiddlers or the Tiddler specified in the URL hash).

Comparing when I use the wiki logged in via HTTP Basic Authentication versus anonymous, the anonymous access issues a HTTP GET for $:/StoryList near the end of the page load that is not present when authenticated. However, I'm not currently sure why this happens.

If you do not require the $:/config/SyncSystemTiddlersFromServer value of "yes", then changing this to "no" will function as a work around for your immediate issue.

EDIT: The "why it happens" seems a bit obvious after I stepped away for a few minutes. It's even in the description for $:/config/SyncSystemTiddlersFromServer, which I read an hour or so ago, but apparently didn't fully understand. Here's the relevant part:

Engaging sync of system tiddlers means that tiddlers such as $:/StoryList and $:/HistoryList get synced

The part I failed to grasp on first read was that "sync" doesn't just apply when the client is saving; it also applies when the client is fetching. The server route in core/modules/server/routes/get-tiddlers-json.js modifies the client request to filter out system tiddlers if $:/config/SyncSystemTiddlersFromServer is "no". Since $:/StoryList is a system tiddler, if $:/config/SyncSystemTiddlersFromServer is "yes", then it will be returned by the filter.

Possible fix is to add another conditional in that route that checks $:/status/IsReadOnly and modifies the filter to remove any system tiddlers that shouldn't be retrieved for Read Only mode.

@Jermolene
Copy link
Member

Thanks @jrbntt for the very clear explanation, which is quite correct. Not syncing system tiddlers by default is a very crumbly hack but it has worked reasonably well for us so far. The development of MWS in #7915 will hopefully finally fix this sort of thing properly.

@linonetwo
Copy link
Contributor Author

Thank you @jrbntt , this is the correct answer, a feature, not a bug. After deleting $:/config/SyncSystemTiddlersFromServer tiddler, my blog return normal.

I remember a bad implementation in previous version of my "command palette plugin" introduce this setting, and I remove it afterwards, but forget to delete this config tiddler from my wiki.

@jrbntt
Copy link

jrbntt commented Nov 25, 2024

@linonetwo Glad that this resolved the problem.

The idea I floated about modifying the filter for System tiddlers in case of $:/status/IsReadOnly seems a little dangerous, in retrospect. Assuming someone has turned on $:/config/SyncSystemTiddlersFromServer intentionally, they're probably using it for some custom edge case that removing $:/StoryList from the returned tiddlers might break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants