1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/webserver
Jeremy Ruston b95723a022
Fix syncer to handler errors properly (#4373)
* First commit

* Add throttling of saves

Now we refuse to save a tiddler more often than once per second.

* Wait for a timeout before trying again after an error

* Modest optimisations of isDirty() method

* Synchronise system tiddlers and deletions from the server

Fixes two long-standing issues:

* Changes to system tiddlers are not synchronised from the server to the browser
* Deletions of tiddlers on the server are not propagated to browser clients

* Make sure we update the dirty status even if there isn't a task to perform

* Replace save-wiki button with popup sync menu

* Remove the "Server" control panel tab

We don't need it with the enhanced sync dropdown

* Add indentation to the save-wiki button

* Fix spacing in dropdown menu items

* Switch between cloud icons according to dirty status

* Add a menu item to copy syncer logs to the clipboard

* Improve animated icon

* Remove indentation from save-wiki button

@pmario the annoying thing is that using `\trim whitespace` trims significant whitespace too, so it means we have to use <$text text=" "/> when we need a space that won't be trimmed. For the moment, I've removed the indentation but will keep thinking about it.

* Further icon, UI and copy text tweaks

Move the icons and styles from the core into the TiddlyWeb plugin

* Clean up PR diff

* Tweak animation durations

* Break the actions from the syncer dropdown into separate tiddlers

@pmario I think this makes things a bit easier to follow

* Refactor syncadaptor creation and logging

The goal is for the syncadaptor to be able to log to the same logger as the syncer, so that the "copy syncer logs to clipboard" data is more useful.

* Don't transition the dirty indicator container colour, just the SVG's colour

* Only trigger a sync for changes to tiddlers we're interested in

Otherwise it is triggered by the creation of the alert tiddlers used to display errors.

* Restore deleting local tiddlers removed from the server

(I had commented it out for some testing and accidentally commited it).

* Guard against missing adaptor info

* We still need to trigger a timeout when there was no task to process

* Avoid repeatedly polling for changes

Instead we only trigger a timeout call at if there is a pending task (ie a tiddler that has changed but isn't yet old enough to save).

* Lazy loading: include skinny versions of lazily loaded tiddlers in the index.html

* Introduce _is_skinny field for indicating that a tiddler is subject to lazy loading

* Remove savetrail plugin from prerelease

It doesn't yet work with the new syncer

* Make the savetrail plugin work again

* Clear outstanding alerts when synchronisation is restored

* Logger: only remove alerts from the same component

Missed off 9f5c0de07

* Make the saving throttle interval configurable (#4385)

After switching Bob to use the core syncer the throttle interval makes saving feel very sluggish compared to the message queue setup that I had before.
The editing lock that I use to prevent conflicts with multiple users doesn't go away until the save is completed, and with the 1 second delay it means that if you edit a tiddler and save it than you have to wait one second before you can edit it again.

* Tweaks to appearance of alerts

* Exclude temp tiddlers from offline snapshots

Otherwise alerts will persist

* Tweak appearance of status line in dropdown

* Update release note

* Web server: Don't include full path in error messages

Fixes #3724

* In change event handler check for deletions

* Disable the official plugin library when the tiddlyweb plugin is loaded

* Hide error details from browser for /files/ route

See https://github.com/Jermolene/TiddlyWiki5/issues/3724#issuecomment-565702492 -- thanks @pmario

* Revert all the changes to the relationship between the syncer and the syncadaptor

Previously we had some major rearrangements to make it possible for the syncadaptor to route it's logging to the logger used by the syncer. The motivation is so that the "copy logs to clipboard" button is more useful.

On reflection, changing the interface this drastically is undesirable from a backwards compatibility perspective, so I'm going to investigate other ways to achieve the logger sharing

* Make the tiddlyweb adaptor use the syncer's logger

So that both are availavble when copying the syncer logs to the clipboard

* Update release note

* Support setting port=0 to get an OS assigned port

Quite useful

* Update code comment

* UI: Use "Get latest changes from server" instead of "Refresh"

* Add getUpdatedTiddlers() method to syncadaptor API

See https://github.com/Jermolene/TiddlyWiki5/pull/4373#issuecomment-573579495

* Refactor revision handling within the syncer

Thanks @pmario

* Fix typo in tiddlywebadaptor

* Improve presentation of errors

See https://github.com/Jermolene/TiddlyWiki5/pull/4373#issuecomment-573695267

* Add docs for getTiddlerRevision()

* Remove unused error animation

* Update comment for GET /recipes/default/tiddlers/tiddlers.json

* Optimise SVG cloud image

* Add optional list of allowed filters for get all tiddlers route

An attempt to address @Arlen22's concern here:

https://github.com/Jermolene/TiddlyWiki5/pull/4373#pullrequestreview-342146190

* Fix network error alert text translatability

* Fix error code and logging for GET /recipes/default/tiddlers/tiddlers.json

Thanks @Arlen22

* Flip GET /recipes/default/tiddlers/tiddlers.json allowed filter handling to be secure by default

* Validate updates received from getUpdatedTiddlers()

* Add syncer method to force loading of a tiddler from the server

* Remove the release note update to remove the merge conflict

* Fix crash when there's no config section in the tiddlywiki.info file

* Use config tiddler title to check filter query (merge into fix-syncer) (#4478)

* Use config tiddler title to check filter query

* Create config-tiddlers-filter.tid

* Add config switch to enable all filters on GET /recipes/default/tiddlers/tiddlers.json

And update docs

* Fix bug when deleting a tiddler with a shadow

Reported by @kookma at https://github.com/Jermolene/TiddlyWiki5/pull/4373#issuecomment-604027528

Co-authored-by: jed <inmysocks@fastmail.com>
Co-authored-by: Arlen22 <arlenbee@gmail.com>
2020-03-30 15:24:05 +01:00
..
TiddlyWeb JSON tiddler format.tid Finish web server API docs 2018-10-02 14:16:58 +01:00
Using HTTPS.tid Docs: fix HTTPS command typos 2019-01-27 14:35:58 +00:00
Using the external JavaScript template.tid Docs: typo in "Using the external JavaScript template" 2019-07-02 15:35:11 +01:00
Using the integrated static file server.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
Using the read-only single tiddler view.tid Improvements to the static single tiddler view as well as documentation. (#3386) 2018-12-01 13:30:00 +00:00
WebServer Anonymous Access.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer API_ Delete Tiddler.tid Finish web server API docs 2018-10-02 14:16:58 +01:00
WebServer API_ Force Basic Authentication Login.tid Fix basic authentication forced login 2018-12-16 18:20:33 +00:00
WebServer API_ Get All Tiddlers.tid Fix syncer to handler errors properly (#4373) 2020-03-30 15:24:05 +01:00
WebServer API_ Get Favicon.tid Finish web server API docs 2018-10-02 14:16:58 +01:00
WebServer API_ Get File.tid Finish web server API docs 2018-10-02 14:16:58 +01:00
WebServer API_ Get Rendered Tiddler.tid Docs update 2018-10-02 14:54:46 +01:00
WebServer API_ Get Server Status.tid Finish web server API docs 2018-10-02 14:16:58 +01:00
WebServer API_ Get Tiddler.tid Finish web server API docs 2018-10-02 14:16:58 +01:00
WebServer API_ Get Wiki.tid Finish web server API docs 2018-10-02 14:16:58 +01:00
WebServer API_ Put Tiddler.tid Finish web server API docs 2018-10-02 14:16:58 +01:00
WebServer API.tid Docs update 2018-10-02 14:19:06 +01:00
WebServer Authentication.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Authorization.tid Docs: webserver and read-only mode 2018-09-05 08:38:47 +01:00
WebServer Basic Authentication.tid Fix basic authentication forced login 2018-12-16 18:20:33 +00:00
WebServer Guides.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Header Authentication.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ anon-username.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ authenticated-user-header.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ credentials.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ csrf-disable.tid Docs: Update WebServer Parameter: csrf-disable 2019-04-23 17:53:19 +01:00
WebServer Parameter_ debug-level.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ host.tid Info about using 0.0.0.0, plus warning about using it. (#3519) 2018-11-29 09:47:37 +00:00
WebServer Parameter_ password.tid Fix typo password -> username (#3686) 2019-01-14 09:42:09 +00:00
WebServer Parameter_ path-prefix.tid Clarify docs on the path-prefix subcommand of the listen command 2020-03-11 17:19:21 +00:00
WebServer Parameter_ port.tid Fix syncer to handler errors properly (#4373) 2020-03-30 15:24:05 +01:00
WebServer Parameter_ readers.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ root-render-type.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ root-serve-type.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ root-tiddler.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ system-tiddler-render-template.tid Improvements to the static single tiddler view as well as documentation. (#3386) 2018-12-01 13:30:00 +00:00
WebServer Parameter_ system-tiddler-render-type.tid Improvements to the static single tiddler view as well as documentation. (#3386) 2018-12-01 13:30:00 +00:00
WebServer Parameter_ tiddler-render-template.tid Improvements to the static single tiddler view as well as documentation. (#3386) 2018-12-01 13:30:00 +00:00
WebServer Parameter_ tiddler-render-type.tid Improvements to the static single tiddler view as well as documentation. (#3386) 2018-12-01 13:30:00 +00:00
WebServer Parameter_ tls-cert.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ tls-key.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameter_ username.tid Docs update 2018-11-25 10:37:33 +00:00
WebServer Parameter_ writers.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer Parameters.tid Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
WebServer.tid Fix basic authentication forced login 2018-12-16 18:20:33 +00:00