1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-09 03:19:56 +00:00
Commit Graph

36 Commits

Author SHA1 Message Date
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
Jermolene
1ce9973bed Add optional debug logging to the server command 2018-06-20 12:43:41 +01:00
Jermolene
633208958c Docs: Clarify example of using environment variables for port number 2018-03-29 12:34:50 +01:00
Jermolene
f4fd5e76f8 Server command: support environment variables for specifying port number 2018-03-28 11:58:46 +01:00
Jermolene
29364cbd08 Change http://*.tiddlywiki.com/* to https:// 2017-11-11 11:56:20 +00:00
Jermolene
c4e2793b06 Docs updates 2017-11-09 16:07:01 +00:00
Jermolene
49fad6dae9 Docs tweaks 2017-10-03 21:00:36 +01:00
Jermolene
35a7a66b01 Add "save" and "render" commands
A first pass at fixing #2973 - comments are welcome. If everybody is
happy, the next step is to deprecate the existing
rendertiddler(s)/savetiddler(s) commands and replace them in all
examples and tiddlywiki.info files with the new equivalents.
2017-09-12 16:04:07 +01:00
Jermolene
e951047461 Add import command
Unlike load, allows manual control of the deserializer to be used
2017-07-12 17:14:27 +01:00
Jermolene
c6e4b7a123 Update load command docs 2017-07-12 17:13:59 +01:00
Jermolene
c179dc93cb Add "raw-file(s)" options to "fetch" command 2017-07-03 16:52:10 +01:00
Jermolene
0d0ece6377 Add new "fetch" command
Like the load command except retrieves the file over HTTP/HTTPS.

Allows experimentation with server-side twederation

This is a cleaned up version of code that I wrote last year at TWEUM
2016 @inmysocks @pmario @twMat @xcazin
2017-02-18 13:33:41 +00:00
Jermolene
6f93ce6ea7 Enhance rendertiddler command with support for additional variable
Passing an arbitrary variable allows us to e.g. reuse the export
filters as shown in the example
2017-02-18 13:17:44 +00:00
Myeongjin
d7f1f973a9 replace type to rendertype at setfield help 2015-10-18 17:23:37 +09:00
Myeongjin
8e68f904f1 remove unnecessary spaces 2015-10-18 16:49:48 +09:00
Tony Grosinger
11b09be523 Provide clarification about running with password 2015-10-04 10:51:27 -07:00
Jermolene
814353d8ce Fix accidental inconsistency between savetiddlers and rendertiddlers
“-do-not-delete” flag for savetiddlers command was introduced in 5.1.10
without consistency with the already implemented “noclean” flag for the
rendertiddlers command
2015-09-29 17:04:01 +01:00
Jermolene
5176f008f0 Enhance savetiddlers command with do not delete option 2015-09-03 08:54:17 +01:00
Jermolene
4ccdaf3faf Enhance rendertiddler command with template option 2015-09-03 08:53:08 +01:00
James Welford Anderson
e87dadd61d update docs change var name 2015-01-12 02:55:42 +09:00
Jermolene
938e782772 Update docs 2014-10-31 20:12:06 +00:00
Jermolene
17a594a97a Add unpackplugin command
Needed for the translators edition
2014-10-29 11:43:43 +00:00
Jermolene
04d26e6fae First pass at an --editions command
Also added a “description” field for wiki folders.

Right now there’s too many editions listed. I think we should by
default only list editions whose `tiddlywiki.info` file has
`showInListings` set to `true`, and have an `--editions all` command
that lists everything.

@pmario please could you check that the editions in your
`TIDDLYWIKI_EDITION_PATH` are correctly listed?
2014-10-27 21:50:25 +00:00
Jermolene
d3ad7a52c1 Correct setfield documentation 2014-09-20 12:10:50 +01:00
Jermolene
169a38164f Update server command docs 2014-09-04 10:51:54 +01:00
Jermolene
e7358c9b31 Missing docs for makelibrary command 2014-09-03 10:05:00 +01:00
Xavier Cazin
d880cb135a Update what was left from a copy/paste of savetiddler.tid :-) 2014-06-14 07:35:53 +02:00
Jermolene
eee3a0cf8e Extend server command to allow a path prefix
Thereby making the number of parameters to the command ludicrous
2014-06-13 14:44:34 +01:00
Jermolene
d2796d0c9c Introduce setfield command
This new command will let us do the manipulations needed to set up
external image tiddlers
2014-06-11 10:05:35 +01:00
Jermolene
305617b632 Introduce savetiddlers command
Allows us to save tiddlers in their raw format.
2014-06-09 14:45:41 +01:00
Jeremy Ruston
fac0affa7b Merge pull request #584 from xcazin/fr-FR
fr-FR translations for new Help tiddlers + changes to previous ones.
2014-04-27 08:46:59 +01:00
Jermolene
e9557b578e Improve output directory handling
This change is likely to break most existing scripts that call
TiddlyWiki.

TL;DR - output paths are now relative to the editions/output folder,
rather than to the current folder

See [[Notes for upgrading to 5.0.11-beta]] for details.
2014-04-27 08:28:21 +01:00
Xavier Cazin
fb3a31ae43 Typo: Set => Clear 2014-04-26 11:12:59 +02:00
Jermolene
f7e50e0950 Add --build command
First pass at the build system described in #356.

To test it, move to a new, empty directory and try `tiddlywiki
editions/tw5.com --verbose --build`
2014-04-25 22:41:59 +01:00
Jermolene
09214d1c33 Fix problem with --load command overwriting $:/core
Now we use the `wiki.importTiddler()` method - it rejects attempts to
load older versions of loaded plugins
2014-03-31 12:46:10 +01:00
Jermolene
e5103c32f3 Move command documentation into the core 2014-02-25 14:50:37 +00:00