Update on the syncer rewrite

64 views
Skip to first unread message

Jeremy Ruston

unread,
Dec 16, 2019, 6:16:06 AM12/16/19
to TiddlyWikiDev
For the last several weeks I've been working on a thorough overhaul of the syncer, and I'm now close to merging those changes into master. I'm posting here now because this is a good opportunity for developers to test projects that may be affected by these changes (eg TiddlyServer, Bob etc.).

The syncer is a core component responsible for two slightly different jobs:

* In the browser, the syncer is used to determine which tiddlers need to be loaded and saved across the network to the server
* On the server, the syncer is used to determine which tiddlers need to be  saved to the file system

To allow the same component to be used in these two contexts we abstract the loading and saving to a "syncadaptor", with the "tiddlyweb" adaptor in the browser that uses HTTP to talk to the server and the "filesystem" adaptor on the server that uses the Node.js file APIs to write to the filing system.

The primary problem that I've been addressing is that up until now the internal state of the syncer would become corrupt after encountering network connectivity issues. In some situations this has led to users losing data. A fairly deep rewrite was necessary which means that a number of other issues have been addressed at the same time.

The complete list of changes is:
  • Improved resilience to connection errors. Errors encountered by the browser are automatically retried, and when they succeed the associated error messages are automatically removed
  • Changes to system tiddlers are now synchronised from the server to the browser
  • Deletions of tiddlers on the server are now synchronised to the browser
  • New animated "cloud” page control button with a dropdown menu showing status and additional actions:
    • "Refresh from server" to force an immediate check for changes from the server
    • "Logout"
    • "Save snapshot for offline use" to save a copy of the wiki without the client-server components
    • "Copy syncer logs to clipboard" to make it easier to ask end users for debugging information 
  • Added "filter" and "exclude" parameters to the [[GET /recipes/default/tiddlers.json|WebServer API: Get All Tiddlers]] endpoint to allow the returned tiddlers and fields to be filtered
  • Enhanced LazyLoading to include skinny versions of tiddlers in the HTML file, and to avoid unnecessary loads from the server
  • The official plugin library is now disabled when the tiddlyweb adaptor is active
  • Internal file system details are no longer exposed to browsers when a file request fails (see https://github.com/Jermolene/TiddlyWiki5/issues/3724)
All these changes are intended to be backwards compatible, and so I’d be grateful for any feedback before this is merged.

The pull request includes a lot of commentary about the changes:


Feedback and questions welcome,

Best wishes

Jeremy






LinOnetwo

unread,
Dec 26, 2019, 1:06:52 AM12/26/19
to TiddlyWikiDev
Cool, hope this can be merge and release soon.

I'm working on https://github.com/linonetwo/solid-tiddlywiki-syncadaptor , which will save each tiddlers saparately instead of a whole HTML file.
I hope I can use this syncadaptor to make tiddlywiki a mobile app that can use offline and sync when online, with your update

在 2019年12月16日星期一 UTC+8下午7:16:06,Jeremy Ruston写道:
Reply all
Reply to author
Forward
0 new messages