1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00
TiddlyWiki5/core/templates
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
..
exporters Update export button to use tiddler title as filename base 2014-11-22 14:19:10 +00:00
server Module-ize server routes, add static file support and other enhancements(#2679) 2018-07-18 16:54:43 +01:00
alltiddlers.template.html.tid Fix problem with static "all tiddlers" export 2014-12-04 07:58:30 +00:00
canonical-uri-external-image.tid Rename $:/core/templates/canonical-uri-external-image 2014-06-13 10:04:31 +01:00
canonical-uri-external-raw.tid Add another canonical_uri template 2017-08-19 10:31:42 +01:00
canonical-uri-external-text.tid Limited implementation of external text tiddlers in the browser 2015-08-29 16:33:04 +01:00
css-tiddler.tid Change widget syntax to $ instead of underscore 2012-12-30 13:55:19 +00:00
html-div-tiddler.tid Change widget syntax to $ instead of underscore 2012-12-30 13:55:19 +00:00
html-tiddler.tid Change widget syntax to $ instead of underscore 2012-12-30 13:55:19 +00:00
javascript-tiddler.tid Change widget syntax to $ instead of underscore 2012-12-30 13:55:19 +00:00
json-tiddler.tid Add support for JSON files containing a single tiddler 2017-03-17 14:19:43 +00:00
module-tiddler.tid Change widget syntax to $ instead of underscore 2012-12-30 13:55:19 +00:00
MOTW.html.tid Change http://*.tiddlywiki.com/* to https:// 2017-11-11 11:56:20 +00:00
plain-text-tiddler.tid Change widget syntax to $ instead of underscore 2012-12-30 13:55:19 +00:00
raw-static-tiddler.tid Add more flexible support for static content 2016-06-23 16:29:51 +01:00
save-all.tid Add publishFilter to default save template 2015-07-12 09:08:11 +01:00
save-empty.tid Improve handling of popup state 2014-06-22 11:14:11 +01:00
save-lazy-all.tid Add a lazy loading template for all non-system tiddlers 2015-11-05 12:33:20 +00:00
save-lazy-images.tid Avoid saving $:/HistoryList 2014-07-03 14:33:20 +01:00
single.tiddler.window.tid Introduce template for single tiddler windows 2015-05-03 14:58:33 +01:00
split-recipe.tid Extend ginsu.sh to generate a split.recipe file 2013-08-03 15:03:07 +01:00
static-tiddler.tid All-in-one static HTML support 2013-12-31 09:43:46 +00:00
static.area.tid Add more flexible support for static content 2016-06-23 16:29:51 +01:00
static.content.tid Change http://*.tiddlywiki.com/* to https:// 2017-11-11 11:56:20 +00:00
static.template.css.tid Fix static CSS generation 2014-02-20 18:33:01 +00:00
static.template.html.tid Added mobile-web-app-capable meta tag for Android Chrome (#2456) 2016-07-11 11:16:58 +01:00
static.tiddler.html.tid Added mobile-web-app-capable meta tag for Android Chrome (#2456) 2016-07-11 11:16:58 +01:00
store.area.template.html.tid Fixed illegal HTML comments 2013-12-20 18:22:01 +00:00
tid-tiddler.tid Don't save "bag" fields 2013-03-25 12:22:15 +00:00
tiddler-metadata.tid Don't save "bag" fields 2013-03-25 12:22:15 +00:00
tiddlywiki5.html.tid Adjust capitalisation of X-UA-Compatible meta tag 2017-03-27 10:00:05 +01:00
version.tid Remove version widget in favour of widget macro 2013-11-01 13:22:06 +00:00
wikified-tiddler.tid Initial Commit 2013-10-12 17:05:13 +01:00