Commit Graph
65 Commits
Author SHA1 Message Date
Jeremy Ruston ae12ce5cbf 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).
2019-11-29 16:46:35 +00:00
Jeremy Ruston 24376d7e53 We still need to trigger a timeout when there was no task to process 2019-11-29 16:12:04 +00:00
Jeremy Ruston 3b10f9ed84 Restore deleting local tiddlers removed from the server
(I had commented it out for some testing and accidentally commited it).
2019-11-29 16:05:35 +00:00
Jeremy Ruston e0ed121776 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.
2019-11-26 13:14:18 +00:00
Jeremy Ruston 94a96846b9 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.
2019-11-19 11:15:13 +00:00
Jeremy Ruston d45501b7a0 Add a menu item to copy syncer logs to the clipboard 2019-11-18 13:53:57 +00:00
Jeremy Ruston e37640bf1a Make sure we update the dirty status even if there isn't a task to perform 2019-11-18 11:26:44 +00:00
Jeremy Ruston 499c5ee398 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
2019-11-16 21:02:01 +00:00
Jeremy Ruston c7d3e89d55 Modest optimisations of isDirty() method 2019-11-15 17:55:39 +00:00
Jeremy Ruston dc938c19f8 Wait for a timeout before trying again after an error 2019-11-15 17:50:03 +00:00
Jeremy Ruston e93da7baf3 Add throttling of saves
Now we refuse to save a tiddler more often than once per second.
2019-11-14 22:49:14 +00:00
Jeremy Ruston ca94cd3cf7 First commit 2019-11-14 22:04:44 +00:00
Jeremy Ruston 43d18e74d5 Syncer: add hidden setting for disabling lazy loading 2019-10-25 10:02:57 +01:00
Jermolene 6b03ba9876 Syncer: support configurable polling interval 2018-10-19 16:32:23 +01:00
Jermolene d50e2df57b Syncer: fix problem with incoming tiddlers
The bug here is that incoming tiddlers (ie tiddlers that were updated on the server and synced back to the browser) will retain any fields that are currently present but deleted in the incoming tiddler
2018-10-14 15:35:26 +01:00
snlhnk c05c0d3df6 Module-ize server routes, add static file support and other enhancements(#2679)
* Module-ize server routes and add static file support (#2510)

* Refactor server routes to modules

New module type: serverroute

Caveats: Loading order is not deterministic but this would only matter
if two route modules attempted to use the same path regexp (that would
be silly).

* Add static assets plugin

This plugin allows the node server to fetch static assets in the /assets
directory. I felt that this was a feature that goes above the core
functionality. That is why I added it as a plugin. with the modular
route extensions this was a breeze.

* Add serverroute description to ModuleTypes

* Coding standards tweaks

* Fix filename typo

* Move support for attachments from a plugin into the core

* Missing "else"

* Refactor server handling

* Introduce a new named parameter scheme for commands
* Move the SimpleServer class into it's own module
* Deprecate the --server command because of the unwieldy syntax
* Add a new --listen command using the new syntax

For example:

tiddlywiki mywiki --listen host:0.0.0.0 port:8090

* Add check for unknown parameters

* Add support for multiple basic authentication credentials in a CSV file

Beware: Passwords are stored in plain text. If that's a problem, use an authenticating proxy and the trusted header authentication approach.

* Refactor module locations

* Rename "serverroute" module type to "route"

* Remove support for verifying optional named command parameters

The idea was to be able to flag unknown parameter names, but requiring a command to pre-specify all the parameter names makes it harder for (say) the listen command to be extensible so that plugins can add new optional parameters that they handle. (This is particularly in the context of work in progress to encapsulate authenticators into their own modules).

* Refactor the two authenticators into separate modules and add support for authorization

* Correct mistaken path.join vs. path.resolve

See https://stackoverflow.com/a/39836259

* Docs for the named command parameters

I'd be grateful if anyone with sufficient Windows experience could confirm that the note about double quotes in "NamedCommandParameters" is correct.

* Be consistent about lower case parameter names

* Do the right thing when we have a username but no password

With a username parameter but no password parameter we'll attribute edits to that username, but not require authentication.

* Remove obsolete code

* Add support for requiring authentication without restricting the username

* Refactor authorization checks

* Return read_only status in /status response

* Fix two code typos

* Add basic support for detecting readonly status and avoiding write errors

We now have syncadaptors returning  readonly status and avoid attempting to write to the server if it's going to fail

* Add readonly-styles

We hide editing-related buttons in read only mode

I've made this part of the tiddlyweb plugin but I think a case could be made for putting it into the core.

* Add custom request header as CSRF mitigation

By default we require the header X-Requested-With to be set to TiddlyWiki. Can be overriden by setting csrfdisable to "yes"

See https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Protecting_REST_Services:_Use_of_Custom_Request_Headers

* Add support for HTTPS

* First pass at a route for serving rendered tiddlers

cc @Drakor

* Tweaks to the single tiddler static view

Adding a simple sidebar

* Switch to "dash" separated parameter names

* Typo

* Docs: Update ServerCommand and ListenCommand

* First pass at docs for the new web server stuff

Writing the docs is turning out to be quite an undertaking, much harder than writing the code!

* Get rid of extraneous paragraphs in static renderings

* Rejig anonymous user handling

Now we can support wikis that are read-only for anonymous access, but allow a user to login for read/write access.

* More docs

Slowly getting there...

* Static tiddler rendering: Fix HTML content in page title

* Docs updates

* Fix server command parameter names

Missed off 30ce7ea

* Docs: Missing quotes

* Avoid inadvertent dependency on Node.js > v9.6.0

The listenOptions parameter of the plain HTTP version of CreateServer was only introduced in v9.6.0

cc @Drakor @pmario

* Typo
2018-07-18 16:54:43 +01:00
Daniel Rodríguez Rivero 4c89bbabbe Retain $:/status/UserName when logged out (#2893)
The user name tiddler should not be removed just because we are not logged in
2018-05-09 14:22:55 +01:00
Jermolene ab5e5795e8 Fix issue with lazy loading temporary tiddlers
Fixes #3235
2018-05-03 18:27:17 +01:00
Jermolene 05a3d9a302 Syncer: allow logging to be disabled
We don't want the syncer used by the savetrail plugin to be logging
2017-09-26 17:10:57 +01:00
Jermolene 73953080e3 SaveTrailPlugin: Fix syncer UI interactions
The syncer used by the savetrail plugin shouldn't perform any UI interactions
2017-09-20 16:28:11 +01:00
Jermolene 51b1ead5c9 Add more colour to command line output 2017-09-04 14:55:12 +01:00
Jermolene db056a84a5 Remove obsolete code 2017-02-04 18:14:20 +00:00
Jermolene 6c65aa2a6d Make the syncer more configurable, including names for sync adaptors
@danielo515 you may want to add a name to your sync adaptor 😄
2017-02-04 17:25:30 +00:00
Jermolene 18dd8d4433 Fix problem with lazy loading under Node.js
Fixes #2514
2016-08-16 15:48:14 +01:00
Jermolene 7326a3a4cc Only call isReady() for sync adaptors that support it
Fixes #2522
2016-08-06 14:45:33 +01:00
Jermolene c3d18364c1 Don't use syncadaptors until they are ready
Fixes #2453
2016-07-05 11:29:59 +01:00
Myeongjin 6388f859d1 Add localisable strings for error (#2447)
* Add localisable strings for error

* Update tiddler Transclusion Basic Usage in fr-FR
2016-05-17 21:58:47 +01:00
Myeongjin 8afc1e9354 Add localisable strings (#2438)
* Add localisable string for recursive transclusion error

* Add localisable string for count

* Add localisable strings for syncer
2016-05-12 08:44:28 -06:00
Jermolene 1e0d019610 Don't repeatedly lazy load the same tiddler
If we don’t get a “text” field back the first time we shouldn’t keep
asking for it.
2016-04-18 14:50:13 +01:00
Jermolene 48dcf959ff Refactor browser unload task handling
Make it possible to register multiple task functions that will be
called when the window is unloaded
2015-05-03 16:23:35 +01:00
Jermolene 3657bbe920 Switch from addEventListener to onbeforeunload
This makes it possible for TiddlyDesktop to reuse these functions to
handle detecting unsaved changes
2015-01-10 18:08:12 +00:00
Jermolene eacb9e53eb Delete syncer tiddlerInfo when tiddlers are deleted 2014-09-24 16:21:59 +02:00
Jermolene a159b5baf3 Add tiddlerInfo to the syncadaptor saveTiddler method 2014-09-24 13:15:16 +02:00
Jermolene 2f6d16b0fa Improve comments and coding style 2014-09-01 20:39:08 +01:00
Jermolene 3a67fdb768 Obeisance to JSHint for core modules
There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.
2014-08-30 20:44:26 +01:00
Jermolene 2f69ea362c Rename "tw-*" messages to "tm-*" 2014-08-28 21:43:44 +01:00
Jermolene 787481a804 Change more "tw-*" classes to "tc-*"
Part of #764
2014-08-28 18:21:08 +01:00
Jermolene f75af2c983 Separate the saver handling out of the syncer 2014-08-14 11:43:07 +01:00
Jermolene 27f1f82a70 Rejigging syncer structuring
The goal is to separate out the saver handling from the syncadaptor
handling; it will take a few steps to get there
2014-08-14 11:12:25 +01:00
Jermolene d57446f1e4 Remove $tw.syncer global from syncer.js 2014-08-14 08:54:31 +01:00
Jermolene 35fcdd270e Move syncer event handlers into syncer module 2014-08-13 20:25:23 +01:00
Jermolene 7c1cb97f7f Move syncer-browser startup handling into syncer.js 2014-08-13 20:07:08 +01:00
Jermolene c9ce606b7c Move the unsaved changes warning into the syncer 2014-08-13 19:29:00 +01:00
Jermolene 56945d91d3 Add unsaved changes indicator
The “save” icon changes to red to indicate that there are unsaved
changes.
2014-07-30 16:46:13 +01:00
Jermolene e366aa3746 Use Date.now() instead of new Date()
Just for when what we actually want is a millisecond counter.

Interesting video about this:

https://www.youtube.com/watch?v=Vo72W1HWeFI
2014-04-14 09:02:52 +01:00
Jermolene b7f674c51a First pass at refactoring filter execution
This is the beginning of addressing #523.
2014-04-03 20:49:16 +01:00
buggyj aa63151815 syncer freeze fix 2014-03-19 20:20:54 +05:30
Jermolene e051eb7d90 Making more things translateable
Now we’re done with the text that lives in tiddlers, and we’ll need to
get on with the text that is embedded in code modules.
2014-02-16 09:46:43 +00:00
Jermolene 70a120d4a6 Expand the logging mechanism to support alerts overlaid on the main screen
Now we get decent visual indication of sync errors, for instance. Still
work to do to coalesce alerts so that the screen doesn’t fill up with
them after an interval. And probably we should add a button to clear
all alerts.
2014-02-14 07:53:41 +00:00
Jermolene 190ced7cdd Sync from server even when not logged in 2014-02-11 19:10:40 +00:00