1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-26 07:13:15 +00:00
Commit Graph

158 Commits

Author SHA1 Message Date
Jeremy Ruston
f56f5dcc56 Fix savetiddlers handling of tiddlers with no text field 2023-11-29 11:23:57 +00:00
WhiteFall
28aef51855
Add explodePlugins=yes option to savewikifolder command (#7490)
* add option explodeplugins

refactor

Maintain Parameter Compatibility

change let to var

Refactoring the code

add conditional judgment

use === to avoid type-casting errors

refactor use <path> [<name>=<value>]

delete redundant code

backward compatibility support

easier to use

improve code

add documentation

* Update Notes

* Improve the code
2023-06-29 15:40:35 +01:00
Jeremy Ruston
a5894946de
Extend encodeuricomponent to process additional characters (#7128)
* First commit

* Fix version number in docs

* Add code comment
2023-01-19 17:45:54 +00:00
jeremy@jermolene.com
0db987da60 Minor tweaks for #7073 2022-12-04 11:03:51 +00:00
Carlo Colombo
a93a499684
Add commands command to run commands returned from a filter (#7073) 2022-12-04 10:59:59 +00:00
FSpark
2c607ee8e6
Add storyTiddler to render command (#6746) 2022-06-29 08:58:40 +01:00
Joshua Fontany
42bf203758
Fix 6649 (#6650)
* use filesystem utils

* use filesystem utils

* don't touch syncer

* fix messaging
2022-04-19 08:18:44 +01:00
jeremy@jermolene.com
73138b79aa Save command exit with error when encountering missing tiddlers
Fixes #6603
2022-04-06 17:18:13 +01:00
Jeremy Ruston
82c8fe7fa8
Introduce JSON parse utility function with error handling (#6401)
* Introduce JSON parse utility function with error handling

Fixes #6400

* Fix typo
2022-02-21 15:29:25 +00:00
jeremy@jermolene.com
e577cf7302 Render command: verbose mode should print title before rendering
Fixes #6067
2021-09-24 18:40:34 +01:00
Joe Bordes
82ec63e711
style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
Joshua Fontany
a2e7cc51b5
Fix 5483 & 3483 (#5504) 2021-03-26 08:39:32 +00:00
jeremy@jermolene.com
8aad7b00ab Render command: fix bug with multiple variable usage 2021-03-19 18:35:10 +00:00
jeremy@jermolene.com
a38dc17300 Extend render command to allow multiple variables to be passed 2021-03-19 17:09:53 +00:00
Joshua Fontany
bfa062f23d
Fix filesystem (#5465) 2021-02-04 16:11:07 +00:00
Florian Kohrt
4cd6a24431
Mention <tiddler-filter> parameter of savelibrarytiddlers command (#4857) 2020-09-24 19:09:06 +01:00
Arlen22
81f07cdf85
Use this.wiki where applicable (#4601)
* Use state.wiki

* use local wiki where available

* fix a couple this vs self cases
2020-05-06 11:27:50 +01:00
jeremy@jermolene.com
5688670da6 makelibrary command: Guard against invalid directories 2020-04-20 12:58:27 +01:00
jeremy@jermolene.com
678e25f510 makelibrary command should skip non-directories
Fixes #4583
2020-04-20 11:47:54 +01:00
Jeremy Ruston
0836fb7184 Makelibrary.js: Minor refactoring 2020-04-14 12:08:15 +01:00
jed
4146a04a9e
Fix makelibrary.js to use enviroment variable paths (#4559)
This makes makelibrary.js use environment variables to find paths for plugins, themes and languages instead of just using the paths hardcoded in boot.js
2020-04-14 12:03:12 +01:00
Jeremy Ruston
93e01435d1 Dynamic plugins: Change "contains JavaScript" to "requires reload"
We might in the future offer support for certain types of JS module to be hot loaded.
2019-09-27 16:47:55 +01:00
Jeremy Ruston
1c23059204
Dynamic loading/unloading of plugins (#4259)
* First pass at dynamic loading/unloading

* Show warning for changes to plugins containing JS modules

* Use $:/config/RegisterPluginType/* for configuring whether a plugin type is automatically registered

Where "registered" means "the constituent shadows are loaded".

* Fix the info plugin

The previous mechanism re-read all plugin info during startup

* Don't prettify JSON in the plugin library

* Indicate in plugin library whether a plugin requires reloading

* Display the highlighted plugin name in the plugin chooser

And if there's no name field fall back to the part of the title after the final slash.
2019-09-16 12:15:39 +01:00
Jeremy Ruston
5b09881679 Add new deletetiddlers command 2019-05-30 16:54:57 +01:00
Jermolene
b7e0930122 savewikifolder: Fix custom plugin fields
We need to carry across all plugin fields into the tiddlywiki.info file
2019-04-16 11:59:34 +01:00
Jermolene
373afd72c8 Add savewikifolder command
Makes it much easier to convert a TiddlyWiki HTML file into a full wiki folder.
2019-04-14 12:04:00 +01:00
Jermolene
12630d4a91 Provide an option for the load command to not error if no tiddlers are found 2019-03-08 16:43:04 +00:00
Arlen22
603c564872 Add the "tiddlywiki" argument to the server start hook (#3592)
* Update Hook__th-server-command-post-start.tid

* Update server.js

* Update listen.js
2018-11-29 09:51:11 +00: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
Jermolene
1ce9973bed Add optional debug logging to the server command 2018-06-20 12:43:41 +01:00
Jermolene
c29f5a1b61 Server command: map missing path to "/"
Otherwise, the user gets a 404 if we use a path prefix and the user omits the trailing slash
2018-06-20 12:18:35 +01:00
Arlen22
2163302190 Invoke hook when server starts (#3024)
* Invoke hook when server starts

Invokes the `th-server-command-start` hook when the server is started, with the server object as the parameter. This allows adding a WebSocket listener to the server.

* Return the HTTP server from the listen function

Returns the node HTTP server created in the listen function to allow extension

* Add node HTTP server to server-command-start hook

* Change hook to post start in case we add a pre-start hook

* Create Hook__th-server-command-post-start.tid
2018-04-10 21:55:54 +01:00
Jermolene
f4fd5e76f8 Server command: support environment variables for specifying port number 2018-03-28 11:58:46 +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
51b1ead5c9 Add more colour to command line output 2017-09-04 14:55:12 +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
c25a1eef33 Remove obsolete code and update docs 2017-07-12 16:50:50 +01:00
Jermolene
69528093d9 Update fetch commands to respect 302 redirects
Astonishingly, node.js appears to require us to do this manually…
2017-07-05 10:58:35 +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
Arlen22
1530b3e2d8 Put request handler on SimpleServer.prototype (#2627)
The request handler may be used by ExpressJS apps directly and can do most of the heavy lifting without any modification. Note that the self variable must be assignee using `[Function].bind(null,SimpleServer instance)`.
2016-12-17 15:06:10 +00:00
Jermolene
1bba9dc315 Reuse $tw.loadTiddlersFromPath() in --load command
Thus allowing things like tiddlywiki.files to be used with the —load
command
2016-12-15 17:13:32 +00:00
Jermolene
bdd5aa9343 Trap missing tiddlers in savetiddler command 2016-06-23 16:19:00 +01:00
Jermolene
ac00aa8407 Allow server module to work under Node even if $tw.browser is defined
Needed for TiddlyDesktop, where want to be able to run the HTTP server
in a hybrid browser/node environment.
2015-11-10 18:13:30 +00: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
eb9fb6635d Fix issues with creation and modification dates
There were several places where tiddlers were being written without the
creation/modification details being updated.

See
https://groups.google.com/d/msgid/tiddlywiki/17ef8ab0-0128-4467-8a9d-f17
bdbcf3618%40googlegroups.com
2015-09-11 13:34: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
Jermolene
32f6d7f1b0 Revert getTiddlerData() and add getTiddlerDataCached()
For backwards compatibility, we now explicitly request the cacheable
version of this method.

Fixes #1873
2015-07-10 16:43:50 +01:00